/**
* <copyright>
* </copyright>
*
* $Id$
*/
package net.sf.etl.samples.ej.ast.impl;
import java.util.Collection;
import net.sf.etl.samples.ej.ast.ApplySquareOp;
import net.sf.etl.samples.ej.ast.AstPackage;
import net.sf.etl.samples.ej.ast.Expression;
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>Apply Square Op</b></em>'.
* <!-- end-user-doc -->
* <p>
* The following features are implemented:
* <ul>
* <li>{@link net.sf.etl.samples.ej.ast.impl.ApplySquareOpImpl#getFunctor <em>Functor</em>}</li>
* <li>{@link net.sf.etl.samples.ej.ast.impl.ApplySquareOpImpl#getArgs <em>Args</em>}</li>
* </ul>
* </p>
*
* @generated
*/
public class ApplySquareOpImpl extends ExpressionImpl implements ApplySquareOp {
/**
* The cached value of the '{@link #getFunctor() <em>Functor</em>}' containment reference.
* <!-- begin-user-doc -->
* <!-- end-user-doc -->
* @see #getFunctor()
* @generated
* @ordered
*/
protected Expression functor = 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;
/**
* <!-- begin-user-doc -->
* <!-- end-user-doc -->
* @generated
*/
protected ApplySquareOpImpl() {
super();
}
/**
* <!-- begin-user-doc -->
* <!-- end-user-doc -->
* @generated
*/
protected EClass eStaticClass() {
return AstPackage.Literals.APPLY_SQUARE_OP;
}
/**
* <!-- begin-user-doc -->
* <!-- end-user-doc -->
* @generated
*/
public Expression getFunctor() {
return functor;
}
/**
* <!-- begin-user-doc -->
* <!-- end-user-doc -->
* @generated
*/
public NotificationChain basicSetFunctor(Expression newFunctor, NotificationChain msgs) {
Expression oldFunctor = functor;
functor = newFunctor;
if (eNotificationRequired()) {
ENotificationImpl notification = new ENotificationImpl(this, Notification.SET, AstPackage.APPLY_SQUARE_OP__FUNCTOR, oldFunctor, newFunctor);
if (msgs == null) msgs = notification; else msgs.add(notification);
}
return msgs;
}
/**
* <!-- begin-user-doc -->
* <!-- end-user-doc -->
* @generated
*/
public void setFunctor(Expression newFunctor) {
if (newFunctor != functor) {
NotificationChain msgs = null;
if (functor != null)
msgs = ((InternalEObject)functor).eInverseRemove(this, EOPPOSITE_FEATURE_BASE - AstPackage.APPLY_SQUARE_OP__FUNCTOR, null, msgs);
if (newFunctor != null)
msgs = ((InternalEObject)newFunctor).eInverseAdd(this, EOPPOSITE_FEATURE_BASE - AstPackage.APPLY_SQUARE_OP__FUNCTOR, null, msgs);
msgs = basicSetFunctor(newFunctor, msgs);
if (msgs != null) msgs.dispatch();
}
else if (eNotificationRequired())
eNotify(new ENotificationImpl(this, Notification.SET, AstPackage.APPLY_SQUARE_OP__FUNCTOR, newFunctor, newFunctor));
}
/**
* <!-- begin-user-doc -->
* <!-- end-user-doc -->
* @generated
*/
public EList getArgs() {
if (args == null) {
args = new EObjectContainmentEList(Expression.class, this, AstPackage.APPLY_SQUARE_OP__ARGS);
}
return args;
}
/**
* <!-- begin-user-doc -->
* <!-- end-user-doc -->
* @generated
*/
public NotificationChain eInverseRemove(InternalEObject otherEnd, int featureID, NotificationChain msgs) {
switch (featureID) {
case AstPackage.APPLY_SQUARE_OP__FUNCTOR:
return basicSetFunctor(null, msgs);
case AstPackage.APPLY_SQUARE_OP__ARGS:
return ((InternalEList)getArgs()).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.APPLY_SQUARE_OP__FUNCTOR:
return getFunctor();
case AstPackage.APPLY_SQUARE_OP__ARGS:
return getArgs();
}
return super.eGet(featureID, resolve, coreType);
}
/**
* <!-- begin-user-doc -->
* <!-- end-user-doc -->
* @generated
*/
public void eSet(int featureID, Object newValue) {
switch (featureID) {
case AstPackage.APPLY_SQUARE_OP__FUNCTOR:
setFunctor((Expression)newValue);
return;
case AstPackage.APPLY_SQUARE_OP__ARGS:
getArgs().clear();
getArgs().addAll((Collection)newValue);
return;
}
super.eSet(featureID, newValue);
}
/**
* <!-- begin-user-doc -->
* <!-- end-user-doc -->
* @generated
*/
public void eUnset(int featureID) {
switch (featureID) {
case AstPackage.APPLY_SQUARE_OP__FUNCTOR:
setFunctor((Expression)null);
return;
case AstPackage.APPLY_SQUARE_OP__ARGS:
getArgs().clear();
return;
}
super.eUnset(featureID);
}
/**
* <!-- begin-user-doc -->
* <!-- end-user-doc -->
* @generated
*/
public boolean eIsSet(int featureID) {
switch (featureID) {
case AstPackage.APPLY_SQUARE_OP__FUNCTOR:
return functor != null;
case AstPackage.APPLY_SQUARE_OP__ARGS:
return args != null && !args.isEmpty();
}
return super.eIsSet(featureID);
}
} //ApplySquareOpImpl