/** */ package fr.inria.diverse.minilang.impl; import fr.inria.diverse.minilang.BooleanAssignment; import fr.inria.diverse.minilang.BooleanExpression; import fr.inria.diverse.minilang.BooleanVariableRef; import fr.inria.diverse.minilang.MinilangPackage; 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; /** * <!-- begin-user-doc --> * An implementation of the model object '<em><b>Boolean Assignment</b></em>'. * <!-- end-user-doc --> * <p> * The following features are implemented: * </p> * <ul> * <li>{@link fr.inria.diverse.minilang.impl.BooleanAssignmentImpl#getVariable <em>Variable</em>}</li> * <li>{@link fr.inria.diverse.minilang.impl.BooleanAssignmentImpl#getValue <em>Value</em>}</li> * </ul> * * @generated */ public class BooleanAssignmentImpl extends StatementImpl implements BooleanAssignment { /** * The cached value of the '{@link #getVariable() <em>Variable</em>}' containment reference. * <!-- begin-user-doc --> * <!-- end-user-doc --> * @see #getVariable() * @generated * @ordered */ protected BooleanVariableRef variable; /** * The cached value of the '{@link #getValue() <em>Value</em>}' containment reference. * <!-- begin-user-doc --> * <!-- end-user-doc --> * @see #getValue() * @generated * @ordered */ protected BooleanExpression value; /** * <!-- begin-user-doc --> * <!-- end-user-doc --> * @generated */ protected BooleanAssignmentImpl() { super(); } /** * <!-- begin-user-doc --> * <!-- end-user-doc --> * @generated */ @Override protected EClass eStaticClass() { return MinilangPackage.Literals.BOOLEAN_ASSIGNMENT; } /** * <!-- begin-user-doc --> * <!-- end-user-doc --> * @generated */ public BooleanVariableRef getVariable() { return variable; } /** * <!-- begin-user-doc --> * <!-- end-user-doc --> * @generated */ public NotificationChain basicSetVariable(BooleanVariableRef newVariable, NotificationChain msgs) { BooleanVariableRef oldVariable = variable; variable = newVariable; if (eNotificationRequired()) { ENotificationImpl notification = new ENotificationImpl(this, Notification.SET, MinilangPackage.BOOLEAN_ASSIGNMENT__VARIABLE, oldVariable, newVariable); if (msgs == null) msgs = notification; else msgs.add(notification); } return msgs; } /** * <!-- begin-user-doc --> * <!-- end-user-doc --> * @generated */ public void setVariable(BooleanVariableRef newVariable) { if (newVariable != variable) { NotificationChain msgs = null; if (variable != null) msgs = ((InternalEObject)variable).eInverseRemove(this, EOPPOSITE_FEATURE_BASE - MinilangPackage.BOOLEAN_ASSIGNMENT__VARIABLE, null, msgs); if (newVariable != null) msgs = ((InternalEObject)newVariable).eInverseAdd(this, EOPPOSITE_FEATURE_BASE - MinilangPackage.BOOLEAN_ASSIGNMENT__VARIABLE, null, msgs); msgs = basicSetVariable(newVariable, msgs); if (msgs != null) msgs.dispatch(); } else if (eNotificationRequired()) eNotify(new ENotificationImpl(this, Notification.SET, MinilangPackage.BOOLEAN_ASSIGNMENT__VARIABLE, newVariable, newVariable)); } /** * <!-- begin-user-doc --> * <!-- end-user-doc --> * @generated */ public BooleanExpression getValue() { return value; } /** * <!-- begin-user-doc --> * <!-- end-user-doc --> * @generated */ public NotificationChain basicSetValue(BooleanExpression newValue, NotificationChain msgs) { BooleanExpression oldValue = value; value = newValue; if (eNotificationRequired()) { ENotificationImpl notification = new ENotificationImpl(this, Notification.SET, MinilangPackage.BOOLEAN_ASSIGNMENT__VALUE, oldValue, newValue); if (msgs == null) msgs = notification; else msgs.add(notification); } return msgs; } /** * <!-- begin-user-doc --> * <!-- end-user-doc --> * @generated */ public void setValue(BooleanExpression newValue) { if (newValue != value) { NotificationChain msgs = null; if (value != null) msgs = ((InternalEObject)value).eInverseRemove(this, EOPPOSITE_FEATURE_BASE - MinilangPackage.BOOLEAN_ASSIGNMENT__VALUE, null, msgs); if (newValue != null) msgs = ((InternalEObject)newValue).eInverseAdd(this, EOPPOSITE_FEATURE_BASE - MinilangPackage.BOOLEAN_ASSIGNMENT__VALUE, null, msgs); msgs = basicSetValue(newValue, msgs); if (msgs != null) msgs.dispatch(); } else if (eNotificationRequired()) eNotify(new ENotificationImpl(this, Notification.SET, MinilangPackage.BOOLEAN_ASSIGNMENT__VALUE, newValue, newValue)); } /** * <!-- begin-user-doc --> * <!-- end-user-doc --> * @generated */ @Override public NotificationChain eInverseRemove(InternalEObject otherEnd, int featureID, NotificationChain msgs) { switch (featureID) { case MinilangPackage.BOOLEAN_ASSIGNMENT__VARIABLE: return basicSetVariable(null, msgs); case MinilangPackage.BOOLEAN_ASSIGNMENT__VALUE: return basicSetValue(null, msgs); } return super.eInverseRemove(otherEnd, featureID, msgs); } /** * <!-- begin-user-doc --> * <!-- end-user-doc --> * @generated */ @Override public Object eGet(int featureID, boolean resolve, boolean coreType) { switch (featureID) { case MinilangPackage.BOOLEAN_ASSIGNMENT__VARIABLE: return getVariable(); case MinilangPackage.BOOLEAN_ASSIGNMENT__VALUE: return getValue(); } return super.eGet(featureID, resolve, coreType); } /** * <!-- begin-user-doc --> * <!-- end-user-doc --> * @generated */ @Override public void eSet(int featureID, Object newValue) { switch (featureID) { case MinilangPackage.BOOLEAN_ASSIGNMENT__VARIABLE: setVariable((BooleanVariableRef)newValue); return; case MinilangPackage.BOOLEAN_ASSIGNMENT__VALUE: setValue((BooleanExpression)newValue); return; } super.eSet(featureID, newValue); } /** * <!-- begin-user-doc --> * <!-- end-user-doc --> * @generated */ @Override public void eUnset(int featureID) { switch (featureID) { case MinilangPackage.BOOLEAN_ASSIGNMENT__VARIABLE: setVariable((BooleanVariableRef)null); return; case MinilangPackage.BOOLEAN_ASSIGNMENT__VALUE: setValue((BooleanExpression)null); return; } super.eUnset(featureID); } /** * <!-- begin-user-doc --> * <!-- end-user-doc --> * @generated */ @Override public boolean eIsSet(int featureID) { switch (featureID) { case MinilangPackage.BOOLEAN_ASSIGNMENT__VARIABLE: return variable != null; case MinilangPackage.BOOLEAN_ASSIGNMENT__VALUE: return value != null; } return super.eIsSet(featureID); } } //BooleanAssignmentImpl