| /** | |
| * <copyright> | |
| * </copyright> | |
| * | |
| * $Id$ | |
| */ | |
| package library.impl; | |
| import java.util.Collection; | |
| import library.Author; | |
| import library.Book; | |
| import library.LibraryPackage; | |
| import org.eclipse.emf.common.notify.Notification; | |
| import org.eclipse.emf.common.util.EList; | |
| import org.eclipse.emf.ecore.EClass; | |
| import org.eclipse.emf.ecore.impl.ENotificationImpl; | |
| import org.eclipse.emf.ecore.impl.EObjectImpl; | |
| import org.eclipse.emf.ecore.util.EObjectResolvingEList; | |
| /** | |
| * <!-- begin-user-doc --> | |
| * An implementation of the model object '<em><b>Book</b></em>'. | |
| * <!-- end-user-doc --> | |
| * <p> | |
| * The following features are implemented: | |
| * <ul> | |
| * <li>{@link library.impl.BookImpl#getTitle <em>Title</em>}</li> | |
| * <li>{@link library.impl.BookImpl#getAuthors <em>Authors</em>}</li> | |
| * </ul> | |
| * </p> | |
| * | |
| * @generated | |
| */ | |
| public class BookImpl extends EObjectImpl implements Book { | |
| /** | |
| * The default value of the '{@link #getTitle() <em>Title</em>}' attribute. | |
| * <!-- begin-user-doc --> | |
| * <!-- end-user-doc --> | |
| * @see #getTitle() | |
| * @generated | |
| * @ordered | |
| */ | |
| protected static final String TITLE_EDEFAULT = null; | |
| /** | |
| * The cached value of the '{@link #getTitle() <em>Title</em>}' attribute. | |
| * <!-- begin-user-doc --> | |
| * <!-- end-user-doc --> | |
| * @see #getTitle() | |
| * @generated | |
| * @ordered | |
| */ | |
| protected String title = TITLE_EDEFAULT; | |
| /** | |
| * The cached value of the '{@link #getAuthors() <em>Authors</em>}' reference list. | |
| * <!-- begin-user-doc --> | |
| * <!-- end-user-doc --> | |
| * @see #getAuthors() | |
| * @generated | |
| * @ordered | |
| */ | |
| protected EList<Author> authors; | |
| /** | |
| * <!-- begin-user-doc --> | |
| * <!-- end-user-doc --> | |
| * @generated | |
| */ | |
| protected BookImpl() { | |
| super(); | |
| } | |
| /** | |
| * <!-- begin-user-doc --> | |
| * <!-- end-user-doc --> | |
| * @generated | |
| */ | |
| @Override | |
| protected EClass eStaticClass() { | |
| return LibraryPackage.Literals.BOOK; | |
| } | |
| /** | |
| * <!-- begin-user-doc --> | |
| * <!-- end-user-doc --> | |
| * @generated | |
| */ | |
| public String getTitle() { | |
| return title; | |
| } | |
| /** | |
| * <!-- begin-user-doc --> | |
| * <!-- end-user-doc --> | |
| * @generated | |
| */ | |
| public void setTitle(String newTitle) { | |
| String oldTitle = title; | |
| title = newTitle; | |
| if (eNotificationRequired()) | |
| eNotify(new ENotificationImpl(this, Notification.SET, LibraryPackage.BOOK__TITLE, oldTitle, title)); | |
| } | |
| /** | |
| * <!-- begin-user-doc --> | |
| * <!-- end-user-doc --> | |
| * @generated | |
| */ | |
| public EList<Author> getAuthors() { | |
| if (authors == null) { | |
| authors = new EObjectResolvingEList<Author>(Author.class, this, LibraryPackage.BOOK__AUTHORS); | |
| } | |
| return authors; | |
| } | |
| /** | |
| * <!-- begin-user-doc --> | |
| * <!-- end-user-doc --> | |
| * @generated | |
| */ | |
| @Override | |
| public Object eGet(int featureID, boolean resolve, boolean coreType) { | |
| switch (featureID) { | |
| case LibraryPackage.BOOK__TITLE: | |
| return getTitle(); | |
| case LibraryPackage.BOOK__AUTHORS: | |
| return getAuthors(); | |
| } | |
| return super.eGet(featureID, resolve, coreType); | |
| } | |
| /** | |
| * <!-- begin-user-doc --> | |
| * <!-- end-user-doc --> | |
| * @generated | |
| */ | |
| @SuppressWarnings("unchecked") | |
| @Override | |
| public void eSet(int featureID, Object newValue) { | |
| switch (featureID) { | |
| case LibraryPackage.BOOK__TITLE: | |
| setTitle((String)newValue); | |
| return; | |
| case LibraryPackage.BOOK__AUTHORS: | |
| getAuthors().clear(); | |
| getAuthors().addAll((Collection<? extends Author>)newValue); | |
| return; | |
| } | |
| super.eSet(featureID, newValue); | |
| } | |
| /** | |
| * <!-- begin-user-doc --> | |
| * <!-- end-user-doc --> | |
| * @generated | |
| */ | |
| @Override | |
| public void eUnset(int featureID) { | |
| switch (featureID) { | |
| case LibraryPackage.BOOK__TITLE: | |
| setTitle(TITLE_EDEFAULT); | |
| return; | |
| case LibraryPackage.BOOK__AUTHORS: | |
| getAuthors().clear(); | |
| return; | |
| } | |
| super.eUnset(featureID); | |
| } | |
| /** | |
| * <!-- begin-user-doc --> | |
| * <!-- end-user-doc --> | |
| * @generated | |
| */ | |
| @Override | |
| public boolean eIsSet(int featureID) { | |
| switch (featureID) { | |
| case LibraryPackage.BOOK__TITLE: | |
| return TITLE_EDEFAULT == null ? title != null : !TITLE_EDEFAULT.equals(title); | |
| case LibraryPackage.BOOK__AUTHORS: | |
| return authors != null && !authors.isEmpty(); | |
| } | |
| return super.eIsSet(featureID); | |
| } | |
| /** | |
| * <!-- begin-user-doc --> | |
| * <!-- end-user-doc --> | |
| * @generated | |
| */ | |
| @Override | |
| public String toString() { | |
| if (eIsProxy()) return super.toString(); | |
| StringBuffer result = new StringBuffer(super.toString()); | |
| result.append(" (title: "); | |
| result.append(title); | |
| result.append(')'); | |
| return result.toString(); | |
| } | |
| } //BookImpl |