/** * <copyright> * </copyright> * * $Id: VariableDeclarationImpl.java,v 1.3 2011/04/18 08:29:42 apanchenk Exp $ */ package org.eclipse.dltk.javascript.core.dom.impl; import org.eclipse.dltk.javascript.core.dom.DomPackage; import org.eclipse.dltk.javascript.core.dom.Expression; import org.eclipse.dltk.javascript.core.dom.Identifier; import org.eclipse.dltk.javascript.core.dom.VariableDeclaration; 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>Variable Declaration</b></em>'. * <!-- end-user-doc --> * <p> * The following features are implemented: * <ul> * <li>{@link org.eclipse.dltk.javascript.core.dom.impl.VariableDeclarationImpl#getIdentifier <em>Identifier</em>}</li> * <li>{@link org.eclipse.dltk.javascript.core.dom.impl.VariableDeclarationImpl#getInitializer <em>Initializer</em>}</li> * </ul> * </p> * * @generated */ public class VariableDeclarationImpl extends NodeImpl implements VariableDeclaration { /** * The cached value of the '{@link #getIdentifier() <em>Identifier</em>}' containment reference. * <!-- begin-user-doc --> * <!-- end-user-doc --> * @see #getIdentifier() * @generated * @ordered */ protected Identifier identifier; /** * The cached value of the '{@link #getInitializer() <em>Initializer</em>}' containment reference. * <!-- begin-user-doc --> * <!-- end-user-doc --> * @see #getInitializer() * @generated * @ordered */ protected Expression initializer; /** * <!-- begin-user-doc --> * <!-- end-user-doc --> * @generated */ protected VariableDeclarationImpl() { super(); } /** * <!-- begin-user-doc --> * <!-- end-user-doc --> * @generated */ @Override protected EClass eStaticClass() { return DomPackage.Literals.VARIABLE_DECLARATION; } /** * <!-- begin-user-doc --> * <!-- end-user-doc --> * @generated */ public Identifier getIdentifier() { return identifier; } /** * <!-- begin-user-doc --> * <!-- end-user-doc --> * @generated */ public NotificationChain basicSetIdentifier(Identifier newIdentifier, NotificationChain msgs) { Identifier oldIdentifier = identifier; identifier = newIdentifier; if (eNotificationRequired()) { ENotificationImpl notification = new ENotificationImpl(this, Notification.SET, DomPackage.VARIABLE_DECLARATION__IDENTIFIER, oldIdentifier, newIdentifier); if (msgs == null) msgs = notification; else msgs.add(notification); } return msgs; } /** * <!-- begin-user-doc --> * <!-- end-user-doc --> * @generated */ public void setIdentifier(Identifier newIdentifier) { if (newIdentifier != identifier) { NotificationChain msgs = null; if (identifier != null) msgs = ((InternalEObject)identifier).eInverseRemove(this, EOPPOSITE_FEATURE_BASE - DomPackage.VARIABLE_DECLARATION__IDENTIFIER, null, msgs); if (newIdentifier != null) msgs = ((InternalEObject)newIdentifier).eInverseAdd(this, EOPPOSITE_FEATURE_BASE - DomPackage.VARIABLE_DECLARATION__IDENTIFIER, null, msgs); msgs = basicSetIdentifier(newIdentifier, msgs); if (msgs != null) msgs.dispatch(); } else if (eNotificationRequired()) eNotify(new ENotificationImpl(this, Notification.SET, DomPackage.VARIABLE_DECLARATION__IDENTIFIER, newIdentifier, newIdentifier)); } /** * <!-- begin-user-doc --> * <!-- end-user-doc --> * @generated */ public Expression getInitializer() { return initializer; } /** * <!-- begin-user-doc --> * <!-- end-user-doc --> * @generated */ public NotificationChain basicSetInitializer(Expression newInitializer, NotificationChain msgs) { Expression oldInitializer = initializer; initializer = newInitializer; if (eNotificationRequired()) { ENotificationImpl notification = new ENotificationImpl(this, Notification.SET, DomPackage.VARIABLE_DECLARATION__INITIALIZER, oldInitializer, newInitializer); if (msgs == null) msgs = notification; else msgs.add(notification); } return msgs; } /** * <!-- begin-user-doc --> * <!-- end-user-doc --> * @generated */ public void setInitializer(Expression newInitializer) { if (newInitializer != initializer) { NotificationChain msgs = null; if (initializer != null) msgs = ((InternalEObject)initializer).eInverseRemove(this, EOPPOSITE_FEATURE_BASE - DomPackage.VARIABLE_DECLARATION__INITIALIZER, null, msgs); if (newInitializer != null) msgs = ((InternalEObject)newInitializer).eInverseAdd(this, EOPPOSITE_FEATURE_BASE - DomPackage.VARIABLE_DECLARATION__INITIALIZER, null, msgs); msgs = basicSetInitializer(newInitializer, msgs); if (msgs != null) msgs.dispatch(); } else if (eNotificationRequired()) eNotify(new ENotificationImpl(this, Notification.SET, DomPackage.VARIABLE_DECLARATION__INITIALIZER, newInitializer, newInitializer)); } /** * <!-- begin-user-doc --> * <!-- end-user-doc --> * @generated */ @Override public NotificationChain eInverseRemove(InternalEObject otherEnd, int featureID, NotificationChain msgs) { switch (featureID) { case DomPackage.VARIABLE_DECLARATION__IDENTIFIER: return basicSetIdentifier(null, msgs); case DomPackage.VARIABLE_DECLARATION__INITIALIZER: return basicSetInitializer(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 DomPackage.VARIABLE_DECLARATION__IDENTIFIER: return getIdentifier(); case DomPackage.VARIABLE_DECLARATION__INITIALIZER: return getInitializer(); } return super.eGet(featureID, resolve, coreType); } /** * <!-- begin-user-doc --> * <!-- end-user-doc --> * @generated */ @Override public void eSet(int featureID, Object newValue) { switch (featureID) { case DomPackage.VARIABLE_DECLARATION__IDENTIFIER: setIdentifier((Identifier)newValue); return; case DomPackage.VARIABLE_DECLARATION__INITIALIZER: setInitializer((Expression)newValue); return; } super.eSet(featureID, newValue); } /** * <!-- begin-user-doc --> * <!-- end-user-doc --> * @generated */ @Override public void eUnset(int featureID) { switch (featureID) { case DomPackage.VARIABLE_DECLARATION__IDENTIFIER: setIdentifier((Identifier)null); return; case DomPackage.VARIABLE_DECLARATION__INITIALIZER: setInitializer((Expression)null); return; } super.eUnset(featureID); } /** * <!-- begin-user-doc --> * <!-- end-user-doc --> * @generated */ @Override public boolean eIsSet(int featureID) { switch (featureID) { case DomPackage.VARIABLE_DECLARATION__IDENTIFIER: return identifier != null; case DomPackage.VARIABLE_DECLARATION__INITIALIZER: return initializer != null; } return super.eIsSet(featureID); } } //VariableDeclarationImpl