/** * <copyright> * </copyright> * * $Id$ */ package net.sf.etl.samples.ej.ast.impl; import java.util.Collection; import net.sf.etl.samples.ej.ast.AstPackage; import net.sf.etl.samples.ej.ast.Expression; import net.sf.etl.samples.ej.ast.FieldStatement; import net.sf.etl.samples.ej.ast.Modifier; import net.sf.etl.samples.ej.ast.Variable; 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.EObjectContainmentEList; import org.eclipse.emf.ecore.util.InternalEList; /** * <!-- begin-user-doc --> * An implementation of the model object '<em><b>Field Statement</b></em>'. * <!-- end-user-doc --> * <p> * The following features are implemented: * <ul> * <li>{@link net.sf.etl.samples.ej.ast.impl.FieldStatementImpl#getTransientModifier <em>Transient Modifier</em>}</li> * <li>{@link net.sf.etl.samples.ej.ast.impl.FieldStatementImpl#getVolatileModifier <em>Volatile Modifier</em>}</li> * <li>{@link net.sf.etl.samples.ej.ast.impl.FieldStatementImpl#getClassifier <em>Classifier</em>}</li> * <li>{@link net.sf.etl.samples.ej.ast.impl.FieldStatementImpl#getVariables <em>Variables</em>}</li> * </ul> * </p> * * @generated */ public class FieldStatementImpl extends FeatureImpl implements FieldStatement { /** * The cached value of the '{@link #getTransientModifier() <em>Transient Modifier</em>}' containment reference. * <!-- begin-user-doc --> * <!-- end-user-doc --> * @see #getTransientModifier() * @generated * @ordered */ protected Modifier transientModifier = null; /** * The cached value of the '{@link #getVolatileModifier() <em>Volatile Modifier</em>}' containment reference. * <!-- begin-user-doc --> * <!-- end-user-doc --> * @see #getVolatileModifier() * @generated * @ordered */ protected Modifier volatileModifier = null; /** * The cached value of the '{@link #getClassifier() <em>Classifier</em>}' containment reference. * <!-- begin-user-doc --> * <!-- end-user-doc --> * @see #getClassifier() * @generated * @ordered */ protected Expression classifier = null; /** * The cached value of the '{@link #getVariables() <em>Variables</em>}' containment reference list. * <!-- begin-user-doc --> * <!-- end-user-doc --> * @see #getVariables() * @generated * @ordered */ protected EList variables = null; /** * <!-- begin-user-doc --> * <!-- end-user-doc --> * @generated */ protected FieldStatementImpl() { super(); } /** * <!-- begin-user-doc --> * <!-- end-user-doc --> * @generated */ protected EClass eStaticClass() { return AstPackage.Literals.FIELD_STATEMENT; } /** * <!-- begin-user-doc --> * <!-- end-user-doc --> * @generated */ public Modifier getTransientModifier() { return transientModifier; } /** * <!-- begin-user-doc --> * <!-- end-user-doc --> * @generated */ public NotificationChain basicSetTransientModifier(Modifier newTransientModifier, NotificationChain msgs) { Modifier oldTransientModifier = transientModifier; transientModifier = newTransientModifier; if (eNotificationRequired()) { ENotificationImpl notification = new ENotificationImpl(this, Notification.SET, AstPackage.FIELD_STATEMENT__TRANSIENT_MODIFIER, oldTransientModifier, newTransientModifier); if (msgs == null) msgs = notification; else msgs.add(notification); } return msgs; } /** * <!-- begin-user-doc --> * <!-- end-user-doc --> * @generated */ public void setTransientModifier(Modifier newTransientModifier) { if (newTransientModifier != transientModifier) { NotificationChain msgs = null; if (transientModifier != null) msgs = ((InternalEObject)transientModifier).eInverseRemove(this, EOPPOSITE_FEATURE_BASE - AstPackage.FIELD_STATEMENT__TRANSIENT_MODIFIER, null, msgs); if (newTransientModifier != null) msgs = ((InternalEObject)newTransientModifier).eInverseAdd(this, EOPPOSITE_FEATURE_BASE - AstPackage.FIELD_STATEMENT__TRANSIENT_MODIFIER, null, msgs); msgs = basicSetTransientModifier(newTransientModifier, msgs); if (msgs != null) msgs.dispatch(); } else if (eNotificationRequired()) eNotify(new ENotificationImpl(this, Notification.SET, AstPackage.FIELD_STATEMENT__TRANSIENT_MODIFIER, newTransientModifier, newTransientModifier)); } /** * <!-- begin-user-doc --> * <!-- end-user-doc --> * @generated */ public Modifier getVolatileModifier() { return volatileModifier; } /** * <!-- begin-user-doc --> * <!-- end-user-doc --> * @generated */ public NotificationChain basicSetVolatileModifier(Modifier newVolatileModifier, NotificationChain msgs) { Modifier oldVolatileModifier = volatileModifier; volatileModifier = newVolatileModifier; if (eNotificationRequired()) { ENotificationImpl notification = new ENotificationImpl(this, Notification.SET, AstPackage.FIELD_STATEMENT__VOLATILE_MODIFIER, oldVolatileModifier, newVolatileModifier); if (msgs == null) msgs = notification; else msgs.add(notification); } return msgs; } /** * <!-- begin-user-doc --> * <!-- end-user-doc --> * @generated */ public void setVolatileModifier(Modifier newVolatileModifier) { if (newVolatileModifier != volatileModifier) { NotificationChain msgs = null; if (volatileModifier != null) msgs = ((InternalEObject)volatileModifier).eInverseRemove(this, EOPPOSITE_FEATURE_BASE - AstPackage.FIELD_STATEMENT__VOLATILE_MODIFIER, null, msgs); if (newVolatileModifier != null) msgs = ((InternalEObject)newVolatileModifier).eInverseAdd(this, EOPPOSITE_FEATURE_BASE - AstPackage.FIELD_STATEMENT__VOLATILE_MODIFIER, null, msgs); msgs = basicSetVolatileModifier(newVolatileModifier, msgs); if (msgs != null) msgs.dispatch(); } else if (eNotificationRequired()) eNotify(new ENotificationImpl(this, Notification.SET, AstPackage.FIELD_STATEMENT__VOLATILE_MODIFIER, newVolatileModifier, newVolatileModifier)); } /** * <!-- begin-user-doc --> * <!-- end-user-doc --> * @generated */ public Expression getClassifier() { return classifier; } /** * <!-- begin-user-doc --> * <!-- end-user-doc --> * @generated */ public NotificationChain basicSetClassifier(Expression newClassifier, NotificationChain msgs) { Expression oldClassifier = classifier; classifier = newClassifier; if (eNotificationRequired()) { ENotificationImpl notification = new ENotificationImpl(this, Notification.SET, AstPackage.FIELD_STATEMENT__CLASSIFIER, oldClassifier, newClassifier); if (msgs == null) msgs = notification; else msgs.add(notification); } return msgs; } /** * <!-- begin-user-doc --> * <!-- end-user-doc --> * @generated */ public void setClassifier(Expression newClassifier) { if (newClassifier != classifier) { NotificationChain msgs = null; if (classifier != null) msgs = ((InternalEObject)classifier).eInverseRemove(this, EOPPOSITE_FEATURE_BASE - AstPackage.FIELD_STATEMENT__CLASSIFIER, null, msgs); if (newClassifier != null) msgs = ((InternalEObject)newClassifier).eInverseAdd(this, EOPPOSITE_FEATURE_BASE - AstPackage.FIELD_STATEMENT__CLASSIFIER, null, msgs); msgs = basicSetClassifier(newClassifier, msgs); if (msgs != null) msgs.dispatch(); } else if (eNotificationRequired()) eNotify(new ENotificationImpl(this, Notification.SET, AstPackage.FIELD_STATEMENT__CLASSIFIER, newClassifier, newClassifier)); } /** * <!-- begin-user-doc --> * <!-- end-user-doc --> * @generated */ public EList getVariables() { if (variables == null) { variables = new EObjectContainmentEList(Variable.class, this, AstPackage.FIELD_STATEMENT__VARIABLES); } return variables; } /** * <!-- begin-user-doc --> * <!-- end-user-doc --> * @generated */ public NotificationChain eInverseRemove(InternalEObject otherEnd, int featureID, NotificationChain msgs) { switch (featureID) { case AstPackage.FIELD_STATEMENT__TRANSIENT_MODIFIER: return basicSetTransientModifier(null, msgs); case AstPackage.FIELD_STATEMENT__VOLATILE_MODIFIER: return basicSetVolatileModifier(null, msgs); case AstPackage.FIELD_STATEMENT__CLASSIFIER: return basicSetClassifier(null, msgs); case AstPackage.FIELD_STATEMENT__VARIABLES: return ((InternalEList)getVariables()).basicRemove(otherEnd, 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.FIELD_STATEMENT__TRANSIENT_MODIFIER: return getTransientModifier(); case AstPackage.FIELD_STATEMENT__VOLATILE_MODIFIER: return getVolatileModifier(); case AstPackage.FIELD_STATEMENT__CLASSIFIER: return getClassifier(); case AstPackage.FIELD_STATEMENT__VARIABLES: return getVariables(); } return super.eGet(featureID, resolve, coreType); } /** * <!-- begin-user-doc --> * <!-- end-user-doc --> * @generated */ public void eSet(int featureID, Object newValue) { switch (featureID) { case AstPackage.FIELD_STATEMENT__TRANSIENT_MODIFIER: setTransientModifier((Modifier)newValue); return; case AstPackage.FIELD_STATEMENT__VOLATILE_MODIFIER: setVolatileModifier((Modifier)newValue); return; case AstPackage.FIELD_STATEMENT__CLASSIFIER: setClassifier((Expression)newValue); return; case AstPackage.FIELD_STATEMENT__VARIABLES: getVariables().clear(); getVariables().addAll((Collection)newValue); return; } super.eSet(featureID, newValue); } /** * <!-- begin-user-doc --> * <!-- end-user-doc --> * @generated */ public void eUnset(int featureID) { switch (featureID) { case AstPackage.FIELD_STATEMENT__TRANSIENT_MODIFIER: setTransientModifier((Modifier)null); return; case AstPackage.FIELD_STATEMENT__VOLATILE_MODIFIER: setVolatileModifier((Modifier)null); return; case AstPackage.FIELD_STATEMENT__CLASSIFIER: setClassifier((Expression)null); return; case AstPackage.FIELD_STATEMENT__VARIABLES: getVariables().clear(); return; } super.eUnset(featureID); } /** * <!-- begin-user-doc --> * <!-- end-user-doc --> * @generated */ public boolean eIsSet(int featureID) { switch (featureID) { case AstPackage.FIELD_STATEMENT__TRANSIENT_MODIFIER: return transientModifier != null; case AstPackage.FIELD_STATEMENT__VOLATILE_MODIFIER: return volatileModifier != null; case AstPackage.FIELD_STATEMENT__CLASSIFIER: return classifier != null; case AstPackage.FIELD_STATEMENT__VARIABLES: return variables != null && !variables.isEmpty(); } return super.eIsSet(featureID); } } //FieldStatementImpl