/** */ package org.eclipse.emf.mwe2.language.mwe2.impl; 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; import org.eclipse.emf.mwe2.language.mwe2.DeclaredProperty; import org.eclipse.emf.mwe2.language.mwe2.Module; import org.eclipse.emf.mwe2.language.mwe2.Mwe2Package; import org.eclipse.emf.mwe2.language.mwe2.Value; /** * <!-- begin-user-doc --> * An implementation of the model object '<em><b>Declared Property</b></em>'. * <!-- end-user-doc --> * <p> * The following features are implemented: * </p> * <ul> * <li>{@link org.eclipse.emf.mwe2.language.mwe2.impl.DeclaredPropertyImpl#getDefault <em>Default</em>}</li> * <li>{@link org.eclipse.emf.mwe2.language.mwe2.impl.DeclaredPropertyImpl#getModule <em>Module</em>}</li> * </ul> * * @generated */ public class DeclaredPropertyImpl extends ReferrableImplCustom implements DeclaredProperty { /** * The cached value of the '{@link #getDefault() <em>Default</em>}' containment reference. * <!-- begin-user-doc --> * <!-- end-user-doc --> * @see #getDefault() * @generated * @ordered */ protected Value default_; /** * <!-- begin-user-doc --> * <!-- end-user-doc --> * @generated */ protected DeclaredPropertyImpl() { super(); } /** * <!-- begin-user-doc --> * <!-- end-user-doc --> * @generated */ @Override protected EClass eStaticClass() { return Mwe2Package.Literals.DECLARED_PROPERTY; } /** * <!-- begin-user-doc --> * <!-- end-user-doc --> * @generated */ public Value getDefault() { return default_; } /** * <!-- begin-user-doc --> * <!-- end-user-doc --> * @generated */ public NotificationChain basicSetDefault(Value newDefault, NotificationChain msgs) { Value oldDefault = default_; default_ = newDefault; if (eNotificationRequired()) { ENotificationImpl notification = new ENotificationImpl(this, Notification.SET, Mwe2Package.DECLARED_PROPERTY__DEFAULT, oldDefault, newDefault); if (msgs == null) msgs = notification; else msgs.add(notification); } return msgs; } /** * <!-- begin-user-doc --> * <!-- end-user-doc --> * @generated */ public void setDefault(Value newDefault) { if (newDefault != default_) { NotificationChain msgs = null; if (default_ != null) msgs = ((InternalEObject)default_).eInverseRemove(this, EOPPOSITE_FEATURE_BASE - Mwe2Package.DECLARED_PROPERTY__DEFAULT, null, msgs); if (newDefault != null) msgs = ((InternalEObject)newDefault).eInverseAdd(this, EOPPOSITE_FEATURE_BASE - Mwe2Package.DECLARED_PROPERTY__DEFAULT, null, msgs); msgs = basicSetDefault(newDefault, msgs); if (msgs != null) msgs.dispatch(); } else if (eNotificationRequired()) eNotify(new ENotificationImpl(this, Notification.SET, Mwe2Package.DECLARED_PROPERTY__DEFAULT, newDefault, newDefault)); } /** * <!-- begin-user-doc --> * <!-- end-user-doc --> * @generated */ public Module getModule() { if (eContainerFeatureID() != Mwe2Package.DECLARED_PROPERTY__MODULE) return null; return (Module)eInternalContainer(); } /** * <!-- begin-user-doc --> * <!-- end-user-doc --> * @generated */ public NotificationChain basicSetModule(Module newModule, NotificationChain msgs) { msgs = eBasicSetContainer((InternalEObject)newModule, Mwe2Package.DECLARED_PROPERTY__MODULE, msgs); return msgs; } /** * <!-- begin-user-doc --> * <!-- end-user-doc --> * @generated */ public void setModule(Module newModule) { if (newModule != eInternalContainer() || (eContainerFeatureID() != Mwe2Package.DECLARED_PROPERTY__MODULE && newModule != null)) { if (EcoreUtil.isAncestor(this, newModule)) throw new IllegalArgumentException("Recursive containment not allowed for " + toString()); NotificationChain msgs = null; if (eInternalContainer() != null) msgs = eBasicRemoveFromContainer(msgs); if (newModule != null) msgs = ((InternalEObject)newModule).eInverseAdd(this, Mwe2Package.MODULE__DECLARED_PROPERTIES, Module.class, msgs); msgs = basicSetModule(newModule, msgs); if (msgs != null) msgs.dispatch(); } else if (eNotificationRequired()) eNotify(new ENotificationImpl(this, Notification.SET, Mwe2Package.DECLARED_PROPERTY__MODULE, newModule, newModule)); } /** * <!-- begin-user-doc --> * <!-- end-user-doc --> * @generated */ public String getIdentifier() { // TODO: implement this method // Ensure that you remove @generated or mark it @generated NOT throw new UnsupportedOperationException(); } /** * <!-- begin-user-doc --> * <!-- end-user-doc --> * @generated */ public String getSimpleName() { // TODO: implement this method // Ensure that you remove @generated or mark it @generated NOT throw new UnsupportedOperationException(); } /** * <!-- begin-user-doc --> * <!-- end-user-doc --> * @generated */ public String getQualifiedName() { // TODO: implement this method // Ensure that you remove @generated or mark it @generated NOT throw new UnsupportedOperationException(); } /** * <!-- begin-user-doc --> * <!-- end-user-doc --> * @generated */ public String getQualifiedName(char innerClassDelimiter) { // TODO: implement this method // Ensure that you remove @generated or mark it @generated NOT throw new UnsupportedOperationException(); } /** * <!-- begin-user-doc --> * <!-- end-user-doc --> * @generated */ @Override public NotificationChain eInverseAdd(InternalEObject otherEnd, int featureID, NotificationChain msgs) { switch (featureID) { case Mwe2Package.DECLARED_PROPERTY__MODULE: if (eInternalContainer() != null) msgs = eBasicRemoveFromContainer(msgs); return basicSetModule((Module)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 Mwe2Package.DECLARED_PROPERTY__DEFAULT: return basicSetDefault(null, msgs); case Mwe2Package.DECLARED_PROPERTY__MODULE: return basicSetModule(null, msgs); } return super.eInverseRemove(otherEnd, featureID, msgs); } /** * <!-- begin-user-doc --> * <!-- end-user-doc --> * @generated */ @Override public NotificationChain eBasicRemoveFromContainerFeature(NotificationChain msgs) { switch (eContainerFeatureID()) { case Mwe2Package.DECLARED_PROPERTY__MODULE: return eInternalContainer().eInverseRemove(this, Mwe2Package.MODULE__DECLARED_PROPERTIES, Module.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 Mwe2Package.DECLARED_PROPERTY__DEFAULT: return getDefault(); case Mwe2Package.DECLARED_PROPERTY__MODULE: return getModule(); } return super.eGet(featureID, resolve, coreType); } /** * <!-- begin-user-doc --> * <!-- end-user-doc --> * @generated */ @Override public void eSet(int featureID, Object newValue) { switch (featureID) { case Mwe2Package.DECLARED_PROPERTY__DEFAULT: setDefault((Value)newValue); return; case Mwe2Package.DECLARED_PROPERTY__MODULE: setModule((Module)newValue); return; } super.eSet(featureID, newValue); } /** * <!-- begin-user-doc --> * <!-- end-user-doc --> * @generated */ @Override public void eUnset(int featureID) { switch (featureID) { case Mwe2Package.DECLARED_PROPERTY__DEFAULT: setDefault((Value)null); return; case Mwe2Package.DECLARED_PROPERTY__MODULE: setModule((Module)null); return; } super.eUnset(featureID); } /** * <!-- begin-user-doc --> * <!-- end-user-doc --> * @generated */ @Override public boolean eIsSet(int featureID) { switch (featureID) { case Mwe2Package.DECLARED_PROPERTY__DEFAULT: return default_ != null; case Mwe2Package.DECLARED_PROPERTY__MODULE: return getModule() != null; } return super.eIsSet(featureID); } } //DeclaredPropertyImpl