/**
* <copyright>
* </copyright>
*
* $Id$
*/
package net.sf.orcc.ir.impl;
import net.sf.orcc.ir.ExprVar;
import net.sf.orcc.ir.IrPackage;
import net.sf.orcc.ir.Type;
import net.sf.orcc.ir.Use;
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>Expr Var</b></em>'. <!-- end-user-doc -->
* <p>
* The following features are implemented:
* <ul>
* <li>{@link net.sf.orcc.ir.impl.ExprVarImpl#getUse <em>Use</em>}</li>
* </ul>
* </p>
*
* @generated
*/
public class ExprVarImpl extends ExpressionImpl implements ExprVar {
/**
* The cached value of the '{@link #getUse() <em>Use</em>}' containment reference.
* <!-- begin-user-doc --> <!-- end-user-doc -->
* @see #getUse()
* @generated
* @ordered
*/
protected Use use;
/**
* <!-- begin-user-doc --> <!-- end-user-doc -->
* @generated
*/
protected ExprVarImpl() {
super();
}
/**
* <!-- begin-user-doc --> <!-- end-user-doc -->
* @generated
*/
public NotificationChain basicSetUse(Use newUse, NotificationChain msgs) {
Use oldUse = use;
use = newUse;
if (eNotificationRequired()) {
ENotificationImpl notification = new ENotificationImpl(this,
Notification.SET, IrPackage.EXPR_VAR__USE, oldUse, newUse);
if (msgs == null)
msgs = notification;
else
msgs.add(notification);
}
return msgs;
}
/**
* <!-- begin-user-doc --> <!-- end-user-doc -->
* @generated
*/
@Override
public Object eGet(int featureID, boolean resolve, boolean coreType) {
switch (featureID) {
case IrPackage.EXPR_VAR__USE:
return getUse();
}
return super.eGet(featureID, resolve, coreType);
}
/**
* <!-- begin-user-doc --> <!-- end-user-doc -->
* @generated
*/
@Override
public NotificationChain eInverseRemove(InternalEObject otherEnd,
int featureID, NotificationChain msgs) {
switch (featureID) {
case IrPackage.EXPR_VAR__USE:
return basicSetUse(null, msgs);
}
return super.eInverseRemove(otherEnd, featureID, msgs);
}
/**
* <!-- begin-user-doc --> <!-- end-user-doc -->
* @generated
*/
@Override
public boolean eIsSet(int featureID) {
switch (featureID) {
case IrPackage.EXPR_VAR__USE:
return use != null;
}
return super.eIsSet(featureID);
}
/**
* <!-- begin-user-doc --> <!-- end-user-doc -->
* @generated
*/
@Override
public void eSet(int featureID, Object newValue) {
switch (featureID) {
case IrPackage.EXPR_VAR__USE:
setUse((Use) newValue);
return;
}
super.eSet(featureID, newValue);
}
/**
* <!-- begin-user-doc --> <!-- end-user-doc -->
* @generated
*/
@Override
protected EClass eStaticClass() {
return IrPackage.Literals.EXPR_VAR;
}
/**
* <!-- begin-user-doc --> <!-- end-user-doc -->
* @generated
*/
@Override
public void eUnset(int featureID) {
switch (featureID) {
case IrPackage.EXPR_VAR__USE:
setUse((Use) null);
return;
}
super.eUnset(featureID);
}
@Override
public Type getType() {
return use.getVariable().getType();
}
/**
* <!-- begin-user-doc --> <!-- end-user-doc -->
* @generated
*/
public Use getUse() {
return use;
}
@Override
public boolean isExprVar() {
return true;
}
/**
* <!-- begin-user-doc --> <!-- end-user-doc -->
* @generated
*/
public void setUse(Use newUse) {
if (newUse != use) {
NotificationChain msgs = null;
if (use != null)
msgs = ((InternalEObject) use).eInverseRemove(this,
EOPPOSITE_FEATURE_BASE - IrPackage.EXPR_VAR__USE, null,
msgs);
if (newUse != null)
msgs = ((InternalEObject) newUse).eInverseAdd(this,
EOPPOSITE_FEATURE_BASE - IrPackage.EXPR_VAR__USE, null,
msgs);
msgs = basicSetUse(newUse, msgs);
if (msgs != null)
msgs.dispatch();
} else if (eNotificationRequired())
eNotify(new ENotificationImpl(this, Notification.SET,
IrPackage.EXPR_VAR__USE, newUse, newUse));
}
} // ExprVarImpl