/** * <copyright> * </copyright> * * $Id$ */ package orgomg.cwm.objectmodel.behavioral.impl; import java.util.Collection; import org.eclipse.emf.common.notify.Notification; import org.eclipse.emf.common.notify.NotificationChain; import org.eclipse.emf.common.util.EList; 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.EObjectWithInverseResolvingEList; import org.eclipse.emf.ecore.util.InternalEList; import orgomg.cwm.objectmodel.behavioral.BehavioralPackage; import orgomg.cwm.objectmodel.behavioral.CallAction; import orgomg.cwm.objectmodel.behavioral.Method; import orgomg.cwm.objectmodel.behavioral.Operation; /** * <!-- begin-user-doc --> * An implementation of the model object '<em><b>Operation</b></em>'. * <!-- end-user-doc --> * <p> * The following features are implemented: * <ul> * <li>{@link orgomg.cwm.objectmodel.behavioral.impl.OperationImpl#isIsAbstract <em>Is Abstract</em>}</li> * <li>{@link orgomg.cwm.objectmodel.behavioral.impl.OperationImpl#getCallAction <em>Call Action</em>}</li> * <li>{@link orgomg.cwm.objectmodel.behavioral.impl.OperationImpl#getMethod <em>Method</em>}</li> * </ul> * </p> * * @generated */ public class OperationImpl extends BehavioralFeatureImpl implements Operation { /** * The default value of the '{@link #isIsAbstract() <em>Is Abstract</em>}' attribute. * <!-- begin-user-doc --> * <!-- end-user-doc --> * @see #isIsAbstract() * @generated * @ordered */ protected static final boolean IS_ABSTRACT_EDEFAULT = false; /** * The cached value of the '{@link #isIsAbstract() <em>Is Abstract</em>}' attribute. * <!-- begin-user-doc --> * <!-- end-user-doc --> * @see #isIsAbstract() * @generated * @ordered */ protected boolean isAbstract = IS_ABSTRACT_EDEFAULT; /** * The cached value of the '{@link #getCallAction() <em>Call Action</em>}' reference list. * <!-- begin-user-doc --> * <!-- end-user-doc --> * @see #getCallAction() * @generated * @ordered */ protected EList<CallAction> callAction; /** * The cached value of the '{@link #getMethod() <em>Method</em>}' reference list. * <!-- begin-user-doc --> * <!-- end-user-doc --> * @see #getMethod() * @generated * @ordered */ protected EList<Method> method; /** * <!-- begin-user-doc --> * <!-- end-user-doc --> * @generated */ protected OperationImpl() { super(); } /** * <!-- begin-user-doc --> * <!-- end-user-doc --> * @generated */ @Override protected EClass eStaticClass() { return BehavioralPackage.Literals.OPERATION; } /** * <!-- begin-user-doc --> * <!-- end-user-doc --> * @generated */ public boolean isIsAbstract() { return isAbstract; } /** * <!-- begin-user-doc --> * <!-- end-user-doc --> * @generated */ public void setIsAbstract(boolean newIsAbstract) { boolean oldIsAbstract = isAbstract; isAbstract = newIsAbstract; if (eNotificationRequired()) eNotify(new ENotificationImpl(this, Notification.SET, BehavioralPackage.OPERATION__IS_ABSTRACT, oldIsAbstract, isAbstract)); } /** * <!-- begin-user-doc --> * <!-- end-user-doc --> * @generated */ public EList<CallAction> getCallAction() { if (callAction == null) { callAction = new EObjectWithInverseResolvingEList<CallAction>(CallAction.class, this, BehavioralPackage.OPERATION__CALL_ACTION, BehavioralPackage.CALL_ACTION__OPERATION); } return callAction; } /** * <!-- begin-user-doc --> * <!-- end-user-doc --> * @generated */ public EList<Method> getMethod() { if (method == null) { method = new EObjectWithInverseResolvingEList<Method>(Method.class, this, BehavioralPackage.OPERATION__METHOD, BehavioralPackage.METHOD__SPECIFICATION); } return method; } /** * <!-- begin-user-doc --> * <!-- end-user-doc --> * @generated */ @SuppressWarnings("unchecked") @Override public NotificationChain eInverseAdd(InternalEObject otherEnd, int featureID, NotificationChain msgs) { switch (featureID) { case BehavioralPackage.OPERATION__CALL_ACTION: return ((InternalEList<InternalEObject>)(InternalEList<?>)getCallAction()).basicAdd(otherEnd, msgs); case BehavioralPackage.OPERATION__METHOD: return ((InternalEList<InternalEObject>)(InternalEList<?>)getMethod()).basicAdd(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.OPERATION__CALL_ACTION: return ((InternalEList<?>)getCallAction()).basicRemove(otherEnd, msgs); case BehavioralPackage.OPERATION__METHOD: return ((InternalEList<?>)getMethod()).basicRemove(otherEnd, 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.OPERATION__IS_ABSTRACT: return isIsAbstract(); case BehavioralPackage.OPERATION__CALL_ACTION: return getCallAction(); case BehavioralPackage.OPERATION__METHOD: return getMethod(); } 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 BehavioralPackage.OPERATION__IS_ABSTRACT: setIsAbstract((Boolean)newValue); return; case BehavioralPackage.OPERATION__CALL_ACTION: getCallAction().clear(); getCallAction().addAll((Collection<? extends CallAction>)newValue); return; case BehavioralPackage.OPERATION__METHOD: getMethod().clear(); getMethod().addAll((Collection<? extends Method>)newValue); return; } super.eSet(featureID, newValue); } /** * <!-- begin-user-doc --> * <!-- end-user-doc --> * @generated */ @Override public void eUnset(int featureID) { switch (featureID) { case BehavioralPackage.OPERATION__IS_ABSTRACT: setIsAbstract(IS_ABSTRACT_EDEFAULT); return; case BehavioralPackage.OPERATION__CALL_ACTION: getCallAction().clear(); return; case BehavioralPackage.OPERATION__METHOD: getMethod().clear(); return; } super.eUnset(featureID); } /** * <!-- begin-user-doc --> * <!-- end-user-doc --> * @generated */ @Override public boolean eIsSet(int featureID) { switch (featureID) { case BehavioralPackage.OPERATION__IS_ABSTRACT: return isAbstract != IS_ABSTRACT_EDEFAULT; case BehavioralPackage.OPERATION__CALL_ACTION: return callAction != null && !callAction.isEmpty(); case BehavioralPackage.OPERATION__METHOD: return method != null && !method.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(" (isAbstract: "); result.append(isAbstract); result.append(')'); return result.toString(); } } //OperationImpl