/** * <copyright> * </copyright> * * $Id: NewExpressionImpl.java,v 1.3 2011/04/18 08:29:42 apanchenk Exp $ */ package org.eclipse.dltk.javascript.core.dom.impl; import java.util.Collection; import org.eclipse.dltk.javascript.core.dom.DomPackage; import org.eclipse.dltk.javascript.core.dom.Expression; import org.eclipse.dltk.javascript.core.dom.NewExpression; 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>New Expression</b></em>'. * <!-- end-user-doc --> * <p> * The following features are implemented: * <ul> * <li>{@link org.eclipse.dltk.javascript.core.dom.impl.NewExpressionImpl#getConstructor <em>Constructor</em>}</li> * <li>{@link org.eclipse.dltk.javascript.core.dom.impl.NewExpressionImpl#getArguments <em>Arguments</em>}</li> * </ul> * </p> * * @generated */ public class NewExpressionImpl extends ExpressionImpl implements NewExpression { /** * The cached value of the '{@link #getConstructor() <em>Constructor</em>}' containment reference. * <!-- begin-user-doc --> * <!-- end-user-doc --> * @see #getConstructor() * @generated * @ordered */ protected Expression constructor; /** * The cached value of the '{@link #getArguments() <em>Arguments</em>}' containment reference list. * <!-- begin-user-doc --> * <!-- end-user-doc --> * @see #getArguments() * @generated * @ordered */ protected EList<Expression> arguments; /** * <!-- begin-user-doc --> * <!-- end-user-doc --> * @generated */ protected NewExpressionImpl() { super(); } /** * <!-- begin-user-doc --> * <!-- end-user-doc --> * @generated */ @Override protected EClass eStaticClass() { return DomPackage.Literals.NEW_EXPRESSION; } /** * <!-- begin-user-doc --> * <!-- end-user-doc --> * @generated */ public Expression getConstructor() { return constructor; } /** * <!-- begin-user-doc --> * <!-- end-user-doc --> * @generated */ public NotificationChain basicSetConstructor(Expression newConstructor, NotificationChain msgs) { Expression oldConstructor = constructor; constructor = newConstructor; if (eNotificationRequired()) { ENotificationImpl notification = new ENotificationImpl(this, Notification.SET, DomPackage.NEW_EXPRESSION__CONSTRUCTOR, oldConstructor, newConstructor); if (msgs == null) msgs = notification; else msgs.add(notification); } return msgs; } /** * <!-- begin-user-doc --> * <!-- end-user-doc --> * @generated */ public void setConstructor(Expression newConstructor) { if (newConstructor != constructor) { NotificationChain msgs = null; if (constructor != null) msgs = ((InternalEObject)constructor).eInverseRemove(this, EOPPOSITE_FEATURE_BASE - DomPackage.NEW_EXPRESSION__CONSTRUCTOR, null, msgs); if (newConstructor != null) msgs = ((InternalEObject)newConstructor).eInverseAdd(this, EOPPOSITE_FEATURE_BASE - DomPackage.NEW_EXPRESSION__CONSTRUCTOR, null, msgs); msgs = basicSetConstructor(newConstructor, msgs); if (msgs != null) msgs.dispatch(); } else if (eNotificationRequired()) eNotify(new ENotificationImpl(this, Notification.SET, DomPackage.NEW_EXPRESSION__CONSTRUCTOR, newConstructor, newConstructor)); } /** * <!-- begin-user-doc --> * <!-- end-user-doc --> * @generated */ public EList<Expression> getArguments() { if (arguments == null) { arguments = new EObjectContainmentEList<Expression>(Expression.class, this, DomPackage.NEW_EXPRESSION__ARGUMENTS); } return arguments; } /** * <!-- begin-user-doc --> * <!-- end-user-doc --> * @generated */ @Override public NotificationChain eInverseRemove(InternalEObject otherEnd, int featureID, NotificationChain msgs) { switch (featureID) { case DomPackage.NEW_EXPRESSION__CONSTRUCTOR: return basicSetConstructor(null, msgs); case DomPackage.NEW_EXPRESSION__ARGUMENTS: return ((InternalEList<?>)getArguments()).basicRemove(otherEnd, 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.NEW_EXPRESSION__CONSTRUCTOR: return getConstructor(); case DomPackage.NEW_EXPRESSION__ARGUMENTS: return getArguments(); } 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 DomPackage.NEW_EXPRESSION__CONSTRUCTOR: setConstructor((Expression)newValue); return; case DomPackage.NEW_EXPRESSION__ARGUMENTS: getArguments().clear(); getArguments().addAll((Collection<? extends Expression>)newValue); return; } super.eSet(featureID, newValue); } /** * <!-- begin-user-doc --> * <!-- end-user-doc --> * @generated */ @Override public void eUnset(int featureID) { switch (featureID) { case DomPackage.NEW_EXPRESSION__CONSTRUCTOR: setConstructor((Expression)null); return; case DomPackage.NEW_EXPRESSION__ARGUMENTS: getArguments().clear(); return; } super.eUnset(featureID); } /** * <!-- begin-user-doc --> * <!-- end-user-doc --> * @generated */ @Override public boolean eIsSet(int featureID) { switch (featureID) { case DomPackage.NEW_EXPRESSION__CONSTRUCTOR: return constructor != null; case DomPackage.NEW_EXPRESSION__ARGUMENTS: return arguments != null && !arguments.isEmpty(); } return super.eIsSet(featureID); } } //NewExpressionImpl