/**
* generated by Xtext 2.18.0.M3
*/
package org.eclipse.viatra.solver.language.solverLanguage.impl;
import org.eclipse.emf.common.notify.Notification;
import org.eclipse.emf.common.notify.NotificationChain;
import org.eclipse.emf.ecore.EClass;
import org.eclipse.emf.ecore.InternalEObject;
import org.eclipse.emf.ecore.impl.ENotificationImpl;
import org.eclipse.emf.ecore.impl.MinimalEObjectImpl;
import org.eclipse.viatra.solver.language.solverLanguage.FieldRelationInterpretation;
import org.eclipse.viatra.solver.language.solverLanguage.ModelSymbol;
import org.eclipse.viatra.solver.language.solverLanguage.MultiplicityDefinition;
import org.eclipse.viatra.solver.language.solverLanguage.SolverLanguagePackage;
import org.eclipse.viatra.solver.language.solverLanguage.Symbol;
/**
*
* An implementation of the model object 'Field Relation Interpretation'.
*
*
* The following features are implemented:
*
*
* - {@link org.eclipse.viatra.solver.language.solverLanguage.impl.FieldRelationInterpretationImpl#isContainment Containment}
* - {@link org.eclipse.viatra.solver.language.solverLanguage.impl.FieldRelationInterpretationImpl#getSymbol Symbol}
* - {@link org.eclipse.viatra.solver.language.solverLanguage.impl.FieldRelationInterpretationImpl#getMultiplicity Multiplicity}
* - {@link org.eclipse.viatra.solver.language.solverLanguage.impl.FieldRelationInterpretationImpl#getTarget Target}
*
*
* @generated
*/
public class FieldRelationInterpretationImpl extends MinimalEObjectImpl.Container implements FieldRelationInterpretation
{
/**
* The default value of the '{@link #isContainment() Containment}' attribute.
*
*
* @see #isContainment()
* @generated
* @ordered
*/
protected static final boolean CONTAINMENT_EDEFAULT = false;
/**
* The cached value of the '{@link #isContainment() Containment}' attribute.
*
*
* @see #isContainment()
* @generated
* @ordered
*/
protected boolean containment = CONTAINMENT_EDEFAULT;
/**
* The cached value of the '{@link #getSymbol() Symbol}' containment reference.
*
*
* @see #getSymbol()
* @generated
* @ordered
*/
protected ModelSymbol symbol;
/**
* The cached value of the '{@link #getMultiplicity() Multiplicity}' containment reference.
*
*
* @see #getMultiplicity()
* @generated
* @ordered
*/
protected MultiplicityDefinition multiplicity;
/**
* The cached value of the '{@link #getTarget() Target}' containment reference.
*
*
* @see #getTarget()
* @generated
* @ordered
*/
protected Symbol target;
/**
*
*
* @generated
*/
protected FieldRelationInterpretationImpl()
{
super();
}
/**
*
*
* @generated
*/
@Override
protected EClass eStaticClass()
{
return SolverLanguagePackage.Literals.FIELD_RELATION_INTERPRETATION;
}
/**
*
*
* @generated
*/
@Override
public boolean isContainment()
{
return containment;
}
/**
*
*
* @generated
*/
@Override
public void setContainment(boolean newContainment)
{
boolean oldContainment = containment;
containment = newContainment;
if (eNotificationRequired())
eNotify(new ENotificationImpl(this, Notification.SET, SolverLanguagePackage.FIELD_RELATION_INTERPRETATION__CONTAINMENT, oldContainment, containment));
}
/**
*
*
* @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.FIELD_RELATION_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.FIELD_RELATION_INTERPRETATION__SYMBOL, null, msgs);
if (newSymbol != null)
msgs = ((InternalEObject)newSymbol).eInverseAdd(this, EOPPOSITE_FEATURE_BASE - SolverLanguagePackage.FIELD_RELATION_INTERPRETATION__SYMBOL, null, msgs);
msgs = basicSetSymbol(newSymbol, msgs);
if (msgs != null) msgs.dispatch();
}
else if (eNotificationRequired())
eNotify(new ENotificationImpl(this, Notification.SET, SolverLanguagePackage.FIELD_RELATION_INTERPRETATION__SYMBOL, newSymbol, newSymbol));
}
/**
*
*
* @generated
*/
@Override
public MultiplicityDefinition getMultiplicity()
{
return multiplicity;
}
/**
*
*
* @generated
*/
public NotificationChain basicSetMultiplicity(MultiplicityDefinition newMultiplicity, NotificationChain msgs)
{
MultiplicityDefinition oldMultiplicity = multiplicity;
multiplicity = newMultiplicity;
if (eNotificationRequired())
{
ENotificationImpl notification = new ENotificationImpl(this, Notification.SET, SolverLanguagePackage.FIELD_RELATION_INTERPRETATION__MULTIPLICITY, oldMultiplicity, newMultiplicity);
if (msgs == null) msgs = notification; else msgs.add(notification);
}
return msgs;
}
/**
*
*
* @generated
*/
@Override
public void setMultiplicity(MultiplicityDefinition newMultiplicity)
{
if (newMultiplicity != multiplicity)
{
NotificationChain msgs = null;
if (multiplicity != null)
msgs = ((InternalEObject)multiplicity).eInverseRemove(this, EOPPOSITE_FEATURE_BASE - SolverLanguagePackage.FIELD_RELATION_INTERPRETATION__MULTIPLICITY, null, msgs);
if (newMultiplicity != null)
msgs = ((InternalEObject)newMultiplicity).eInverseAdd(this, EOPPOSITE_FEATURE_BASE - SolverLanguagePackage.FIELD_RELATION_INTERPRETATION__MULTIPLICITY, null, msgs);
msgs = basicSetMultiplicity(newMultiplicity, msgs);
if (msgs != null) msgs.dispatch();
}
else if (eNotificationRequired())
eNotify(new ENotificationImpl(this, Notification.SET, SolverLanguagePackage.FIELD_RELATION_INTERPRETATION__MULTIPLICITY, newMultiplicity, newMultiplicity));
}
/**
*
*
* @generated
*/
@Override
public Symbol getTarget()
{
return target;
}
/**
*
*
* @generated
*/
public NotificationChain basicSetTarget(Symbol newTarget, NotificationChain msgs)
{
Symbol oldTarget = target;
target = newTarget;
if (eNotificationRequired())
{
ENotificationImpl notification = new ENotificationImpl(this, Notification.SET, SolverLanguagePackage.FIELD_RELATION_INTERPRETATION__TARGET, oldTarget, newTarget);
if (msgs == null) msgs = notification; else msgs.add(notification);
}
return msgs;
}
/**
*
*
* @generated
*/
@Override
public void setTarget(Symbol newTarget)
{
if (newTarget != target)
{
NotificationChain msgs = null;
if (target != null)
msgs = ((InternalEObject)target).eInverseRemove(this, EOPPOSITE_FEATURE_BASE - SolverLanguagePackage.FIELD_RELATION_INTERPRETATION__TARGET, null, msgs);
if (newTarget != null)
msgs = ((InternalEObject)newTarget).eInverseAdd(this, EOPPOSITE_FEATURE_BASE - SolverLanguagePackage.FIELD_RELATION_INTERPRETATION__TARGET, null, msgs);
msgs = basicSetTarget(newTarget, msgs);
if (msgs != null) msgs.dispatch();
}
else if (eNotificationRequired())
eNotify(new ENotificationImpl(this, Notification.SET, SolverLanguagePackage.FIELD_RELATION_INTERPRETATION__TARGET, newTarget, newTarget));
}
/**
*
*
* @generated
*/
@Override
public NotificationChain eInverseRemove(InternalEObject otherEnd, int featureID, NotificationChain msgs)
{
switch (featureID)
{
case SolverLanguagePackage.FIELD_RELATION_INTERPRETATION__SYMBOL:
return basicSetSymbol(null, msgs);
case SolverLanguagePackage.FIELD_RELATION_INTERPRETATION__MULTIPLICITY:
return basicSetMultiplicity(null, msgs);
case SolverLanguagePackage.FIELD_RELATION_INTERPRETATION__TARGET:
return basicSetTarget(null, msgs);
}
return super.eInverseRemove(otherEnd, featureID, msgs);
}
/**
*
*
* @generated
*/
@Override
public Object eGet(int featureID, boolean resolve, boolean coreType)
{
switch (featureID)
{
case SolverLanguagePackage.FIELD_RELATION_INTERPRETATION__CONTAINMENT:
return isContainment();
case SolverLanguagePackage.FIELD_RELATION_INTERPRETATION__SYMBOL:
return getSymbol();
case SolverLanguagePackage.FIELD_RELATION_INTERPRETATION__MULTIPLICITY:
return getMultiplicity();
case SolverLanguagePackage.FIELD_RELATION_INTERPRETATION__TARGET:
return getTarget();
}
return super.eGet(featureID, resolve, coreType);
}
/**
*
*
* @generated
*/
@Override
public void eSet(int featureID, Object newValue)
{
switch (featureID)
{
case SolverLanguagePackage.FIELD_RELATION_INTERPRETATION__CONTAINMENT:
setContainment((Boolean)newValue);
return;
case SolverLanguagePackage.FIELD_RELATION_INTERPRETATION__SYMBOL:
setSymbol((ModelSymbol)newValue);
return;
case SolverLanguagePackage.FIELD_RELATION_INTERPRETATION__MULTIPLICITY:
setMultiplicity((MultiplicityDefinition)newValue);
return;
case SolverLanguagePackage.FIELD_RELATION_INTERPRETATION__TARGET:
setTarget((Symbol)newValue);
return;
}
super.eSet(featureID, newValue);
}
/**
*
*
* @generated
*/
@Override
public void eUnset(int featureID)
{
switch (featureID)
{
case SolverLanguagePackage.FIELD_RELATION_INTERPRETATION__CONTAINMENT:
setContainment(CONTAINMENT_EDEFAULT);
return;
case SolverLanguagePackage.FIELD_RELATION_INTERPRETATION__SYMBOL:
setSymbol((ModelSymbol)null);
return;
case SolverLanguagePackage.FIELD_RELATION_INTERPRETATION__MULTIPLICITY:
setMultiplicity((MultiplicityDefinition)null);
return;
case SolverLanguagePackage.FIELD_RELATION_INTERPRETATION__TARGET:
setTarget((Symbol)null);
return;
}
super.eUnset(featureID);
}
/**
*
*
* @generated
*/
@Override
public boolean eIsSet(int featureID)
{
switch (featureID)
{
case SolverLanguagePackage.FIELD_RELATION_INTERPRETATION__CONTAINMENT:
return containment != CONTAINMENT_EDEFAULT;
case SolverLanguagePackage.FIELD_RELATION_INTERPRETATION__SYMBOL:
return symbol != null;
case SolverLanguagePackage.FIELD_RELATION_INTERPRETATION__MULTIPLICITY:
return multiplicity != null;
case SolverLanguagePackage.FIELD_RELATION_INTERPRETATION__TARGET:
return target != null;
}
return super.eIsSet(featureID);
}
/**
*
*
* @generated
*/
@Override
public String toString()
{
if (eIsProxy()) return super.toString();
StringBuilder result = new StringBuilder(super.toString());
result.append(" (containment: ");
result.append(containment);
result.append(')');
return result.toString();
}
} //FieldRelationInterpretationImpl