/** */ package fr.inria.diverse.iot2.iot2.iot2.impl; import fr.inria.diverse.iot2.iot2.iot2.Block; import fr.inria.diverse.iot2.iot2.iot2.ExceptionDef; import fr.inria.diverse.iot2.iot2.iot2.IDLType; import fr.inria.diverse.iot2.iot2.iot2.Iot2Package; import fr.inria.diverse.iot2.iot2.iot2.OperationDef; import fr.inria.diverse.iot2.iot2.iot2.ParameterDef; import fr.inria.diverse.iot2.iot2.iot2.Typed; import fr.inria.diverse.iot2.iot2.iot2.TypedefDef; 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.EDataTypeUniqueEList; import org.eclipse.emf.ecore.util.EObjectContainmentEList; import org.eclipse.emf.ecore.util.EObjectResolvingEList; import org.eclipse.emf.ecore.util.InternalEList; /** * <!-- begin-user-doc --> * An implementation of the model object '<em><b>Operation Def</b></em>'. * <!-- end-user-doc --> * <p> * The following features are implemented: * </p> * <ul> * <li>{@link fr.inria.diverse.iot2.iot2.iot2.impl.OperationDefImpl#getContainedType <em>Contained Type</em>}</li> * <li>{@link fr.inria.diverse.iot2.iot2.iot2.impl.OperationDefImpl#getSharedType <em>Shared Type</em>}</li> * <li>{@link fr.inria.diverse.iot2.iot2.iot2.impl.OperationDefImpl#getParameters <em>Parameters</em>}</li> * <li>{@link fr.inria.diverse.iot2.iot2.iot2.impl.OperationDefImpl#isIsOneway <em>Is Oneway</em>}</li> * <li>{@link fr.inria.diverse.iot2.iot2.iot2.impl.OperationDefImpl#getContexts <em>Contexts</em>}</li> * <li>{@link fr.inria.diverse.iot2.iot2.iot2.impl.OperationDefImpl#getCanRaise <em>Can Raise</em>}</li> * <li>{@link fr.inria.diverse.iot2.iot2.iot2.impl.OperationDefImpl#getLua <em>Lua</em>}</li> * </ul> * * @generated */ public class OperationDefImpl extends ContainedImpl implements OperationDef { /** * The cached value of the '{@link #getContainedType() <em>Contained Type</em>}' containment reference. * <!-- begin-user-doc --> * <!-- end-user-doc --> * @see #getContainedType() * @generated * @ordered */ protected IDLType containedType; /** * The cached value of the '{@link #getSharedType() <em>Shared Type</em>}' reference. * <!-- begin-user-doc --> * <!-- end-user-doc --> * @see #getSharedType() * @generated * @ordered */ protected TypedefDef sharedType; /** * The cached value of the '{@link #getParameters() <em>Parameters</em>}' containment reference list. * <!-- begin-user-doc --> * <!-- end-user-doc --> * @see #getParameters() * @generated * @ordered */ protected EList<ParameterDef> parameters; /** * The default value of the '{@link #isIsOneway() <em>Is Oneway</em>}' attribute. * <!-- begin-user-doc --> * <!-- end-user-doc --> * @see #isIsOneway() * @generated * @ordered */ protected static final boolean IS_ONEWAY_EDEFAULT = false; /** * The cached value of the '{@link #isIsOneway() <em>Is Oneway</em>}' attribute. * <!-- begin-user-doc --> * <!-- end-user-doc --> * @see #isIsOneway() * @generated * @ordered */ protected boolean isOneway = IS_ONEWAY_EDEFAULT; /** * The cached value of the '{@link #getContexts() <em>Contexts</em>}' attribute list. * <!-- begin-user-doc --> * <!-- end-user-doc --> * @see #getContexts() * @generated * @ordered */ protected EList<String> contexts; /** * The cached value of the '{@link #getCanRaise() <em>Can Raise</em>}' reference list. * <!-- begin-user-doc --> * <!-- end-user-doc --> * @see #getCanRaise() * @generated * @ordered */ protected EList<ExceptionDef> canRaise; /** * The cached value of the '{@link #getLua() <em>Lua</em>}' containment reference. * <!-- begin-user-doc --> * <!-- end-user-doc --> * @see #getLua() * @generated * @ordered */ protected Block lua; /** * <!-- begin-user-doc --> * <!-- end-user-doc --> * @generated */ protected OperationDefImpl() { super(); } /** * <!-- begin-user-doc --> * <!-- end-user-doc --> * @generated */ @Override protected EClass eStaticClass() { return Iot2Package.Literals.OPERATION_DEF; } /** * <!-- begin-user-doc --> * <!-- end-user-doc --> * @generated */ public IDLType getContainedType() { return containedType; } /** * <!-- begin-user-doc --> * <!-- end-user-doc --> * @generated */ public NotificationChain basicSetContainedType(IDLType newContainedType, NotificationChain msgs) { IDLType oldContainedType = containedType; containedType = newContainedType; if (eNotificationRequired()) { ENotificationImpl notification = new ENotificationImpl(this, Notification.SET, Iot2Package.OPERATION_DEF__CONTAINED_TYPE, oldContainedType, newContainedType); if (msgs == null) msgs = notification; else msgs.add(notification); } return msgs; } /** * <!-- begin-user-doc --> * <!-- end-user-doc --> * @generated */ public void setContainedType(IDLType newContainedType) { if (newContainedType != containedType) { NotificationChain msgs = null; if (containedType != null) msgs = ((InternalEObject)containedType).eInverseRemove(this, EOPPOSITE_FEATURE_BASE - Iot2Package.OPERATION_DEF__CONTAINED_TYPE, null, msgs); if (newContainedType != null) msgs = ((InternalEObject)newContainedType).eInverseAdd(this, EOPPOSITE_FEATURE_BASE - Iot2Package.OPERATION_DEF__CONTAINED_TYPE, null, msgs); msgs = basicSetContainedType(newContainedType, msgs); if (msgs != null) msgs.dispatch(); } else if (eNotificationRequired()) eNotify(new ENotificationImpl(this, Notification.SET, Iot2Package.OPERATION_DEF__CONTAINED_TYPE, newContainedType, newContainedType)); } /** * <!-- begin-user-doc --> * <!-- end-user-doc --> * @generated */ public TypedefDef getSharedType() { if (sharedType != null && sharedType.eIsProxy()) { InternalEObject oldSharedType = (InternalEObject)sharedType; sharedType = (TypedefDef)eResolveProxy(oldSharedType); if (sharedType != oldSharedType) { if (eNotificationRequired()) eNotify(new ENotificationImpl(this, Notification.RESOLVE, Iot2Package.OPERATION_DEF__SHARED_TYPE, oldSharedType, sharedType)); } } return sharedType; } /** * <!-- begin-user-doc --> * <!-- end-user-doc --> * @generated */ public TypedefDef basicGetSharedType() { return sharedType; } /** * <!-- begin-user-doc --> * <!-- end-user-doc --> * @generated */ public void setSharedType(TypedefDef newSharedType) { TypedefDef oldSharedType = sharedType; sharedType = newSharedType; if (eNotificationRequired()) eNotify(new ENotificationImpl(this, Notification.SET, Iot2Package.OPERATION_DEF__SHARED_TYPE, oldSharedType, sharedType)); } /** * <!-- begin-user-doc --> * <!-- end-user-doc --> * @generated */ public EList<ParameterDef> getParameters() { if (parameters == null) { parameters = new EObjectContainmentEList<ParameterDef>(ParameterDef.class, this, Iot2Package.OPERATION_DEF__PARAMETERS); } return parameters; } /** * <!-- begin-user-doc --> * <!-- end-user-doc --> * @generated */ public boolean isIsOneway() { return isOneway; } /** * <!-- begin-user-doc --> * <!-- end-user-doc --> * @generated */ public void setIsOneway(boolean newIsOneway) { boolean oldIsOneway = isOneway; isOneway = newIsOneway; if (eNotificationRequired()) eNotify(new ENotificationImpl(this, Notification.SET, Iot2Package.OPERATION_DEF__IS_ONEWAY, oldIsOneway, isOneway)); } /** * <!-- begin-user-doc --> * <!-- end-user-doc --> * @generated */ public EList<String> getContexts() { if (contexts == null) { contexts = new EDataTypeUniqueEList<String>(String.class, this, Iot2Package.OPERATION_DEF__CONTEXTS); } return contexts; } /** * <!-- begin-user-doc --> * <!-- end-user-doc --> * @generated */ public EList<ExceptionDef> getCanRaise() { if (canRaise == null) { canRaise = new EObjectResolvingEList<ExceptionDef>(ExceptionDef.class, this, Iot2Package.OPERATION_DEF__CAN_RAISE); } return canRaise; } /** * <!-- begin-user-doc --> * <!-- end-user-doc --> * @generated */ public Block getLua() { return lua; } /** * <!-- begin-user-doc --> * <!-- end-user-doc --> * @generated */ public NotificationChain basicSetLua(Block newLua, NotificationChain msgs) { Block oldLua = lua; lua = newLua; if (eNotificationRequired()) { ENotificationImpl notification = new ENotificationImpl(this, Notification.SET, Iot2Package.OPERATION_DEF__LUA, oldLua, newLua); if (msgs == null) msgs = notification; else msgs.add(notification); } return msgs; } /** * <!-- begin-user-doc --> * <!-- end-user-doc --> * @generated */ public void setLua(Block newLua) { if (newLua != lua) { NotificationChain msgs = null; if (lua != null) msgs = ((InternalEObject)lua).eInverseRemove(this, EOPPOSITE_FEATURE_BASE - Iot2Package.OPERATION_DEF__LUA, null, msgs); if (newLua != null) msgs = ((InternalEObject)newLua).eInverseAdd(this, EOPPOSITE_FEATURE_BASE - Iot2Package.OPERATION_DEF__LUA, null, msgs); msgs = basicSetLua(newLua, msgs); if (msgs != null) msgs.dispatch(); } else if (eNotificationRequired()) eNotify(new ENotificationImpl(this, Notification.SET, Iot2Package.OPERATION_DEF__LUA, newLua, newLua)); } /** * <!-- begin-user-doc --> * <!-- end-user-doc --> * @generated */ @Override public NotificationChain eInverseRemove(InternalEObject otherEnd, int featureID, NotificationChain msgs) { switch (featureID) { case Iot2Package.OPERATION_DEF__CONTAINED_TYPE: return basicSetContainedType(null, msgs); case Iot2Package.OPERATION_DEF__PARAMETERS: return ((InternalEList<?>)getParameters()).basicRemove(otherEnd, msgs); case Iot2Package.OPERATION_DEF__LUA: return basicSetLua(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 Iot2Package.OPERATION_DEF__CONTAINED_TYPE: return getContainedType(); case Iot2Package.OPERATION_DEF__SHARED_TYPE: if (resolve) return getSharedType(); return basicGetSharedType(); case Iot2Package.OPERATION_DEF__PARAMETERS: return getParameters(); case Iot2Package.OPERATION_DEF__IS_ONEWAY: return isIsOneway(); case Iot2Package.OPERATION_DEF__CONTEXTS: return getContexts(); case Iot2Package.OPERATION_DEF__CAN_RAISE: return getCanRaise(); case Iot2Package.OPERATION_DEF__LUA: return getLua(); } 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 Iot2Package.OPERATION_DEF__CONTAINED_TYPE: setContainedType((IDLType)newValue); return; case Iot2Package.OPERATION_DEF__SHARED_TYPE: setSharedType((TypedefDef)newValue); return; case Iot2Package.OPERATION_DEF__PARAMETERS: getParameters().clear(); getParameters().addAll((Collection<? extends ParameterDef>)newValue); return; case Iot2Package.OPERATION_DEF__IS_ONEWAY: setIsOneway((Boolean)newValue); return; case Iot2Package.OPERATION_DEF__CONTEXTS: getContexts().clear(); getContexts().addAll((Collection<? extends String>)newValue); return; case Iot2Package.OPERATION_DEF__CAN_RAISE: getCanRaise().clear(); getCanRaise().addAll((Collection<? extends ExceptionDef>)newValue); return; case Iot2Package.OPERATION_DEF__LUA: setLua((Block)newValue); return; } super.eSet(featureID, newValue); } /** * <!-- begin-user-doc --> * <!-- end-user-doc --> * @generated */ @Override public void eUnset(int featureID) { switch (featureID) { case Iot2Package.OPERATION_DEF__CONTAINED_TYPE: setContainedType((IDLType)null); return; case Iot2Package.OPERATION_DEF__SHARED_TYPE: setSharedType((TypedefDef)null); return; case Iot2Package.OPERATION_DEF__PARAMETERS: getParameters().clear(); return; case Iot2Package.OPERATION_DEF__IS_ONEWAY: setIsOneway(IS_ONEWAY_EDEFAULT); return; case Iot2Package.OPERATION_DEF__CONTEXTS: getContexts().clear(); return; case Iot2Package.OPERATION_DEF__CAN_RAISE: getCanRaise().clear(); return; case Iot2Package.OPERATION_DEF__LUA: setLua((Block)null); return; } super.eUnset(featureID); } /** * <!-- begin-user-doc --> * <!-- end-user-doc --> * @generated */ @Override public boolean eIsSet(int featureID) { switch (featureID) { case Iot2Package.OPERATION_DEF__CONTAINED_TYPE: return containedType != null; case Iot2Package.OPERATION_DEF__SHARED_TYPE: return sharedType != null; case Iot2Package.OPERATION_DEF__PARAMETERS: return parameters != null && !parameters.isEmpty(); case Iot2Package.OPERATION_DEF__IS_ONEWAY: return isOneway != IS_ONEWAY_EDEFAULT; case Iot2Package.OPERATION_DEF__CONTEXTS: return contexts != null && !contexts.isEmpty(); case Iot2Package.OPERATION_DEF__CAN_RAISE: return canRaise != null && !canRaise.isEmpty(); case Iot2Package.OPERATION_DEF__LUA: return lua != null; } return super.eIsSet(featureID); } /** * <!-- begin-user-doc --> * <!-- end-user-doc --> * @generated */ @Override public int eBaseStructuralFeatureID(int derivedFeatureID, Class<?> baseClass) { if (baseClass == Typed.class) { switch (derivedFeatureID) { case Iot2Package.OPERATION_DEF__CONTAINED_TYPE: return Iot2Package.TYPED__CONTAINED_TYPE; case Iot2Package.OPERATION_DEF__SHARED_TYPE: return Iot2Package.TYPED__SHARED_TYPE; default: return -1; } } return super.eBaseStructuralFeatureID(derivedFeatureID, baseClass); } /** * <!-- begin-user-doc --> * <!-- end-user-doc --> * @generated */ @Override public int eDerivedStructuralFeatureID(int baseFeatureID, Class<?> baseClass) { if (baseClass == Typed.class) { switch (baseFeatureID) { case Iot2Package.TYPED__CONTAINED_TYPE: return Iot2Package.OPERATION_DEF__CONTAINED_TYPE; case Iot2Package.TYPED__SHARED_TYPE: return Iot2Package.OPERATION_DEF__SHARED_TYPE; default: return -1; } } return super.eDerivedStructuralFeatureID(baseFeatureID, baseClass); } /** * <!-- begin-user-doc --> * <!-- end-user-doc --> * @generated */ @Override public String toString() { if (eIsProxy()) return super.toString(); StringBuffer result = new StringBuffer(super.toString()); result.append(" (isOneway: "); result.append(isOneway); result.append(", contexts: "); result.append(contexts); result.append(')'); return result.toString(); } } //OperationDefImpl