/**
* generated by Xtext 2.18.0.M3
*/
package org.eclipse.viatra.solver.language.solverLanguage.impl;
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;
import org.eclipse.viatra.solver.language.solverLanguage.EnumInterpretation;
import org.eclipse.viatra.solver.language.solverLanguage.ModelSymbol;
import org.eclipse.viatra.solver.language.solverLanguage.NamedObject;
import org.eclipse.viatra.solver.language.solverLanguage.SolverLanguagePackage;
/**
*
* An implementation of the model object 'Enum Interpretation'.
*
*
* The following features are implemented:
*
*
* - {@link org.eclipse.viatra.solver.language.solverLanguage.impl.EnumInterpretationImpl#getSymbol Symbol}
* - {@link org.eclipse.viatra.solver.language.solverLanguage.impl.EnumInterpretationImpl#getObjects Objects}
*
*
* @generated
*/
public class EnumInterpretationImpl extends CDInterpretationImpl implements EnumInterpretation
{
/**
* The cached value of the '{@link #getSymbol() Symbol}' containment reference.
*
*
* @see #getSymbol()
* @generated
* @ordered
*/
protected ModelSymbol symbol;
/**
* The cached value of the '{@link #getObjects() Objects}' containment reference list.
*
*
* @see #getObjects()
* @generated
* @ordered
*/
protected EList objects;
/**
*
*
* @generated
*/
protected EnumInterpretationImpl()
{
super();
}
/**
*
*
* @generated
*/
@Override
protected EClass eStaticClass()
{
return SolverLanguagePackage.Literals.ENUM_INTERPRETATION;
}
/**
*
*
* @generated
*/
@Override
public ModelSymbol getSymbol()
{
return symbol;
}
/**
*
*
* @generated
*/
public NotificationChain basicSetSymbol(ModelSymbol newSymbol, NotificationChain msgs)
{
ModelSymbol oldSymbol = symbol;
symbol = newSymbol;
if (eNotificationRequired())
{
ENotificationImpl notification = new ENotificationImpl(this, Notification.SET, SolverLanguagePackage.ENUM_INTERPRETATION__SYMBOL, oldSymbol, newSymbol);
if (msgs == null) msgs = notification; else msgs.add(notification);
}
return msgs;
}
/**
*
*
* @generated
*/
@Override
public void setSymbol(ModelSymbol newSymbol)
{
if (newSymbol != symbol)
{
NotificationChain msgs = null;
if (symbol != null)
msgs = ((InternalEObject)symbol).eInverseRemove(this, EOPPOSITE_FEATURE_BASE - SolverLanguagePackage.ENUM_INTERPRETATION__SYMBOL, null, msgs);
if (newSymbol != null)
msgs = ((InternalEObject)newSymbol).eInverseAdd(this, EOPPOSITE_FEATURE_BASE - SolverLanguagePackage.ENUM_INTERPRETATION__SYMBOL, null, msgs);
msgs = basicSetSymbol(newSymbol, msgs);
if (msgs != null) msgs.dispatch();
}
else if (eNotificationRequired())
eNotify(new ENotificationImpl(this, Notification.SET, SolverLanguagePackage.ENUM_INTERPRETATION__SYMBOL, newSymbol, newSymbol));
}
/**
*
*
* @generated
*/
@Override
public EList getObjects()
{
if (objects == null)
{
objects = new EObjectContainmentEList(NamedObject.class, this, SolverLanguagePackage.ENUM_INTERPRETATION__OBJECTS);
}
return objects;
}
/**
*
*
* @generated
*/
@Override
public NotificationChain eInverseRemove(InternalEObject otherEnd, int featureID, NotificationChain msgs)
{
switch (featureID)
{
case SolverLanguagePackage.ENUM_INTERPRETATION__SYMBOL:
return basicSetSymbol(null, msgs);
case SolverLanguagePackage.ENUM_INTERPRETATION__OBJECTS:
return ((InternalEList>)getObjects()).basicRemove(otherEnd, msgs);
}
return super.eInverseRemove(otherEnd, featureID, msgs);
}
/**
*
*
* @generated
*/
@Override
public Object eGet(int featureID, boolean resolve, boolean coreType)
{
switch (featureID)
{
case SolverLanguagePackage.ENUM_INTERPRETATION__SYMBOL:
return getSymbol();
case SolverLanguagePackage.ENUM_INTERPRETATION__OBJECTS:
return getObjects();
}
return super.eGet(featureID, resolve, coreType);
}
/**
*
*
* @generated
*/
@SuppressWarnings("unchecked")
@Override
public void eSet(int featureID, Object newValue)
{
switch (featureID)
{
case SolverLanguagePackage.ENUM_INTERPRETATION__SYMBOL:
setSymbol((ModelSymbol)newValue);
return;
case SolverLanguagePackage.ENUM_INTERPRETATION__OBJECTS:
getObjects().clear();
getObjects().addAll((Collection extends NamedObject>)newValue);
return;
}
super.eSet(featureID, newValue);
}
/**
*
*
* @generated
*/
@Override
public void eUnset(int featureID)
{
switch (featureID)
{
case SolverLanguagePackage.ENUM_INTERPRETATION__SYMBOL:
setSymbol((ModelSymbol)null);
return;
case SolverLanguagePackage.ENUM_INTERPRETATION__OBJECTS:
getObjects().clear();
return;
}
super.eUnset(featureID);
}
/**
*
*
* @generated
*/
@Override
public boolean eIsSet(int featureID)
{
switch (featureID)
{
case SolverLanguagePackage.ENUM_INTERPRETATION__SYMBOL:
return symbol != null;
case SolverLanguagePackage.ENUM_INTERPRETATION__OBJECTS:
return objects != null && !objects.isEmpty();
}
return super.eIsSet(featureID);
}
} //EnumInterpretationImpl