/** */ package fr.inria.diverse.iot2.iot2.iot2.impl; import fr.inria.diverse.iot2.iot2.iot2.Block; import fr.inria.diverse.iot2.iot2.iot2.Function; import fr.inria.diverse.iot2.iot2.iot2.Iot2Package; 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.impl.EObjectImpl; import org.eclipse.emf.ecore.util.EDataTypeEList; /** * <!-- begin-user-doc --> * An implementation of the model object '<em><b>Function</b></em>'. * <!-- end-user-doc --> * <p> * The following features are implemented: * </p> * <ul> * <li>{@link fr.inria.diverse.iot2.iot2.iot2.impl.FunctionImpl#getParameters <em>Parameters</em>}</li> * <li>{@link fr.inria.diverse.iot2.iot2.iot2.impl.FunctionImpl#isVarArgs <em>Var Args</em>}</li> * <li>{@link fr.inria.diverse.iot2.iot2.iot2.impl.FunctionImpl#getBody <em>Body</em>}</li> * </ul> * * @generated */ public class FunctionImpl extends EObjectImpl implements Function { /** * The cached value of the '{@link #getParameters() <em>Parameters</em>}' attribute list. * <!-- begin-user-doc --> * <!-- end-user-doc --> * @see #getParameters() * @generated * @ordered */ protected EList<String> parameters; /** * The default value of the '{@link #isVarArgs() <em>Var Args</em>}' attribute. * <!-- begin-user-doc --> * <!-- end-user-doc --> * @see #isVarArgs() * @generated * @ordered */ protected static final boolean VAR_ARGS_EDEFAULT = false; /** * The cached value of the '{@link #isVarArgs() <em>Var Args</em>}' attribute. * <!-- begin-user-doc --> * <!-- end-user-doc --> * @see #isVarArgs() * @generated * @ordered */ protected boolean varArgs = VAR_ARGS_EDEFAULT; /** * The cached value of the '{@link #getBody() <em>Body</em>}' containment reference. * <!-- begin-user-doc --> * <!-- end-user-doc --> * @see #getBody() * @generated * @ordered */ protected Block body; /** * <!-- begin-user-doc --> * <!-- end-user-doc --> * @generated */ protected FunctionImpl() { super(); } /** * <!-- begin-user-doc --> * <!-- end-user-doc --> * @generated */ @Override protected EClass eStaticClass() { return Iot2Package.Literals.FUNCTION; } /** * <!-- begin-user-doc --> * <!-- end-user-doc --> * @generated */ public EList<String> getParameters() { if (parameters == null) { parameters = new EDataTypeEList<String>(String.class, this, Iot2Package.FUNCTION__PARAMETERS); } return parameters; } /** * <!-- begin-user-doc --> * <!-- end-user-doc --> * @generated */ public boolean isVarArgs() { return varArgs; } /** * <!-- begin-user-doc --> * <!-- end-user-doc --> * @generated */ public void setVarArgs(boolean newVarArgs) { boolean oldVarArgs = varArgs; varArgs = newVarArgs; if (eNotificationRequired()) eNotify(new ENotificationImpl(this, Notification.SET, Iot2Package.FUNCTION__VAR_ARGS, oldVarArgs, varArgs)); } /** * <!-- begin-user-doc --> * <!-- end-user-doc --> * @generated */ public Block getBody() { return body; } /** * <!-- begin-user-doc --> * <!-- end-user-doc --> * @generated */ public NotificationChain basicSetBody(Block newBody, NotificationChain msgs) { Block oldBody = body; body = newBody; if (eNotificationRequired()) { ENotificationImpl notification = new ENotificationImpl(this, Notification.SET, Iot2Package.FUNCTION__BODY, oldBody, newBody); if (msgs == null) msgs = notification; else msgs.add(notification); } return msgs; } /** * <!-- begin-user-doc --> * <!-- end-user-doc --> * @generated */ public void setBody(Block newBody) { if (newBody != body) { NotificationChain msgs = null; if (body != null) msgs = ((InternalEObject)body).eInverseRemove(this, EOPPOSITE_FEATURE_BASE - Iot2Package.FUNCTION__BODY, null, msgs); if (newBody != null) msgs = ((InternalEObject)newBody).eInverseAdd(this, EOPPOSITE_FEATURE_BASE - Iot2Package.FUNCTION__BODY, null, msgs); msgs = basicSetBody(newBody, msgs); if (msgs != null) msgs.dispatch(); } else if (eNotificationRequired()) eNotify(new ENotificationImpl(this, Notification.SET, Iot2Package.FUNCTION__BODY, newBody, newBody)); } /** * <!-- begin-user-doc --> * <!-- end-user-doc --> * @generated */ @Override public NotificationChain eInverseRemove(InternalEObject otherEnd, int featureID, NotificationChain msgs) { switch (featureID) { case Iot2Package.FUNCTION__BODY: return basicSetBody(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.FUNCTION__PARAMETERS: return getParameters(); case Iot2Package.FUNCTION__VAR_ARGS: return isVarArgs(); case Iot2Package.FUNCTION__BODY: return getBody(); } 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.FUNCTION__PARAMETERS: getParameters().clear(); getParameters().addAll((Collection<? extends String>)newValue); return; case Iot2Package.FUNCTION__VAR_ARGS: setVarArgs((Boolean)newValue); return; case Iot2Package.FUNCTION__BODY: setBody((Block)newValue); return; } super.eSet(featureID, newValue); } /** * <!-- begin-user-doc --> * <!-- end-user-doc --> * @generated */ @Override public void eUnset(int featureID) { switch (featureID) { case Iot2Package.FUNCTION__PARAMETERS: getParameters().clear(); return; case Iot2Package.FUNCTION__VAR_ARGS: setVarArgs(VAR_ARGS_EDEFAULT); return; case Iot2Package.FUNCTION__BODY: setBody((Block)null); return; } super.eUnset(featureID); } /** * <!-- begin-user-doc --> * <!-- end-user-doc --> * @generated */ @Override public boolean eIsSet(int featureID) { switch (featureID) { case Iot2Package.FUNCTION__PARAMETERS: return parameters != null && !parameters.isEmpty(); case Iot2Package.FUNCTION__VAR_ARGS: return varArgs != VAR_ARGS_EDEFAULT; case Iot2Package.FUNCTION__BODY: return body != 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(" (parameters: "); result.append(parameters); result.append(", varArgs: "); result.append(varArgs); result.append(')'); return result.toString(); } } //FunctionImpl