/**
* <copyright>
* </copyright>
*
* $Id$
*/
package net.sf.etl.samples.ej.ast.impl;
import java.util.Collection;
import net.sf.etl.samples.ej.ast.ArrayConstructor;
import net.sf.etl.samples.ej.ast.AstPackage;
import net.sf.etl.samples.ej.ast.ClassBlock;
import net.sf.etl.samples.ej.ast.Expression;
import net.sf.etl.samples.ej.ast.NewOp;
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 Op</b></em>'.
* <!-- end-user-doc -->
* <p>
* The following features are implemented:
* <ul>
* <li>{@link net.sf.etl.samples.ej.ast.impl.NewOpImpl#getClassifier <em>Classifier</em>}</li>
* <li>{@link net.sf.etl.samples.ej.ast.impl.NewOpImpl#getArgs <em>Args</em>}</li>
* <li>{@link net.sf.etl.samples.ej.ast.impl.NewOpImpl#getClassBody <em>Class Body</em>}</li>
* <li>{@link net.sf.etl.samples.ej.ast.impl.NewOpImpl#getArrayConstructor <em>Array Constructor</em>}</li>
* </ul>
* </p>
*
* @generated
*/
public class NewOpImpl extends ExpressionImpl implements NewOp {
/**
* 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 #getArgs() <em>Args</em>}' containment reference list.
* <!-- begin-user-doc -->
* <!-- end-user-doc -->
* @see #getArgs()
* @generated
* @ordered
*/
protected EList args = null;
/**
* The cached value of the '{@link #getClassBody() <em>Class Body</em>}' containment reference.
* <!-- begin-user-doc -->
* <!-- end-user-doc -->
* @see #getClassBody()
* @generated
* @ordered
*/
protected ClassBlock classBody = null;
/**
* The cached value of the '{@link #getArrayConstructor() <em>Array Constructor</em>}' containment reference.
* <!-- begin-user-doc -->
* <!-- end-user-doc -->
* @see #getArrayConstructor()
* @generated
* @ordered
*/
protected ArrayConstructor arrayConstructor = null;
/**
* <!-- begin-user-doc -->
* <!-- end-user-doc -->
* @generated
*/
protected NewOpImpl() {
super();
}
/**
* <!-- begin-user-doc -->
* <!-- end-user-doc -->
* @generated
*/
protected EClass eStaticClass() {
return AstPackage.Literals.NEW_OP;
}
/**
* <!-- 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.NEW_OP__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.NEW_OP__CLASSIFIER, null, msgs);
if (newClassifier != null)
msgs = ((InternalEObject)newClassifier).eInverseAdd(this, EOPPOSITE_FEATURE_BASE - AstPackage.NEW_OP__CLASSIFIER, null, msgs);
msgs = basicSetClassifier(newClassifier, msgs);
if (msgs != null) msgs.dispatch();
}
else if (eNotificationRequired())
eNotify(new ENotificationImpl(this, Notification.SET, AstPackage.NEW_OP__CLASSIFIER, newClassifier, newClassifier));
}
/**
* <!-- begin-user-doc -->
* <!-- end-user-doc -->
* @generated
*/
public EList getArgs() {
if (args == null) {
args = new EObjectContainmentEList(Expression.class, this, AstPackage.NEW_OP__ARGS);
}
return args;
}
/**
* <!-- begin-user-doc -->
* <!-- end-user-doc -->
* @generated
*/
public ClassBlock getClassBody() {
return classBody;
}
/**
* <!-- begin-user-doc -->
* <!-- end-user-doc -->
* @generated
*/
public NotificationChain basicSetClassBody(ClassBlock newClassBody, NotificationChain msgs) {
ClassBlock oldClassBody = classBody;
classBody = newClassBody;
if (eNotificationRequired()) {
ENotificationImpl notification = new ENotificationImpl(this, Notification.SET, AstPackage.NEW_OP__CLASS_BODY, oldClassBody, newClassBody);
if (msgs == null) msgs = notification; else msgs.add(notification);
}
return msgs;
}
/**
* <!-- begin-user-doc -->
* <!-- end-user-doc -->
* @generated
*/
public void setClassBody(ClassBlock newClassBody) {
if (newClassBody != classBody) {
NotificationChain msgs = null;
if (classBody != null)
msgs = ((InternalEObject)classBody).eInverseRemove(this, EOPPOSITE_FEATURE_BASE - AstPackage.NEW_OP__CLASS_BODY, null, msgs);
if (newClassBody != null)
msgs = ((InternalEObject)newClassBody).eInverseAdd(this, EOPPOSITE_FEATURE_BASE - AstPackage.NEW_OP__CLASS_BODY, null, msgs);
msgs = basicSetClassBody(newClassBody, msgs);
if (msgs != null) msgs.dispatch();
}
else if (eNotificationRequired())
eNotify(new ENotificationImpl(this, Notification.SET, AstPackage.NEW_OP__CLASS_BODY, newClassBody, newClassBody));
}
/**
* <!-- begin-user-doc -->
* <!-- end-user-doc -->
* @generated
*/
public ArrayConstructor getArrayConstructor() {
return arrayConstructor;
}
/**
* <!-- begin-user-doc -->
* <!-- end-user-doc -->
* @generated
*/
public NotificationChain basicSetArrayConstructor(ArrayConstructor newArrayConstructor, NotificationChain msgs) {
ArrayConstructor oldArrayConstructor = arrayConstructor;
arrayConstructor = newArrayConstructor;
if (eNotificationRequired()) {
ENotificationImpl notification = new ENotificationImpl(this, Notification.SET, AstPackage.NEW_OP__ARRAY_CONSTRUCTOR, oldArrayConstructor, newArrayConstructor);
if (msgs == null) msgs = notification; else msgs.add(notification);
}
return msgs;
}
/**
* <!-- begin-user-doc -->
* <!-- end-user-doc -->
* @generated
*/
public void setArrayConstructor(ArrayConstructor newArrayConstructor) {
if (newArrayConstructor != arrayConstructor) {
NotificationChain msgs = null;
if (arrayConstructor != null)
msgs = ((InternalEObject)arrayConstructor).eInverseRemove(this, EOPPOSITE_FEATURE_BASE - AstPackage.NEW_OP__ARRAY_CONSTRUCTOR, null, msgs);
if (newArrayConstructor != null)
msgs = ((InternalEObject)newArrayConstructor).eInverseAdd(this, EOPPOSITE_FEATURE_BASE - AstPackage.NEW_OP__ARRAY_CONSTRUCTOR, null, msgs);
msgs = basicSetArrayConstructor(newArrayConstructor, msgs);
if (msgs != null) msgs.dispatch();
}
else if (eNotificationRequired())
eNotify(new ENotificationImpl(this, Notification.SET, AstPackage.NEW_OP__ARRAY_CONSTRUCTOR, newArrayConstructor, newArrayConstructor));
}
/**
* <!-- begin-user-doc -->
* <!-- end-user-doc -->
* @generated
*/
public NotificationChain eInverseRemove(InternalEObject otherEnd, int featureID, NotificationChain msgs) {
switch (featureID) {
case AstPackage.NEW_OP__CLASSIFIER:
return basicSetClassifier(null, msgs);
case AstPackage.NEW_OP__ARGS:
return ((InternalEList)getArgs()).basicRemove(otherEnd, msgs);
case AstPackage.NEW_OP__CLASS_BODY:
return basicSetClassBody(null, msgs);
case AstPackage.NEW_OP__ARRAY_CONSTRUCTOR:
return basicSetArrayConstructor(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.NEW_OP__CLASSIFIER:
return getClassifier();
case AstPackage.NEW_OP__ARGS:
return getArgs();
case AstPackage.NEW_OP__CLASS_BODY:
return getClassBody();
case AstPackage.NEW_OP__ARRAY_CONSTRUCTOR:
return getArrayConstructor();
}
return super.eGet(featureID, resolve, coreType);
}
/**
* <!-- begin-user-doc -->
* <!-- end-user-doc -->
* @generated
*/
public void eSet(int featureID, Object newValue) {
switch (featureID) {
case AstPackage.NEW_OP__CLASSIFIER:
setClassifier((Expression)newValue);
return;
case AstPackage.NEW_OP__ARGS:
getArgs().clear();
getArgs().addAll((Collection)newValue);
return;
case AstPackage.NEW_OP__CLASS_BODY:
setClassBody((ClassBlock)newValue);
return;
case AstPackage.NEW_OP__ARRAY_CONSTRUCTOR:
setArrayConstructor((ArrayConstructor)newValue);
return;
}
super.eSet(featureID, newValue);
}
/**
* <!-- begin-user-doc -->
* <!-- end-user-doc -->
* @generated
*/
public void eUnset(int featureID) {
switch (featureID) {
case AstPackage.NEW_OP__CLASSIFIER:
setClassifier((Expression)null);
return;
case AstPackage.NEW_OP__ARGS:
getArgs().clear();
return;
case AstPackage.NEW_OP__CLASS_BODY:
setClassBody((ClassBlock)null);
return;
case AstPackage.NEW_OP__ARRAY_CONSTRUCTOR:
setArrayConstructor((ArrayConstructor)null);
return;
}
super.eUnset(featureID);
}
/**
* <!-- begin-user-doc -->
* <!-- end-user-doc -->
* @generated
*/
public boolean eIsSet(int featureID) {
switch (featureID) {
case AstPackage.NEW_OP__CLASSIFIER:
return classifier != null;
case AstPackage.NEW_OP__ARGS:
return args != null && !args.isEmpty();
case AstPackage.NEW_OP__CLASS_BODY:
return classBody != null;
case AstPackage.NEW_OP__ARRAY_CONSTRUCTOR:
return arrayConstructor != null;
}
return super.eIsSet(featureID);
}
} //NewOpImpl