/**
* <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.BehaviorFeature;
import net.sf.etl.samples.ej.ast.Expression;
import net.sf.etl.samples.ej.ast.Identifier;
import net.sf.etl.samples.ej.ast.Parameter;
import net.sf.etl.samples.ej.ast.TemplateParameter;
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>Behavior Feature</b></em>'.
* <!-- end-user-doc -->
* <p>
* The following features are implemented:
* <ul>
* <li>{@link net.sf.etl.samples.ej.ast.impl.BehaviorFeatureImpl#getExceptions <em>Exceptions</em>}</li>
* <li>{@link net.sf.etl.samples.ej.ast.impl.BehaviorFeatureImpl#getName <em>Name</em>}</li>
* <li>{@link net.sf.etl.samples.ej.ast.impl.BehaviorFeatureImpl#getParameters <em>Parameters</em>}</li>
* <li>{@link net.sf.etl.samples.ej.ast.impl.BehaviorFeatureImpl#getTemplateParameters <em>Template Parameters</em>}</li>
* </ul>
* </p>
*
* @generated
*/
public class BehaviorFeatureImpl extends FeatureImpl implements BehaviorFeature {
/**
* The cached value of the '{@link #getExceptions() <em>Exceptions</em>}' containment reference list.
* <!-- begin-user-doc -->
* <!-- end-user-doc -->
* @see #getExceptions()
* @generated
* @ordered
*/
protected EList exceptions = null;
/**
* The cached value of the '{@link #getName() <em>Name</em>}' containment reference.
* <!-- begin-user-doc -->
* <!-- end-user-doc -->
* @see #getName()
* @generated
* @ordered
*/
protected Identifier name = null;
/**
* The cached value of the '{@link #getParameters() <em>Parameters</em>}' containment reference list.
* <!-- begin-user-doc -->
* <!-- end-user-doc -->
* @see #getParameters()
* @generated
* @ordered
*/
protected EList parameters = null;
/**
* The cached value of the '{@link #getTemplateParameters() <em>Template Parameters</em>}' containment reference list.
* <!-- begin-user-doc -->
* <!-- end-user-doc -->
* @see #getTemplateParameters()
* @generated
* @ordered
*/
protected EList templateParameters = null;
/**
* <!-- begin-user-doc -->
* <!-- end-user-doc -->
* @generated
*/
protected BehaviorFeatureImpl() {
super();
}
/**
* <!-- begin-user-doc -->
* <!-- end-user-doc -->
* @generated
*/
protected EClass eStaticClass() {
return AstPackage.Literals.BEHAVIOR_FEATURE;
}
/**
* <!-- begin-user-doc -->
* <!-- end-user-doc -->
* @generated
*/
public EList getExceptions() {
if (exceptions == null) {
exceptions = new EObjectContainmentEList(Expression.class, this, AstPackage.BEHAVIOR_FEATURE__EXCEPTIONS);
}
return exceptions;
}
/**
* <!-- begin-user-doc -->
* <!-- end-user-doc -->
* @generated
*/
public Identifier getName() {
return name;
}
/**
* <!-- begin-user-doc -->
* <!-- end-user-doc -->
* @generated
*/
public NotificationChain basicSetName(Identifier newName, NotificationChain msgs) {
Identifier oldName = name;
name = newName;
if (eNotificationRequired()) {
ENotificationImpl notification = new ENotificationImpl(this, Notification.SET, AstPackage.BEHAVIOR_FEATURE__NAME, oldName, newName);
if (msgs == null) msgs = notification; else msgs.add(notification);
}
return msgs;
}
/**
* <!-- begin-user-doc -->
* <!-- end-user-doc -->
* @generated
*/
public void setName(Identifier newName) {
if (newName != name) {
NotificationChain msgs = null;
if (name != null)
msgs = ((InternalEObject)name).eInverseRemove(this, EOPPOSITE_FEATURE_BASE - AstPackage.BEHAVIOR_FEATURE__NAME, null, msgs);
if (newName != null)
msgs = ((InternalEObject)newName).eInverseAdd(this, EOPPOSITE_FEATURE_BASE - AstPackage.BEHAVIOR_FEATURE__NAME, null, msgs);
msgs = basicSetName(newName, msgs);
if (msgs != null) msgs.dispatch();
}
else if (eNotificationRequired())
eNotify(new ENotificationImpl(this, Notification.SET, AstPackage.BEHAVIOR_FEATURE__NAME, newName, newName));
}
/**
* <!-- begin-user-doc -->
* <!-- end-user-doc -->
* @generated
*/
public EList getParameters() {
if (parameters == null) {
parameters = new EObjectContainmentEList(Parameter.class, this, AstPackage.BEHAVIOR_FEATURE__PARAMETERS);
}
return parameters;
}
/**
* <!-- begin-user-doc -->
* <!-- end-user-doc -->
* @generated
*/
public EList getTemplateParameters() {
if (templateParameters == null) {
templateParameters = new EObjectContainmentEList(TemplateParameter.class, this, AstPackage.BEHAVIOR_FEATURE__TEMPLATE_PARAMETERS);
}
return templateParameters;
}
/**
* <!-- begin-user-doc -->
* <!-- end-user-doc -->
* @generated
*/
public NotificationChain eInverseRemove(InternalEObject otherEnd, int featureID, NotificationChain msgs) {
switch (featureID) {
case AstPackage.BEHAVIOR_FEATURE__EXCEPTIONS:
return ((InternalEList)getExceptions()).basicRemove(otherEnd, msgs);
case AstPackage.BEHAVIOR_FEATURE__NAME:
return basicSetName(null, msgs);
case AstPackage.BEHAVIOR_FEATURE__PARAMETERS:
return ((InternalEList)getParameters()).basicRemove(otherEnd, msgs);
case AstPackage.BEHAVIOR_FEATURE__TEMPLATE_PARAMETERS:
return ((InternalEList)getTemplateParameters()).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.BEHAVIOR_FEATURE__EXCEPTIONS:
return getExceptions();
case AstPackage.BEHAVIOR_FEATURE__NAME:
return getName();
case AstPackage.BEHAVIOR_FEATURE__PARAMETERS:
return getParameters();
case AstPackage.BEHAVIOR_FEATURE__TEMPLATE_PARAMETERS:
return getTemplateParameters();
}
return super.eGet(featureID, resolve, coreType);
}
/**
* <!-- begin-user-doc -->
* <!-- end-user-doc -->
* @generated
*/
public void eSet(int featureID, Object newValue) {
switch (featureID) {
case AstPackage.BEHAVIOR_FEATURE__EXCEPTIONS:
getExceptions().clear();
getExceptions().addAll((Collection)newValue);
return;
case AstPackage.BEHAVIOR_FEATURE__NAME:
setName((Identifier)newValue);
return;
case AstPackage.BEHAVIOR_FEATURE__PARAMETERS:
getParameters().clear();
getParameters().addAll((Collection)newValue);
return;
case AstPackage.BEHAVIOR_FEATURE__TEMPLATE_PARAMETERS:
getTemplateParameters().clear();
getTemplateParameters().addAll((Collection)newValue);
return;
}
super.eSet(featureID, newValue);
}
/**
* <!-- begin-user-doc -->
* <!-- end-user-doc -->
* @generated
*/
public void eUnset(int featureID) {
switch (featureID) {
case AstPackage.BEHAVIOR_FEATURE__EXCEPTIONS:
getExceptions().clear();
return;
case AstPackage.BEHAVIOR_FEATURE__NAME:
setName((Identifier)null);
return;
case AstPackage.BEHAVIOR_FEATURE__PARAMETERS:
getParameters().clear();
return;
case AstPackage.BEHAVIOR_FEATURE__TEMPLATE_PARAMETERS:
getTemplateParameters().clear();
return;
}
super.eUnset(featureID);
}
/**
* <!-- begin-user-doc -->
* <!-- end-user-doc -->
* @generated
*/
public boolean eIsSet(int featureID) {
switch (featureID) {
case AstPackage.BEHAVIOR_FEATURE__EXCEPTIONS:
return exceptions != null && !exceptions.isEmpty();
case AstPackage.BEHAVIOR_FEATURE__NAME:
return name != null;
case AstPackage.BEHAVIOR_FEATURE__PARAMETERS:
return parameters != null && !parameters.isEmpty();
case AstPackage.BEHAVIOR_FEATURE__TEMPLATE_PARAMETERS:
return templateParameters != null && !templateParameters.isEmpty();
}
return super.eIsSet(featureID);
}
} //BehaviorFeatureImpl