/** * <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.LocalVarStatement; 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>Local Var Statement</b></em>'. * <!-- end-user-doc --> * <p> * The following features are implemented: * <ul> * <li>{@link net.sf.etl.samples.ej.ast.impl.LocalVarStatementImpl#getFinalModifier <em>Final Modifier</em>}</li> * <li>{@link net.sf.etl.samples.ej.ast.impl.LocalVarStatementImpl#getVariables <em>Variables</em>}</li> * <li>{@link net.sf.etl.samples.ej.ast.impl.LocalVarStatementImpl#getClassifier <em>Classifier</em>}</li> * </ul> * </p> * * @generated */ public class LocalVarStatementImpl extends MethodContentStatementImpl implements LocalVarStatement { /** * The cached value of the '{@link #getFinalModifier() <em>Final Modifier</em>}' containment reference. * <!-- begin-user-doc --> * <!-- end-user-doc --> * @see #getFinalModifier() * @generated * @ordered */ protected Modifier finalModifier = 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; /** * 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; /** * <!-- begin-user-doc --> * <!-- end-user-doc --> * @generated */ protected LocalVarStatementImpl() { super(); } /** * <!-- begin-user-doc --> * <!-- end-user-doc --> * @generated */ protected EClass eStaticClass() { return AstPackage.Literals.LOCAL_VAR_STATEMENT; } /** * <!-- begin-user-doc --> * <!-- end-user-doc --> * @generated */ public Modifier getFinalModifier() { return finalModifier; } /** * <!-- begin-user-doc --> * <!-- end-user-doc --> * @generated */ public NotificationChain basicSetFinalModifier(Modifier newFinalModifier, NotificationChain msgs) { Modifier oldFinalModifier = finalModifier; finalModifier = newFinalModifier; if (eNotificationRequired()) { ENotificationImpl notification = new ENotificationImpl(this, Notification.SET, AstPackage.LOCAL_VAR_STATEMENT__FINAL_MODIFIER, oldFinalModifier, newFinalModifier); if (msgs == null) msgs = notification; else msgs.add(notification); } return msgs; } /** * <!-- begin-user-doc --> * <!-- end-user-doc --> * @generated */ public void setFinalModifier(Modifier newFinalModifier) { if (newFinalModifier != finalModifier) { NotificationChain msgs = null; if (finalModifier != null) msgs = ((InternalEObject)finalModifier).eInverseRemove(this, EOPPOSITE_FEATURE_BASE - AstPackage.LOCAL_VAR_STATEMENT__FINAL_MODIFIER, null, msgs); if (newFinalModifier != null) msgs = ((InternalEObject)newFinalModifier).eInverseAdd(this, EOPPOSITE_FEATURE_BASE - AstPackage.LOCAL_VAR_STATEMENT__FINAL_MODIFIER, null, msgs); msgs = basicSetFinalModifier(newFinalModifier, msgs); if (msgs != null) msgs.dispatch(); } else if (eNotificationRequired()) eNotify(new ENotificationImpl(this, Notification.SET, AstPackage.LOCAL_VAR_STATEMENT__FINAL_MODIFIER, newFinalModifier, newFinalModifier)); } /** * <!-- begin-user-doc --> * <!-- end-user-doc --> * @generated */ public EList getVariables() { if (variables == null) { variables = new EObjectContainmentEList(Variable.class, this, AstPackage.LOCAL_VAR_STATEMENT__VARIABLES); } return variables; } /** * <!-- 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.LOCAL_VAR_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.LOCAL_VAR_STATEMENT__CLASSIFIER, null, msgs); if (newClassifier != null) msgs = ((InternalEObject)newClassifier).eInverseAdd(this, EOPPOSITE_FEATURE_BASE - AstPackage.LOCAL_VAR_STATEMENT__CLASSIFIER, null, msgs); msgs = basicSetClassifier(newClassifier, msgs); if (msgs != null) msgs.dispatch(); } else if (eNotificationRequired()) eNotify(new ENotificationImpl(this, Notification.SET, AstPackage.LOCAL_VAR_STATEMENT__CLASSIFIER, newClassifier, newClassifier)); } /** * <!-- begin-user-doc --> * <!-- end-user-doc --> * @generated */ public NotificationChain eInverseRemove(InternalEObject otherEnd, int featureID, NotificationChain msgs) { switch (featureID) { case AstPackage.LOCAL_VAR_STATEMENT__FINAL_MODIFIER: return basicSetFinalModifier(null, msgs); case AstPackage.LOCAL_VAR_STATEMENT__VARIABLES: return ((InternalEList)getVariables()).basicRemove(otherEnd, msgs); case AstPackage.LOCAL_VAR_STATEMENT__CLASSIFIER: return basicSetClassifier(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.LOCAL_VAR_STATEMENT__FINAL_MODIFIER: return getFinalModifier(); case AstPackage.LOCAL_VAR_STATEMENT__VARIABLES: return getVariables(); case AstPackage.LOCAL_VAR_STATEMENT__CLASSIFIER: return getClassifier(); } return super.eGet(featureID, resolve, coreType); } /** * <!-- begin-user-doc --> * <!-- end-user-doc --> * @generated */ public void eSet(int featureID, Object newValue) { switch (featureID) { case AstPackage.LOCAL_VAR_STATEMENT__FINAL_MODIFIER: setFinalModifier((Modifier)newValue); return; case AstPackage.LOCAL_VAR_STATEMENT__VARIABLES: getVariables().clear(); getVariables().addAll((Collection)newValue); return; case AstPackage.LOCAL_VAR_STATEMENT__CLASSIFIER: setClassifier((Expression)newValue); return; } super.eSet(featureID, newValue); } /** * <!-- begin-user-doc --> * <!-- end-user-doc --> * @generated */ public void eUnset(int featureID) { switch (featureID) { case AstPackage.LOCAL_VAR_STATEMENT__FINAL_MODIFIER: setFinalModifier((Modifier)null); return; case AstPackage.LOCAL_VAR_STATEMENT__VARIABLES: getVariables().clear(); return; case AstPackage.LOCAL_VAR_STATEMENT__CLASSIFIER: setClassifier((Expression)null); return; } super.eUnset(featureID); } /** * <!-- begin-user-doc --> * <!-- end-user-doc --> * @generated */ public boolean eIsSet(int featureID) { switch (featureID) { case AstPackage.LOCAL_VAR_STATEMENT__FINAL_MODIFIER: return finalModifier != null; case AstPackage.LOCAL_VAR_STATEMENT__VARIABLES: return variables != null && !variables.isEmpty(); case AstPackage.LOCAL_VAR_STATEMENT__CLASSIFIER: return classifier != null; } return super.eIsSet(featureID); } } //LocalVarStatementImpl