/** */ package edu.ufc.femtost.disc.sysml4modelica.modelicametamodel.modelica.impl; import edu.ufc.femtost.disc.sysml4modelica.modelicametamodel.modelica.Annotation; import edu.ufc.femtost.disc.sysml4modelica.modelicametamodel.modelica.ModelicaClassDefinition; import edu.ufc.femtost.disc.sysml4modelica.modelicametamodel.modelica.modelicaPackage; 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.impl.EObjectImpl; import org.eclipse.emf.ecore.util.EcoreUtil; /** * <!-- begin-user-doc --> * An implementation of the model object '<em><b>Annotation</b></em>'. * <!-- end-user-doc --> * <p> * The following features are implemented: * <ul> * <li>{@link edu.ufc.femtost.disc.sysml4modelica.modelicametamodel.modelica.impl.AnnotationImpl#getBody <em>Body</em>}</li> * <li>{@link edu.ufc.femtost.disc.sysml4modelica.modelicametamodel.modelica.impl.AnnotationImpl#getOwnerMCD <em>Owner MCD</em>}</li> * </ul> * </p> * * @generated */ public class AnnotationImpl extends EObjectImpl implements Annotation { /** * The default value of the '{@link #getBody() <em>Body</em>}' attribute. * <!-- begin-user-doc --> * <!-- end-user-doc --> * @see #getBody() * @generated * @ordered */ protected static final String BODY_EDEFAULT = null; /** * The cached value of the '{@link #getBody() <em>Body</em>}' attribute. * <!-- begin-user-doc --> * <!-- end-user-doc --> * @see #getBody() * @generated * @ordered */ protected String body = BODY_EDEFAULT; /** * <!-- begin-user-doc --> * <!-- end-user-doc --> * @generated */ protected AnnotationImpl() { super(); } /** * <!-- begin-user-doc --> * <!-- end-user-doc --> * @generated */ @Override protected EClass eStaticClass() { return modelicaPackage.Literals.ANNOTATION; } /** * <!-- begin-user-doc --> * <!-- end-user-doc --> * @generated */ public String getBody() { return body; } /** * <!-- begin-user-doc --> * <!-- end-user-doc --> * @generated */ public void setBody(String newBody) { String oldBody = body; body = newBody; if (eNotificationRequired()) eNotify(new ENotificationImpl(this, Notification.SET, modelicaPackage.ANNOTATION__BODY, oldBody, body)); } /** * <!-- begin-user-doc --> * <!-- end-user-doc --> * @generated */ public ModelicaClassDefinition getOwnerMCD() { if (eContainerFeatureID() != modelicaPackage.ANNOTATION__OWNER_MCD) return null; return (ModelicaClassDefinition)eInternalContainer(); } /** * <!-- begin-user-doc --> * <!-- end-user-doc --> * @generated */ public NotificationChain basicSetOwnerMCD(ModelicaClassDefinition newOwnerMCD, NotificationChain msgs) { msgs = eBasicSetContainer((InternalEObject)newOwnerMCD, modelicaPackage.ANNOTATION__OWNER_MCD, msgs); return msgs; } /** * <!-- begin-user-doc --> * <!-- end-user-doc --> * @generated */ public void setOwnerMCD(ModelicaClassDefinition newOwnerMCD) { if (newOwnerMCD != eInternalContainer() || (eContainerFeatureID() != modelicaPackage.ANNOTATION__OWNER_MCD && newOwnerMCD != null)) { if (EcoreUtil.isAncestor(this, newOwnerMCD)) throw new IllegalArgumentException("Recursive containment not allowed for " + toString()); NotificationChain msgs = null; if (eInternalContainer() != null) msgs = eBasicRemoveFromContainer(msgs); if (newOwnerMCD != null) msgs = ((InternalEObject)newOwnerMCD).eInverseAdd(this, modelicaPackage.MODELICA_CLASS_DEFINITION__ANNOTATIONS, ModelicaClassDefinition.class, msgs); msgs = basicSetOwnerMCD(newOwnerMCD, msgs); if (msgs != null) msgs.dispatch(); } else if (eNotificationRequired()) eNotify(new ENotificationImpl(this, Notification.SET, modelicaPackage.ANNOTATION__OWNER_MCD, newOwnerMCD, newOwnerMCD)); } /** * <!-- begin-user-doc --> * <!-- end-user-doc --> * @generated */ @Override public NotificationChain eInverseAdd(InternalEObject otherEnd, int featureID, NotificationChain msgs) { switch (featureID) { case modelicaPackage.ANNOTATION__OWNER_MCD: if (eInternalContainer() != null) msgs = eBasicRemoveFromContainer(msgs); return basicSetOwnerMCD((ModelicaClassDefinition)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 modelicaPackage.ANNOTATION__OWNER_MCD: return basicSetOwnerMCD(null, msgs); } return super.eInverseRemove(otherEnd, featureID, msgs); } /** * <!-- begin-user-doc --> * <!-- end-user-doc --> * @generated */ @Override public NotificationChain eBasicRemoveFromContainerFeature(NotificationChain msgs) { switch (eContainerFeatureID()) { case modelicaPackage.ANNOTATION__OWNER_MCD: return eInternalContainer().eInverseRemove(this, modelicaPackage.MODELICA_CLASS_DEFINITION__ANNOTATIONS, ModelicaClassDefinition.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 modelicaPackage.ANNOTATION__BODY: return getBody(); case modelicaPackage.ANNOTATION__OWNER_MCD: return getOwnerMCD(); } return super.eGet(featureID, resolve, coreType); } /** * <!-- begin-user-doc --> * <!-- end-user-doc --> * @generated */ @Override public void eSet(int featureID, Object newValue) { switch (featureID) { case modelicaPackage.ANNOTATION__BODY: setBody((String)newValue); return; case modelicaPackage.ANNOTATION__OWNER_MCD: setOwnerMCD((ModelicaClassDefinition)newValue); return; } super.eSet(featureID, newValue); } /** * <!-- begin-user-doc --> * <!-- end-user-doc --> * @generated */ @Override public void eUnset(int featureID) { switch (featureID) { case modelicaPackage.ANNOTATION__BODY: setBody(BODY_EDEFAULT); return; case modelicaPackage.ANNOTATION__OWNER_MCD: setOwnerMCD((ModelicaClassDefinition)null); return; } super.eUnset(featureID); } /** * <!-- begin-user-doc --> * <!-- end-user-doc --> * @generated */ @Override public boolean eIsSet(int featureID) { switch (featureID) { case modelicaPackage.ANNOTATION__BODY: return BODY_EDEFAULT == null ? body != null : !BODY_EDEFAULT.equals(body); case modelicaPackage.ANNOTATION__OWNER_MCD: return getOwnerMCD() != null; } 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(" (body: "); result.append(body); result.append(')'); return result.toString(); } } //AnnotationImpl