/** */ 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.SolverLanguagePackage; import org.eclipse.viatra.solver.language.solverLanguage.Symbol; import org.eclipse.viatra.solver.language.solverLanguage.Variable; /** * * An implementation of the model object 'Let Binding'. * *

* The following features are implemented: *

* * * @generated */ public class LetBindingImpl extends MinimalEObjectImpl.Container implements LetBinding { /** * The cached value of the '{@link #getValue() Value}' containment reference. * * * @see #getValue() * @generated * @ordered */ protected Expression value; /** * The cached value of the '{@link #getVariable() Variable}' containment reference. * * * @see #getVariable() * @generated * @ordered */ protected Variable variable; /** * The default value of the '{@link #getName() Name}' attribute. * * * @see #getName() * @generated * @ordered */ protected static final String NAME_EDEFAULT = null; /** * The cached value of the '{@link #getName() Name}' attribute. * * * @see #getName() * @generated * @ordered */ protected String name = NAME_EDEFAULT; /** * The cached value of the '{@link #getType() Type}' reference. * * * @see #getType() * @generated * @ordered */ protected Symbol type; /** * * * @generated */ protected LetBindingImpl() { super(); } /** * * * @generated */ @Override protected EClass eStaticClass() { return SolverLanguagePackage.Literals.LET_BINDING; } /** * * * @generated */ 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 */ 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 */ 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.LET_BINDING__VARIABLE, oldVariable, newVariable); if (msgs == null) msgs = notification; else msgs.add(notification); } return msgs; } /** * * * @generated */ public void setVariable(Variable 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 */ public String getName() { return name; } /** * * * @generated */ public void setName(String newName) { String oldName = name; name = newName; if (eNotificationRequired()) eNotify(new ENotificationImpl(this, Notification.SET, SolverLanguagePackage.LET_BINDING__NAME, oldName, name)); } /** * * * @generated */ public Symbol getType() { if (type != null && type.eIsProxy()) { InternalEObject oldType = (InternalEObject) type; type = (Symbol) eResolveProxy(oldType); if (type != oldType) { if (eNotificationRequired()) eNotify(new ENotificationImpl(this, Notification.RESOLVE, SolverLanguagePackage.LET_BINDING__TYPE, oldType, type)); } } return type; } /** * * * @generated */ public Symbol basicGetType() { return type; } /** * * * @generated */ public void setType(Symbol newType) { Symbol oldType = type; type = newType; if (eNotificationRequired()) eNotify(new ENotificationImpl(this, Notification.SET, SolverLanguagePackage.LET_BINDING__TYPE, oldType, type)); } /** * * * @generated */ @Override public NotificationChain eInverseRemove(InternalEObject otherEnd, int featureID, NotificationChain msgs) { switch (featureID) { case SolverLanguagePackage.LET_BINDING__VALUE: return basicSetValue(null, msgs); case SolverLanguagePackage.LET_BINDING__VARIABLE: return basicSetVariable(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__VALUE: return getValue(); case SolverLanguagePackage.LET_BINDING__VARIABLE: return getVariable(); case SolverLanguagePackage.LET_BINDING__NAME: return getName(); case SolverLanguagePackage.LET_BINDING__TYPE: if (resolve) return getType(); return basicGetType(); } return super.eGet(featureID, resolve, coreType); } /** * * * @generated */ @Override public void eSet(int featureID, Object newValue) { switch (featureID) { case SolverLanguagePackage.LET_BINDING__VALUE: setValue((Expression) newValue); return; case SolverLanguagePackage.LET_BINDING__VARIABLE: setVariable((Variable) newValue); return; case SolverLanguagePackage.LET_BINDING__NAME: setName((String) newValue); return; case SolverLanguagePackage.LET_BINDING__TYPE: setType((Symbol) newValue); return; } super.eSet(featureID, newValue); } /** * * * @generated */ @Override public void eUnset(int featureID) { switch (featureID) { case SolverLanguagePackage.LET_BINDING__VALUE: setValue((Expression) null); return; case SolverLanguagePackage.LET_BINDING__VARIABLE: setVariable((Variable) null); return; case SolverLanguagePackage.LET_BINDING__NAME: setName(NAME_EDEFAULT); return; case SolverLanguagePackage.LET_BINDING__TYPE: setType((Symbol) null); return; } super.eUnset(featureID); } /** * * * @generated */ @Override public boolean eIsSet(int featureID) { switch (featureID) { case SolverLanguagePackage.LET_BINDING__VALUE: return value != null; case SolverLanguagePackage.LET_BINDING__VARIABLE: return variable != null; case SolverLanguagePackage.LET_BINDING__NAME: return NAME_EDEFAULT == null ? name != null : !NAME_EDEFAULT.equals(name); case SolverLanguagePackage.LET_BINDING__TYPE: return type != null; } return super.eIsSet(featureID); } /** * * * @generated */ @Override public String toString() { if (eIsProxy()) return super.toString(); StringBuilder result = new StringBuilder(super.toString()); result.append(" (name: "); result.append(name); result.append(')'); return result.toString(); } } //LetBindingImpl