/** * <copyright> * </copyright> * * $Id$ */ package orgomg.cwm.objectmodel.behavioral.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 orgomg.cwm.objectmodel.behavioral.BehavioralPackage; import orgomg.cwm.objectmodel.behavioral.Method; import orgomg.cwm.objectmodel.behavioral.Operation; import orgomg.cwm.objectmodel.core.ProcedureExpression; /** * <!-- begin-user-doc --> * An implementation of the model object '<em><b>Method</b></em>'. * <!-- end-user-doc --> * <p> * The following features are implemented: * <ul> * <li>{@link orgomg.cwm.objectmodel.behavioral.impl.MethodImpl#getBody <em>Body</em>}</li> * <li>{@link orgomg.cwm.objectmodel.behavioral.impl.MethodImpl#getSpecification <em>Specification</em>}</li> * </ul> * </p> * * @generated */ public class MethodImpl extends BehavioralFeatureImpl implements Method { /** * The cached value of the '{@link #getBody() <em>Body</em>}' containment reference. * <!-- begin-user-doc --> * <!-- end-user-doc --> * @see #getBody() * @generated * @ordered */ protected ProcedureExpression body; /** * The cached value of the '{@link #getSpecification() <em>Specification</em>}' reference. * <!-- begin-user-doc --> * <!-- end-user-doc --> * @see #getSpecification() * @generated * @ordered */ protected Operation specification; /** * <!-- begin-user-doc --> * <!-- end-user-doc --> * @generated */ protected MethodImpl() { super(); } /** * <!-- begin-user-doc --> * <!-- end-user-doc --> * @generated */ @Override protected EClass eStaticClass() { return BehavioralPackage.Literals.METHOD; } /** * <!-- begin-user-doc --> * <!-- end-user-doc --> * @generated */ public ProcedureExpression getBody() { return body; } /** * <!-- begin-user-doc --> * <!-- end-user-doc --> * @generated */ public NotificationChain basicSetBody(ProcedureExpression newBody, NotificationChain msgs) { ProcedureExpression oldBody = body; body = newBody; if (eNotificationRequired()) { ENotificationImpl notification = new ENotificationImpl(this, Notification.SET, BehavioralPackage.METHOD__BODY, oldBody, newBody); if (msgs == null) msgs = notification; else msgs.add(notification); } return msgs; } /** * <!-- begin-user-doc --> * <!-- end-user-doc --> * @generated */ public void setBody(ProcedureExpression newBody) { if (newBody != body) { NotificationChain msgs = null; if (body != null) msgs = ((InternalEObject)body).eInverseRemove(this, EOPPOSITE_FEATURE_BASE - BehavioralPackage.METHOD__BODY, null, msgs); if (newBody != null) msgs = ((InternalEObject)newBody).eInverseAdd(this, EOPPOSITE_FEATURE_BASE - BehavioralPackage.METHOD__BODY, null, msgs); msgs = basicSetBody(newBody, msgs); if (msgs != null) msgs.dispatch(); } else if (eNotificationRequired()) eNotify(new ENotificationImpl(this, Notification.SET, BehavioralPackage.METHOD__BODY, newBody, newBody)); } /** * <!-- begin-user-doc --> * <!-- end-user-doc --> * @generated */ public Operation getSpecification() { if (specification != null && specification.eIsProxy()) { InternalEObject oldSpecification = (InternalEObject)specification; specification = (Operation)eResolveProxy(oldSpecification); if (specification != oldSpecification) { if (eNotificationRequired()) eNotify(new ENotificationImpl(this, Notification.RESOLVE, BehavioralPackage.METHOD__SPECIFICATION, oldSpecification, specification)); } } return specification; } /** * <!-- begin-user-doc --> * <!-- end-user-doc --> * @generated */ public Operation basicGetSpecification() { return specification; } /** * <!-- begin-user-doc --> * <!-- end-user-doc --> * @generated */ public NotificationChain basicSetSpecification(Operation newSpecification, NotificationChain msgs) { Operation oldSpecification = specification; specification = newSpecification; if (eNotificationRequired()) { ENotificationImpl notification = new ENotificationImpl(this, Notification.SET, BehavioralPackage.METHOD__SPECIFICATION, oldSpecification, newSpecification); if (msgs == null) msgs = notification; else msgs.add(notification); } return msgs; } /** * <!-- begin-user-doc --> * <!-- end-user-doc --> * @generated */ public void setSpecification(Operation newSpecification) { if (newSpecification != specification) { NotificationChain msgs = null; if (specification != null) msgs = ((InternalEObject)specification).eInverseRemove(this, BehavioralPackage.OPERATION__METHOD, Operation.class, msgs); if (newSpecification != null) msgs = ((InternalEObject)newSpecification).eInverseAdd(this, BehavioralPackage.OPERATION__METHOD, Operation.class, msgs); msgs = basicSetSpecification(newSpecification, msgs); if (msgs != null) msgs.dispatch(); } else if (eNotificationRequired()) eNotify(new ENotificationImpl(this, Notification.SET, BehavioralPackage.METHOD__SPECIFICATION, newSpecification, newSpecification)); } /** * <!-- begin-user-doc --> * <!-- end-user-doc --> * @generated */ @Override public NotificationChain eInverseAdd(InternalEObject otherEnd, int featureID, NotificationChain msgs) { switch (featureID) { case BehavioralPackage.METHOD__SPECIFICATION: if (specification != null) msgs = ((InternalEObject)specification).eInverseRemove(this, BehavioralPackage.OPERATION__METHOD, Operation.class, msgs); return basicSetSpecification((Operation)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 BehavioralPackage.METHOD__BODY: return basicSetBody(null, msgs); case BehavioralPackage.METHOD__SPECIFICATION: return basicSetSpecification(null, msgs); } return super.eInverseRemove(otherEnd, featureID, msgs); } /** * <!-- begin-user-doc --> * <!-- end-user-doc --> * @generated */ @Override public Object eGet(int featureID, boolean resolve, boolean coreType) { switch (featureID) { case BehavioralPackage.METHOD__BODY: return getBody(); case BehavioralPackage.METHOD__SPECIFICATION: if (resolve) return getSpecification(); return basicGetSpecification(); } return super.eGet(featureID, resolve, coreType); } /** * <!-- begin-user-doc --> * <!-- end-user-doc --> * @generated */ @Override public void eSet(int featureID, Object newValue) { switch (featureID) { case BehavioralPackage.METHOD__BODY: setBody((ProcedureExpression)newValue); return; case BehavioralPackage.METHOD__SPECIFICATION: setSpecification((Operation)newValue); return; } super.eSet(featureID, newValue); } /** * <!-- begin-user-doc --> * <!-- end-user-doc --> * @generated */ @Override public void eUnset(int featureID) { switch (featureID) { case BehavioralPackage.METHOD__BODY: setBody((ProcedureExpression)null); return; case BehavioralPackage.METHOD__SPECIFICATION: setSpecification((Operation)null); return; } super.eUnset(featureID); } /** * <!-- begin-user-doc --> * <!-- end-user-doc --> * @generated */ @Override public boolean eIsSet(int featureID) { switch (featureID) { case BehavioralPackage.METHOD__BODY: return body != null; case BehavioralPackage.METHOD__SPECIFICATION: return specification != null; } return super.eIsSet(featureID); } } //MethodImpl