/**
* generated by Xtext 2.21.0
*/
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.Expression;
import org.eclipse.viatra.solver.language.solverLanguage.LetBinding;
import org.eclipse.viatra.solver.language.solverLanguage.NamedElement;
import org.eclipse.viatra.solver.language.solverLanguage.SolverLanguagePackage;
/**
*
* An implementation of the model object 'Let Binding'.
*
*
* The following features are implemented:
*
*
* - {@link org.eclipse.viatra.solver.language.solverLanguage.impl.LetBindingImpl#getVariable Variable}
* - {@link org.eclipse.viatra.solver.language.solverLanguage.impl.LetBindingImpl#getValue Value}
*
*
* @generated
*/
public class LetBindingImpl extends MinimalEObjectImpl.Container implements LetBinding {
/**
* The cached value of the '{@link #getVariable() Variable}' containment reference.
*
*
* @see #getVariable()
* @generated
* @ordered
*/
protected NamedElement variable;
/**
* The cached value of the '{@link #getValue() Value}' containment reference.
*
*
* @see #getValue()
* @generated
* @ordered
*/
protected Expression value;
/**
*
*
* @generated
*/
protected LetBindingImpl() {
super();
}
/**
*
*
* @generated
*/
@Override
protected EClass eStaticClass() {
return SolverLanguagePackage.Literals.LET_BINDING;
}
/**
*
*
* @generated
*/
@Override
public NamedElement getVariable() {
return variable;
}
/**
*
*
* @generated
*/
public NotificationChain basicSetVariable(NamedElement newVariable, NotificationChain msgs) {
NamedElement oldVariable = variable;
variable = newVariable;
if (eNotificationRequired()) {
ENotificationImpl notification = new ENotificationImpl(this, Notification.SET, SolverLanguagePackage.LET_BINDING__VARIABLE, oldVariable, newVariable);
if (msgs == null) msgs = notification; else msgs.add(notification);
}
return msgs;
}
/**
*
*
* @generated
*/
@Override
public void setVariable(NamedElement newVariable) {
if (newVariable != variable) {
NotificationChain msgs = null;
if (variable != null)
msgs = ((InternalEObject)variable).eInverseRemove(this, EOPPOSITE_FEATURE_BASE - SolverLanguagePackage.LET_BINDING__VARIABLE, null, msgs);
if (newVariable != null)
msgs = ((InternalEObject)newVariable).eInverseAdd(this, EOPPOSITE_FEATURE_BASE - SolverLanguagePackage.LET_BINDING__VARIABLE, null, msgs);
msgs = basicSetVariable(newVariable, msgs);
if (msgs != null) msgs.dispatch();
}
else if (eNotificationRequired())
eNotify(new ENotificationImpl(this, Notification.SET, SolverLanguagePackage.LET_BINDING__VARIABLE, newVariable, newVariable));
}
/**
*
*
* @generated
*/
@Override
public Expression getValue() {
return value;
}
/**
*
*
* @generated
*/
public NotificationChain basicSetValue(Expression newValue, NotificationChain msgs) {
Expression oldValue = value;
value = newValue;
if (eNotificationRequired()) {
ENotificationImpl notification = new ENotificationImpl(this, Notification.SET, SolverLanguagePackage.LET_BINDING__VALUE, oldValue, newValue);
if (msgs == null) msgs = notification; else msgs.add(notification);
}
return msgs;
}
/**
*
*
* @generated
*/
@Override
public void setValue(Expression newValue) {
if (newValue != value) {
NotificationChain msgs = null;
if (value != null)
msgs = ((InternalEObject)value).eInverseRemove(this, EOPPOSITE_FEATURE_BASE - SolverLanguagePackage.LET_BINDING__VALUE, null, msgs);
if (newValue != null)
msgs = ((InternalEObject)newValue).eInverseAdd(this, EOPPOSITE_FEATURE_BASE - SolverLanguagePackage.LET_BINDING__VALUE, null, msgs);
msgs = basicSetValue(newValue, msgs);
if (msgs != null) msgs.dispatch();
}
else if (eNotificationRequired())
eNotify(new ENotificationImpl(this, Notification.SET, SolverLanguagePackage.LET_BINDING__VALUE, newValue, newValue));
}
/**
*
*
* @generated
*/
@Override
public NotificationChain eInverseRemove(InternalEObject otherEnd, int featureID, NotificationChain msgs) {
switch (featureID) {
case SolverLanguagePackage.LET_BINDING__VARIABLE:
return basicSetVariable(null, msgs);
case SolverLanguagePackage.LET_BINDING__VALUE:
return basicSetValue(null, msgs);
}
return super.eInverseRemove(otherEnd, featureID, msgs);
}
/**
*
*
* @generated
*/
@Override
public Object eGet(int featureID, boolean resolve, boolean coreType) {
switch (featureID) {
case SolverLanguagePackage.LET_BINDING__VARIABLE:
return getVariable();
case SolverLanguagePackage.LET_BINDING__VALUE:
return getValue();
}
return super.eGet(featureID, resolve, coreType);
}
/**
*
*
* @generated
*/
@Override
public void eSet(int featureID, Object newValue) {
switch (featureID) {
case SolverLanguagePackage.LET_BINDING__VARIABLE:
setVariable((NamedElement)newValue);
return;
case SolverLanguagePackage.LET_BINDING__VALUE:
setValue((Expression)newValue);
return;
}
super.eSet(featureID, newValue);
}
/**
*
*
* @generated
*/
@Override
public void eUnset(int featureID) {
switch (featureID) {
case SolverLanguagePackage.LET_BINDING__VARIABLE:
setVariable((NamedElement)null);
return;
case SolverLanguagePackage.LET_BINDING__VALUE:
setValue((Expression)null);
return;
}
super.eUnset(featureID);
}
/**
*
*
* @generated
*/
@Override
public boolean eIsSet(int featureID) {
switch (featureID) {
case SolverLanguagePackage.LET_BINDING__VARIABLE:
return variable != null;
case SolverLanguagePackage.LET_BINDING__VALUE:
return value != null;
}
return super.eIsSet(featureID);
}
} //LetBindingImpl