/** * <copyright> * </copyright> * * $Id$ */ package org.eclipse.acceleo.tutorial.webapp.impl; import org.eclipse.acceleo.tutorial.webapp.Application; import org.eclipse.acceleo.tutorial.webapp.Collection; import org.eclipse.acceleo.tutorial.webapp.Model; import org.eclipse.acceleo.tutorial.webapp.WebappPackage; import org.eclipse.emf.common.notify.Notification; import org.eclipse.emf.common.notify.NotificationChain; import org.eclipse.emf.ecore.EClass; import org.eclipse.emf.ecore.InternalEObject; import org.eclipse.emf.ecore.impl.ENotificationImpl; import org.eclipse.emf.ecore.util.EcoreUtil; /** * <!-- begin-user-doc --> * An implementation of the model object '<em><b>Collection</b></em>'. * <!-- end-user-doc --> * <p> * The following features are implemented: * <ul> * <li>{@link org.eclipse.acceleo.tutorial.webapp.impl.CollectionImpl#getModel <em>Model</em>}</li> * <li>{@link org.eclipse.acceleo.tutorial.webapp.impl.CollectionImpl#getApplication <em>Application</em>}</li> * </ul> * </p> * * @generated */ public class CollectionImpl extends NamedElementImpl implements Collection { /** * The cached value of the '{@link #getModel() <em>Model</em>}' reference. * <!-- begin-user-doc --> * <!-- end-user-doc --> * @see #getModel() * @generated * @ordered */ protected Model model; /** * <!-- begin-user-doc --> * <!-- end-user-doc --> * @generated */ protected CollectionImpl() { super(); } /** * <!-- begin-user-doc --> * <!-- end-user-doc --> * @generated */ @Override protected EClass eStaticClass() { return WebappPackage.Literals.COLLECTION; } /** * <!-- begin-user-doc --> * <!-- end-user-doc --> * @generated */ public Model getModel() { if (model != null && model.eIsProxy()) { InternalEObject oldModel = (InternalEObject)model; model = (Model)eResolveProxy(oldModel); if (model != oldModel) { if (eNotificationRequired()) eNotify(new ENotificationImpl(this, Notification.RESOLVE, WebappPackage.COLLECTION__MODEL, oldModel, model)); } } return model; } /** * <!-- begin-user-doc --> * <!-- end-user-doc --> * @generated */ public Model basicGetModel() { return model; } /** * <!-- begin-user-doc --> * <!-- end-user-doc --> * @generated */ public void setModel(Model newModel) { Model oldModel = model; model = newModel; if (eNotificationRequired()) eNotify(new ENotificationImpl(this, Notification.SET, WebappPackage.COLLECTION__MODEL, oldModel, model)); } /** * <!-- begin-user-doc --> * <!-- end-user-doc --> * @generated */ public Application getApplication() { if (eContainerFeatureID() != WebappPackage.COLLECTION__APPLICATION) return null; return (Application)eContainer(); } /** * <!-- begin-user-doc --> * <!-- end-user-doc --> * @generated */ public NotificationChain basicSetApplication(Application newApplication, NotificationChain msgs) { msgs = eBasicSetContainer((InternalEObject)newApplication, WebappPackage.COLLECTION__APPLICATION, msgs); return msgs; } /** * <!-- begin-user-doc --> * <!-- end-user-doc --> * @generated */ public void setApplication(Application newApplication) { if (newApplication != eInternalContainer() || (eContainerFeatureID() != WebappPackage.COLLECTION__APPLICATION && newApplication != null)) { if (EcoreUtil.isAncestor(this, newApplication)) throw new IllegalArgumentException("Recursive containment not allowed for " + toString()); NotificationChain msgs = null; if (eInternalContainer() != null) msgs = eBasicRemoveFromContainer(msgs); if (newApplication != null) msgs = ((InternalEObject)newApplication).eInverseAdd(this, WebappPackage.APPLICATION__COLLECTIONS, Application.class, msgs); msgs = basicSetApplication(newApplication, msgs); if (msgs != null) msgs.dispatch(); } else if (eNotificationRequired()) eNotify(new ENotificationImpl(this, Notification.SET, WebappPackage.COLLECTION__APPLICATION, newApplication, newApplication)); } /** * <!-- begin-user-doc --> * <!-- end-user-doc --> * @generated */ @Override public NotificationChain eInverseAdd(InternalEObject otherEnd, int featureID, NotificationChain msgs) { switch (featureID) { case WebappPackage.COLLECTION__APPLICATION: if (eInternalContainer() != null) msgs = eBasicRemoveFromContainer(msgs); return basicSetApplication((Application)otherEnd, msgs); } return super.eInverseAdd(otherEnd, featureID, msgs); } /** * <!-- begin-user-doc --> * <!-- end-user-doc --> * @generated */ @Override public NotificationChain eInverseRemove(InternalEObject otherEnd, int featureID, NotificationChain msgs) { switch (featureID) { case WebappPackage.COLLECTION__APPLICATION: return basicSetApplication(null, msgs); } return super.eInverseRemove(otherEnd, featureID, msgs); } /** * <!-- begin-user-doc --> * <!-- end-user-doc --> * @generated */ @Override public NotificationChain eBasicRemoveFromContainerFeature(NotificationChain msgs) { switch (eContainerFeatureID()) { case WebappPackage.COLLECTION__APPLICATION: return eInternalContainer().eInverseRemove(this, WebappPackage.APPLICATION__COLLECTIONS, Application.class, msgs); } return super.eBasicRemoveFromContainerFeature(msgs); } /** * <!-- begin-user-doc --> * <!-- end-user-doc --> * @generated */ @Override public Object eGet(int featureID, boolean resolve, boolean coreType) { switch (featureID) { case WebappPackage.COLLECTION__MODEL: if (resolve) return getModel(); return basicGetModel(); case WebappPackage.COLLECTION__APPLICATION: return getApplication(); } return super.eGet(featureID, resolve, coreType); } /** * <!-- begin-user-doc --> * <!-- end-user-doc --> * @generated */ @Override public void eSet(int featureID, Object newValue) { switch (featureID) { case WebappPackage.COLLECTION__MODEL: setModel((Model)newValue); return; case WebappPackage.COLLECTION__APPLICATION: setApplication((Application)newValue); return; } super.eSet(featureID, newValue); } /** * <!-- begin-user-doc --> * <!-- end-user-doc --> * @generated */ @Override public void eUnset(int featureID) { switch (featureID) { case WebappPackage.COLLECTION__MODEL: setModel((Model)null); return; case WebappPackage.COLLECTION__APPLICATION: setApplication((Application)null); return; } super.eUnset(featureID); } /** * <!-- begin-user-doc --> * <!-- end-user-doc --> * @generated */ @Override public boolean eIsSet(int featureID) { switch (featureID) { case WebappPackage.COLLECTION__MODEL: return model != null; case WebappPackage.COLLECTION__APPLICATION: return getApplication() != null; } return super.eIsSet(featureID); } } //CollectionImpl