/** * <copyright> * </copyright> * * $Id$ */ package net.sf.etl.samples.ej.ast.impl; import net.sf.etl.samples.ej.ast.AstPackage; import net.sf.etl.samples.ej.ast.Expression; import net.sf.etl.samples.ej.ast.ForeachStatement; import net.sf.etl.samples.ej.ast.Parameter; 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; /** * <!-- begin-user-doc --> * An implementation of the model object '<em><b>Foreach Statement</b></em>'. * <!-- end-user-doc --> * <p> * The following features are implemented: * <ul> * <li>{@link net.sf.etl.samples.ej.ast.impl.ForeachStatementImpl#getParameter <em>Parameter</em>}</li> * <li>{@link net.sf.etl.samples.ej.ast.impl.ForeachStatementImpl#getCollection <em>Collection</em>}</li> * <li>{@link net.sf.etl.samples.ej.ast.impl.ForeachStatementImpl#getInitial <em>Initial</em>}</li> * <li>{@link net.sf.etl.samples.ej.ast.impl.ForeachStatementImpl#getLimit <em>Limit</em>}</li> * </ul> * </p> * * @generated */ public class ForeachStatementImpl extends LoopStatementImpl implements ForeachStatement { /** * The cached value of the '{@link #getParameter() <em>Parameter</em>}' containment reference. * <!-- begin-user-doc --> * <!-- end-user-doc --> * @see #getParameter() * @generated * @ordered */ protected Parameter parameter = null; /** * The cached value of the '{@link #getCollection() <em>Collection</em>}' containment reference. * <!-- begin-user-doc --> * <!-- end-user-doc --> * @see #getCollection() * @generated * @ordered */ protected Expression collection = null; /** * The cached value of the '{@link #getInitial() <em>Initial</em>}' containment reference. * <!-- begin-user-doc --> * <!-- end-user-doc --> * @see #getInitial() * @generated * @ordered */ protected Expression initial = null; /** * The cached value of the '{@link #getLimit() <em>Limit</em>}' containment reference. * <!-- begin-user-doc --> * <!-- end-user-doc --> * @see #getLimit() * @generated * @ordered */ protected Expression limit = null; /** * <!-- begin-user-doc --> * <!-- end-user-doc --> * @generated */ protected ForeachStatementImpl() { super(); } /** * <!-- begin-user-doc --> * <!-- end-user-doc --> * @generated */ protected EClass eStaticClass() { return AstPackage.Literals.FOREACH_STATEMENT; } /** * <!-- begin-user-doc --> * <!-- end-user-doc --> * @generated */ public Parameter getParameter() { return parameter; } /** * <!-- begin-user-doc --> * <!-- end-user-doc --> * @generated */ public NotificationChain basicSetParameter(Parameter newParameter, NotificationChain msgs) { Parameter oldParameter = parameter; parameter = newParameter; if (eNotificationRequired()) { ENotificationImpl notification = new ENotificationImpl(this, Notification.SET, AstPackage.FOREACH_STATEMENT__PARAMETER, oldParameter, newParameter); if (msgs == null) msgs = notification; else msgs.add(notification); } return msgs; } /** * <!-- begin-user-doc --> * <!-- end-user-doc --> * @generated */ public void setParameter(Parameter newParameter) { if (newParameter != parameter) { NotificationChain msgs = null; if (parameter != null) msgs = ((InternalEObject)parameter).eInverseRemove(this, EOPPOSITE_FEATURE_BASE - AstPackage.FOREACH_STATEMENT__PARAMETER, null, msgs); if (newParameter != null) msgs = ((InternalEObject)newParameter).eInverseAdd(this, EOPPOSITE_FEATURE_BASE - AstPackage.FOREACH_STATEMENT__PARAMETER, null, msgs); msgs = basicSetParameter(newParameter, msgs); if (msgs != null) msgs.dispatch(); } else if (eNotificationRequired()) eNotify(new ENotificationImpl(this, Notification.SET, AstPackage.FOREACH_STATEMENT__PARAMETER, newParameter, newParameter)); } /** * <!-- begin-user-doc --> * <!-- end-user-doc --> * @generated */ public Expression getCollection() { return collection; } /** * <!-- begin-user-doc --> * <!-- end-user-doc --> * @generated */ public NotificationChain basicSetCollection(Expression newCollection, NotificationChain msgs) { Expression oldCollection = collection; collection = newCollection; if (eNotificationRequired()) { ENotificationImpl notification = new ENotificationImpl(this, Notification.SET, AstPackage.FOREACH_STATEMENT__COLLECTION, oldCollection, newCollection); if (msgs == null) msgs = notification; else msgs.add(notification); } return msgs; } /** * <!-- begin-user-doc --> * <!-- end-user-doc --> * @generated */ public void setCollection(Expression newCollection) { if (newCollection != collection) { NotificationChain msgs = null; if (collection != null) msgs = ((InternalEObject)collection).eInverseRemove(this, EOPPOSITE_FEATURE_BASE - AstPackage.FOREACH_STATEMENT__COLLECTION, null, msgs); if (newCollection != null) msgs = ((InternalEObject)newCollection).eInverseAdd(this, EOPPOSITE_FEATURE_BASE - AstPackage.FOREACH_STATEMENT__COLLECTION, null, msgs); msgs = basicSetCollection(newCollection, msgs); if (msgs != null) msgs.dispatch(); } else if (eNotificationRequired()) eNotify(new ENotificationImpl(this, Notification.SET, AstPackage.FOREACH_STATEMENT__COLLECTION, newCollection, newCollection)); } /** * <!-- begin-user-doc --> * <!-- end-user-doc --> * @generated */ public Expression getInitial() { return initial; } /** * <!-- begin-user-doc --> * <!-- end-user-doc --> * @generated */ public NotificationChain basicSetInitial(Expression newInitial, NotificationChain msgs) { Expression oldInitial = initial; initial = newInitial; if (eNotificationRequired()) { ENotificationImpl notification = new ENotificationImpl(this, Notification.SET, AstPackage.FOREACH_STATEMENT__INITIAL, oldInitial, newInitial); if (msgs == null) msgs = notification; else msgs.add(notification); } return msgs; } /** * <!-- begin-user-doc --> * <!-- end-user-doc --> * @generated */ public void setInitial(Expression newInitial) { if (newInitial != initial) { NotificationChain msgs = null; if (initial != null) msgs = ((InternalEObject)initial).eInverseRemove(this, EOPPOSITE_FEATURE_BASE - AstPackage.FOREACH_STATEMENT__INITIAL, null, msgs); if (newInitial != null) msgs = ((InternalEObject)newInitial).eInverseAdd(this, EOPPOSITE_FEATURE_BASE - AstPackage.FOREACH_STATEMENT__INITIAL, null, msgs); msgs = basicSetInitial(newInitial, msgs); if (msgs != null) msgs.dispatch(); } else if (eNotificationRequired()) eNotify(new ENotificationImpl(this, Notification.SET, AstPackage.FOREACH_STATEMENT__INITIAL, newInitial, newInitial)); } /** * <!-- begin-user-doc --> * <!-- end-user-doc --> * @generated */ public Expression getLimit() { return limit; } /** * <!-- begin-user-doc --> * <!-- end-user-doc --> * @generated */ public NotificationChain basicSetLimit(Expression newLimit, NotificationChain msgs) { Expression oldLimit = limit; limit = newLimit; if (eNotificationRequired()) { ENotificationImpl notification = new ENotificationImpl(this, Notification.SET, AstPackage.FOREACH_STATEMENT__LIMIT, oldLimit, newLimit); if (msgs == null) msgs = notification; else msgs.add(notification); } return msgs; } /** * <!-- begin-user-doc --> * <!-- end-user-doc --> * @generated */ public void setLimit(Expression newLimit) { if (newLimit != limit) { NotificationChain msgs = null; if (limit != null) msgs = ((InternalEObject)limit).eInverseRemove(this, EOPPOSITE_FEATURE_BASE - AstPackage.FOREACH_STATEMENT__LIMIT, null, msgs); if (newLimit != null) msgs = ((InternalEObject)newLimit).eInverseAdd(this, EOPPOSITE_FEATURE_BASE - AstPackage.FOREACH_STATEMENT__LIMIT, null, msgs); msgs = basicSetLimit(newLimit, msgs); if (msgs != null) msgs.dispatch(); } else if (eNotificationRequired()) eNotify(new ENotificationImpl(this, Notification.SET, AstPackage.FOREACH_STATEMENT__LIMIT, newLimit, newLimit)); } /** * <!-- begin-user-doc --> * <!-- end-user-doc --> * @generated */ public NotificationChain eInverseRemove(InternalEObject otherEnd, int featureID, NotificationChain msgs) { switch (featureID) { case AstPackage.FOREACH_STATEMENT__PARAMETER: return basicSetParameter(null, msgs); case AstPackage.FOREACH_STATEMENT__COLLECTION: return basicSetCollection(null, msgs); case AstPackage.FOREACH_STATEMENT__INITIAL: return basicSetInitial(null, msgs); case AstPackage.FOREACH_STATEMENT__LIMIT: return basicSetLimit(null, msgs); } return super.eInverseRemove(otherEnd, featureID, msgs); } /** * <!-- begin-user-doc --> * <!-- end-user-doc --> * @generated */ public Object eGet(int featureID, boolean resolve, boolean coreType) { switch (featureID) { case AstPackage.FOREACH_STATEMENT__PARAMETER: return getParameter(); case AstPackage.FOREACH_STATEMENT__COLLECTION: return getCollection(); case AstPackage.FOREACH_STATEMENT__INITIAL: return getInitial(); case AstPackage.FOREACH_STATEMENT__LIMIT: return getLimit(); } return super.eGet(featureID, resolve, coreType); } /** * <!-- begin-user-doc --> * <!-- end-user-doc --> * @generated */ public void eSet(int featureID, Object newValue) { switch (featureID) { case AstPackage.FOREACH_STATEMENT__PARAMETER: setParameter((Parameter)newValue); return; case AstPackage.FOREACH_STATEMENT__COLLECTION: setCollection((Expression)newValue); return; case AstPackage.FOREACH_STATEMENT__INITIAL: setInitial((Expression)newValue); return; case AstPackage.FOREACH_STATEMENT__LIMIT: setLimit((Expression)newValue); return; } super.eSet(featureID, newValue); } /** * <!-- begin-user-doc --> * <!-- end-user-doc --> * @generated */ public void eUnset(int featureID) { switch (featureID) { case AstPackage.FOREACH_STATEMENT__PARAMETER: setParameter((Parameter)null); return; case AstPackage.FOREACH_STATEMENT__COLLECTION: setCollection((Expression)null); return; case AstPackage.FOREACH_STATEMENT__INITIAL: setInitial((Expression)null); return; case AstPackage.FOREACH_STATEMENT__LIMIT: setLimit((Expression)null); return; } super.eUnset(featureID); } /** * <!-- begin-user-doc --> * <!-- end-user-doc --> * @generated */ public boolean eIsSet(int featureID) { switch (featureID) { case AstPackage.FOREACH_STATEMENT__PARAMETER: return parameter != null; case AstPackage.FOREACH_STATEMENT__COLLECTION: return collection != null; case AstPackage.FOREACH_STATEMENT__INITIAL: return initial != null; case AstPackage.FOREACH_STATEMENT__LIMIT: return limit != null; } return super.eIsSet(featureID); } } //ForeachStatementImpl