/**
*/
package hu.bme.mit.inf.dslreasoner.alloyLanguage.impl;
import hu.bme.mit.inf.dslreasoner.alloyLanguage.ALSSum;
import hu.bme.mit.inf.dslreasoner.alloyLanguage.ALSTerm;
import hu.bme.mit.inf.dslreasoner.alloyLanguage.ALSVariableDeclaration;
import hu.bme.mit.inf.dslreasoner.alloyLanguage.AlloyLanguagePackage;
import java.util.Collection;
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;
/**
*
* An implementation of the model object 'ALS Sum'.
*
*
* The following features are implemented:
*
*
* - {@link hu.bme.mit.inf.dslreasoner.alloyLanguage.impl.ALSSumImpl#getVariables Variables}
* - {@link hu.bme.mit.inf.dslreasoner.alloyLanguage.impl.ALSSumImpl#getExpression Expression}
*
*
* @generated
*/
public class ALSSumImpl extends ALSTermImpl implements ALSSum
{
/**
* The cached value of the '{@link #getVariables() Variables}' containment reference list.
*
*
* @see #getVariables()
* @generated
* @ordered
*/
protected EList variables;
/**
* The cached value of the '{@link #getExpression() Expression}' containment reference.
*
*
* @see #getExpression()
* @generated
* @ordered
*/
protected ALSTerm expression;
/**
*
*
* @generated
*/
protected ALSSumImpl()
{
super();
}
/**
*
*
* @generated
*/
@Override
protected EClass eStaticClass()
{
return AlloyLanguagePackage.Literals.ALS_SUM;
}
/**
*
*
* @generated
*/
public EList getVariables()
{
if (variables == null)
{
variables = new EObjectContainmentEList(ALSVariableDeclaration.class, this, AlloyLanguagePackage.ALS_SUM__VARIABLES);
}
return variables;
}
/**
*
*
* @generated
*/
public ALSTerm getExpression()
{
return expression;
}
/**
*
*
* @generated
*/
public NotificationChain basicSetExpression(ALSTerm newExpression, NotificationChain msgs)
{
ALSTerm oldExpression = expression;
expression = newExpression;
if (eNotificationRequired())
{
ENotificationImpl notification = new ENotificationImpl(this, Notification.SET, AlloyLanguagePackage.ALS_SUM__EXPRESSION, oldExpression, newExpression);
if (msgs == null) msgs = notification; else msgs.add(notification);
}
return msgs;
}
/**
*
*
* @generated
*/
public void setExpression(ALSTerm newExpression)
{
if (newExpression != expression)
{
NotificationChain msgs = null;
if (expression != null)
msgs = ((InternalEObject)expression).eInverseRemove(this, EOPPOSITE_FEATURE_BASE - AlloyLanguagePackage.ALS_SUM__EXPRESSION, null, msgs);
if (newExpression != null)
msgs = ((InternalEObject)newExpression).eInverseAdd(this, EOPPOSITE_FEATURE_BASE - AlloyLanguagePackage.ALS_SUM__EXPRESSION, null, msgs);
msgs = basicSetExpression(newExpression, msgs);
if (msgs != null) msgs.dispatch();
}
else if (eNotificationRequired())
eNotify(new ENotificationImpl(this, Notification.SET, AlloyLanguagePackage.ALS_SUM__EXPRESSION, newExpression, newExpression));
}
/**
*
*
* @generated
*/
@Override
public NotificationChain eInverseRemove(InternalEObject otherEnd, int featureID, NotificationChain msgs)
{
switch (featureID)
{
case AlloyLanguagePackage.ALS_SUM__VARIABLES:
return ((InternalEList>)getVariables()).basicRemove(otherEnd, msgs);
case AlloyLanguagePackage.ALS_SUM__EXPRESSION:
return basicSetExpression(null, msgs);
}
return super.eInverseRemove(otherEnd, featureID, msgs);
}
/**
*
*
* @generated
*/
@Override
public Object eGet(int featureID, boolean resolve, boolean coreType)
{
switch (featureID)
{
case AlloyLanguagePackage.ALS_SUM__VARIABLES:
return getVariables();
case AlloyLanguagePackage.ALS_SUM__EXPRESSION:
return getExpression();
}
return super.eGet(featureID, resolve, coreType);
}
/**
*
*
* @generated
*/
@SuppressWarnings("unchecked")
@Override
public void eSet(int featureID, Object newValue)
{
switch (featureID)
{
case AlloyLanguagePackage.ALS_SUM__VARIABLES:
getVariables().clear();
getVariables().addAll((Collection extends ALSVariableDeclaration>)newValue);
return;
case AlloyLanguagePackage.ALS_SUM__EXPRESSION:
setExpression((ALSTerm)newValue);
return;
}
super.eSet(featureID, newValue);
}
/**
*
*
* @generated
*/
@Override
public void eUnset(int featureID)
{
switch (featureID)
{
case AlloyLanguagePackage.ALS_SUM__VARIABLES:
getVariables().clear();
return;
case AlloyLanguagePackage.ALS_SUM__EXPRESSION:
setExpression((ALSTerm)null);
return;
}
super.eUnset(featureID);
}
/**
*
*
* @generated
*/
@Override
public boolean eIsSet(int featureID)
{
switch (featureID)
{
case AlloyLanguagePackage.ALS_SUM__VARIABLES:
return variables != null && !variables.isEmpty();
case AlloyLanguagePackage.ALS_SUM__EXPRESSION:
return expression != null;
}
return super.eIsSet(featureID);
}
} //ALSSumImpl