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