/**
* 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.Parameter;
import org.eclipse.viatra.solver.language.solverLanguage.SolverLanguagePackage;
import org.eclipse.viatra.solver.language.solverLanguage.Symbol;
import org.eclipse.viatra.solver.language.solverLanguage.Variable;
/**
*
* An implementation of the model object 'Parameter'.
*
*
* The following features are implemented:
*
*
* - {@link org.eclipse.viatra.solver.language.solverLanguage.impl.ParameterImpl#getVariable Variable}
* - {@link org.eclipse.viatra.solver.language.solverLanguage.impl.ParameterImpl#getType Type}
*
*
* @generated
*/
public class ParameterImpl extends MinimalEObjectImpl.Container implements Parameter
{
/**
* The cached value of the '{@link #getVariable() Variable}' containment reference.
*
*
* @see #getVariable()
* @generated
* @ordered
*/
protected Variable variable;
/**
* The cached value of the '{@link #getType() Type}' containment reference.
*
*
* @see #getType()
* @generated
* @ordered
*/
protected Symbol type;
/**
*
*
* @generated
*/
protected ParameterImpl()
{
super();
}
/**
*
*
* @generated
*/
@Override
protected EClass eStaticClass()
{
return SolverLanguagePackage.Literals.PARAMETER;
}
/**
*
*
* @generated
*/
@Override
public Variable getVariable()
{
return variable;
}
/**
*
*
* @generated
*/
public NotificationChain basicSetVariable(Variable newVariable, NotificationChain msgs)
{
Variable oldVariable = variable;
variable = newVariable;
if (eNotificationRequired())
{
ENotificationImpl notification = new ENotificationImpl(this, Notification.SET, SolverLanguagePackage.PARAMETER__VARIABLE, oldVariable, newVariable);
if (msgs == null) msgs = notification; else msgs.add(notification);
}
return msgs;
}
/**
*
*
* @generated
*/
@Override
public void setVariable(Variable newVariable)
{
if (newVariable != variable)
{
NotificationChain msgs = null;
if (variable != null)
msgs = ((InternalEObject)variable).eInverseRemove(this, EOPPOSITE_FEATURE_BASE - SolverLanguagePackage.PARAMETER__VARIABLE, null, msgs);
if (newVariable != null)
msgs = ((InternalEObject)newVariable).eInverseAdd(this, EOPPOSITE_FEATURE_BASE - SolverLanguagePackage.PARAMETER__VARIABLE, null, msgs);
msgs = basicSetVariable(newVariable, msgs);
if (msgs != null) msgs.dispatch();
}
else if (eNotificationRequired())
eNotify(new ENotificationImpl(this, Notification.SET, SolverLanguagePackage.PARAMETER__VARIABLE, newVariable, newVariable));
}
/**
*
*
* @generated
*/
@Override
public Symbol getType()
{
return type;
}
/**
*
*
* @generated
*/
public NotificationChain basicSetType(Symbol newType, NotificationChain msgs)
{
Symbol oldType = type;
type = newType;
if (eNotificationRequired())
{
ENotificationImpl notification = new ENotificationImpl(this, Notification.SET, SolverLanguagePackage.PARAMETER__TYPE, oldType, newType);
if (msgs == null) msgs = notification; else msgs.add(notification);
}
return msgs;
}
/**
*
*
* @generated
*/
@Override
public void setType(Symbol newType)
{
if (newType != type)
{
NotificationChain msgs = null;
if (type != null)
msgs = ((InternalEObject)type).eInverseRemove(this, EOPPOSITE_FEATURE_BASE - SolverLanguagePackage.PARAMETER__TYPE, null, msgs);
if (newType != null)
msgs = ((InternalEObject)newType).eInverseAdd(this, EOPPOSITE_FEATURE_BASE - SolverLanguagePackage.PARAMETER__TYPE, null, msgs);
msgs = basicSetType(newType, msgs);
if (msgs != null) msgs.dispatch();
}
else if (eNotificationRequired())
eNotify(new ENotificationImpl(this, Notification.SET, SolverLanguagePackage.PARAMETER__TYPE, newType, newType));
}
/**
*
*
* @generated
*/
@Override
public NotificationChain eInverseRemove(InternalEObject otherEnd, int featureID, NotificationChain msgs)
{
switch (featureID)
{
case SolverLanguagePackage.PARAMETER__VARIABLE:
return basicSetVariable(null, msgs);
case SolverLanguagePackage.PARAMETER__TYPE:
return basicSetType(null, msgs);
}
return super.eInverseRemove(otherEnd, featureID, msgs);
}
/**
*
*
* @generated
*/
@Override
public Object eGet(int featureID, boolean resolve, boolean coreType)
{
switch (featureID)
{
case SolverLanguagePackage.PARAMETER__VARIABLE:
return getVariable();
case SolverLanguagePackage.PARAMETER__TYPE:
return getType();
}
return super.eGet(featureID, resolve, coreType);
}
/**
*
*
* @generated
*/
@Override
public void eSet(int featureID, Object newValue)
{
switch (featureID)
{
case SolverLanguagePackage.PARAMETER__VARIABLE:
setVariable((Variable)newValue);
return;
case SolverLanguagePackage.PARAMETER__TYPE:
setType((Symbol)newValue);
return;
}
super.eSet(featureID, newValue);
}
/**
*
*
* @generated
*/
@Override
public void eUnset(int featureID)
{
switch (featureID)
{
case SolverLanguagePackage.PARAMETER__VARIABLE:
setVariable((Variable)null);
return;
case SolverLanguagePackage.PARAMETER__TYPE:
setType((Symbol)null);
return;
}
super.eUnset(featureID);
}
/**
*
*
* @generated
*/
@Override
public boolean eIsSet(int featureID)
{
switch (featureID)
{
case SolverLanguagePackage.PARAMETER__VARIABLE:
return variable != null;
case SolverLanguagePackage.PARAMETER__TYPE:
return type != null;
}
return super.eIsSet(featureID);
}
} //ParameterImpl