/**
* 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.ClassInterpretation;
import org.eclipse.viatra.solver.language.solverLanguage.FieldRelationInterpretation;
import org.eclipse.viatra.solver.language.solverLanguage.ModelSymbol;
import org.eclipse.viatra.solver.language.solverLanguage.SolverLanguagePackage;
/**
*
* An implementation of the model object 'Class Interpretation'.
*
*
* The following features are implemented:
*
*
* - {@link org.eclipse.viatra.solver.language.solverLanguage.impl.ClassInterpretationImpl#isAbstract Abstract}
* - {@link org.eclipse.viatra.solver.language.solverLanguage.impl.ClassInterpretationImpl#getSymbol Symbol}
* - {@link org.eclipse.viatra.solver.language.solverLanguage.impl.ClassInterpretationImpl#getSupertypes Supertypes}
* - {@link org.eclipse.viatra.solver.language.solverLanguage.impl.ClassInterpretationImpl#getFielt Fielt}
*
*
* @generated
*/
public class ClassInterpretationImpl extends CDInterpretationImpl implements ClassInterpretation
{
/**
* The default value of the '{@link #isAbstract() Abstract}' attribute.
*
*
* @see #isAbstract()
* @generated
* @ordered
*/
protected static final boolean ABSTRACT_EDEFAULT = false;
/**
* The cached value of the '{@link #isAbstract() Abstract}' attribute.
*
*
* @see #isAbstract()
* @generated
* @ordered
*/
protected boolean abstract_ = ABSTRACT_EDEFAULT;
/**
* The cached value of the '{@link #getSymbol() Symbol}' containment reference.
*
*
* @see #getSymbol()
* @generated
* @ordered
*/
protected ModelSymbol symbol;
/**
* The cached value of the '{@link #getSupertypes() Supertypes}' containment reference list.
*
*
* @see #getSupertypes()
* @generated
* @ordered
*/
protected EList supertypes;
/**
* The cached value of the '{@link #getFielt() Fielt}' containment reference list.
*
*
* @see #getFielt()
* @generated
* @ordered
*/
protected EList fielt;
/**
*
*
* @generated
*/
protected ClassInterpretationImpl()
{
super();
}
/**
*
*
* @generated
*/
@Override
protected EClass eStaticClass()
{
return SolverLanguagePackage.Literals.CLASS_INTERPRETATION;
}
/**
*
*
* @generated
*/
@Override
public boolean isAbstract()
{
return abstract_;
}
/**
*
*
* @generated
*/
@Override
public void setAbstract(boolean newAbstract)
{
boolean oldAbstract = abstract_;
abstract_ = newAbstract;
if (eNotificationRequired())
eNotify(new ENotificationImpl(this, Notification.SET, SolverLanguagePackage.CLASS_INTERPRETATION__ABSTRACT, oldAbstract, abstract_));
}
/**
*
*
* @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.CLASS_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.CLASS_INTERPRETATION__SYMBOL, null, msgs);
if (newSymbol != null)
msgs = ((InternalEObject)newSymbol).eInverseAdd(this, EOPPOSITE_FEATURE_BASE - SolverLanguagePackage.CLASS_INTERPRETATION__SYMBOL, null, msgs);
msgs = basicSetSymbol(newSymbol, msgs);
if (msgs != null) msgs.dispatch();
}
else if (eNotificationRequired())
eNotify(new ENotificationImpl(this, Notification.SET, SolverLanguagePackage.CLASS_INTERPRETATION__SYMBOL, newSymbol, newSymbol));
}
/**
*
*
* @generated
*/
@Override
public EList getSupertypes()
{
if (supertypes == null)
{
supertypes = new EObjectContainmentEList(ModelSymbol.class, this, SolverLanguagePackage.CLASS_INTERPRETATION__SUPERTYPES);
}
return supertypes;
}
/**
*
*
* @generated
*/
@Override
public EList getFielt()
{
if (fielt == null)
{
fielt = new EObjectContainmentEList(FieldRelationInterpretation.class, this, SolverLanguagePackage.CLASS_INTERPRETATION__FIELT);
}
return fielt;
}
/**
*
*
* @generated
*/
@Override
public NotificationChain eInverseRemove(InternalEObject otherEnd, int featureID, NotificationChain msgs)
{
switch (featureID)
{
case SolverLanguagePackage.CLASS_INTERPRETATION__SYMBOL:
return basicSetSymbol(null, msgs);
case SolverLanguagePackage.CLASS_INTERPRETATION__SUPERTYPES:
return ((InternalEList>)getSupertypes()).basicRemove(otherEnd, msgs);
case SolverLanguagePackage.CLASS_INTERPRETATION__FIELT:
return ((InternalEList>)getFielt()).basicRemove(otherEnd, msgs);
}
return super.eInverseRemove(otherEnd, featureID, msgs);
}
/**
*
*
* @generated
*/
@Override
public Object eGet(int featureID, boolean resolve, boolean coreType)
{
switch (featureID)
{
case SolverLanguagePackage.CLASS_INTERPRETATION__ABSTRACT:
return isAbstract();
case SolverLanguagePackage.CLASS_INTERPRETATION__SYMBOL:
return getSymbol();
case SolverLanguagePackage.CLASS_INTERPRETATION__SUPERTYPES:
return getSupertypes();
case SolverLanguagePackage.CLASS_INTERPRETATION__FIELT:
return getFielt();
}
return super.eGet(featureID, resolve, coreType);
}
/**
*
*
* @generated
*/
@SuppressWarnings("unchecked")
@Override
public void eSet(int featureID, Object newValue)
{
switch (featureID)
{
case SolverLanguagePackage.CLASS_INTERPRETATION__ABSTRACT:
setAbstract((Boolean)newValue);
return;
case SolverLanguagePackage.CLASS_INTERPRETATION__SYMBOL:
setSymbol((ModelSymbol)newValue);
return;
case SolverLanguagePackage.CLASS_INTERPRETATION__SUPERTYPES:
getSupertypes().clear();
getSupertypes().addAll((Collection extends ModelSymbol>)newValue);
return;
case SolverLanguagePackage.CLASS_INTERPRETATION__FIELT:
getFielt().clear();
getFielt().addAll((Collection extends FieldRelationInterpretation>)newValue);
return;
}
super.eSet(featureID, newValue);
}
/**
*
*
* @generated
*/
@Override
public void eUnset(int featureID)
{
switch (featureID)
{
case SolverLanguagePackage.CLASS_INTERPRETATION__ABSTRACT:
setAbstract(ABSTRACT_EDEFAULT);
return;
case SolverLanguagePackage.CLASS_INTERPRETATION__SYMBOL:
setSymbol((ModelSymbol)null);
return;
case SolverLanguagePackage.CLASS_INTERPRETATION__SUPERTYPES:
getSupertypes().clear();
return;
case SolverLanguagePackage.CLASS_INTERPRETATION__FIELT:
getFielt().clear();
return;
}
super.eUnset(featureID);
}
/**
*
*
* @generated
*/
@Override
public boolean eIsSet(int featureID)
{
switch (featureID)
{
case SolverLanguagePackage.CLASS_INTERPRETATION__ABSTRACT:
return abstract_ != ABSTRACT_EDEFAULT;
case SolverLanguagePackage.CLASS_INTERPRETATION__SYMBOL:
return symbol != null;
case SolverLanguagePackage.CLASS_INTERPRETATION__SUPERTYPES:
return supertypes != null && !supertypes.isEmpty();
case SolverLanguagePackage.CLASS_INTERPRETATION__FIELT:
return fielt != null && !fielt.isEmpty();
}
return super.eIsSet(featureID);
}
/**
*
*
* @generated
*/
@Override
public String toString()
{
if (eIsProxy()) return super.toString();
StringBuilder result = new StringBuilder(super.toString());
result.append(" (abstract: ");
result.append(abstract_);
result.append(')');
return result.toString();
}
} //ClassInterpretationImpl