/**
* <copyright>
* </copyright>
*
* $Id$
*/
package net.sf.orcc.ir.impl;
import net.sf.orcc.ir.IrPackage;
import net.sf.orcc.ir.Param;
import net.sf.orcc.ir.Var;
import net.sf.orcc.util.impl.AttributableImpl;
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>Param</b></em>'.
* <!-- end-user-doc -->
* <p>
* The following features are implemented:
* <ul>
* <li>{@link net.sf.orcc.ir.impl.ParamImpl#getVariable <em>Variable</em>}</li>
* <li>{@link net.sf.orcc.ir.impl.ParamImpl#isByRef <em>By Ref</em>}</li>
* </ul>
* </p>
*
* @generated
*/
public class ParamImpl extends AttributableImpl implements Param {
/**
* The cached value of the '{@link #getVariable() <em>Variable</em>}' containment reference.
* <!-- begin-user-doc -->
* <!-- end-user-doc -->
* @see #getVariable()
* @generated
* @ordered
*/
protected Var variable;
/**
* The default value of the '{@link #isByRef() <em>By Ref</em>}' attribute.
* <!-- begin-user-doc -->
* <!-- end-user-doc -->
* @see #isByRef()
* @generated
* @ordered
*/
protected static final boolean BY_REF_EDEFAULT = false;
/**
* The cached value of the '{@link #isByRef() <em>By Ref</em>}' attribute.
* <!-- begin-user-doc -->
* <!-- end-user-doc -->
* @see #isByRef()
* @generated
* @ordered
*/
protected boolean byRef = BY_REF_EDEFAULT;
/**
* <!-- begin-user-doc -->
* <!-- end-user-doc -->
* @generated
*/
protected ParamImpl() {
super();
}
/**
* <!-- begin-user-doc -->
* <!-- end-user-doc -->
* @generated
*/
@Override
protected EClass eStaticClass() {
return IrPackage.Literals.PARAM;
}
/**
* <!-- begin-user-doc -->
* <!-- end-user-doc -->
* @generated
*/
public Var getVariable() {
return variable;
}
/**
* <!-- begin-user-doc -->
* <!-- end-user-doc -->
* @generated
*/
public NotificationChain basicSetVariable(Var newVariable,
NotificationChain msgs) {
Var oldVariable = variable;
variable = newVariable;
if (eNotificationRequired()) {
ENotificationImpl notification = new ENotificationImpl(this,
Notification.SET, IrPackage.PARAM__VARIABLE, oldVariable,
newVariable);
if (msgs == null)
msgs = notification;
else
msgs.add(notification);
}
return msgs;
}
/**
* <!-- begin-user-doc -->
* <!-- end-user-doc -->
* @generated
*/
public void setVariable(Var newVariable) {
if (newVariable != variable) {
NotificationChain msgs = null;
if (variable != null)
msgs = ((InternalEObject) variable).eInverseRemove(this,
EOPPOSITE_FEATURE_BASE - IrPackage.PARAM__VARIABLE,
null, msgs);
if (newVariable != null)
msgs = ((InternalEObject) newVariable).eInverseAdd(this,
EOPPOSITE_FEATURE_BASE - IrPackage.PARAM__VARIABLE,
null, msgs);
msgs = basicSetVariable(newVariable, msgs);
if (msgs != null)
msgs.dispatch();
} else if (eNotificationRequired())
eNotify(new ENotificationImpl(this, Notification.SET,
IrPackage.PARAM__VARIABLE, newVariable, newVariable));
}
/**
* <!-- begin-user-doc -->
* <!-- end-user-doc -->
* @generated
*/
public boolean isByRef() {
return byRef;
}
/**
* <!-- begin-user-doc -->
* <!-- end-user-doc -->
* @generated
*/
public void setByRef(boolean newByRef) {
boolean oldByRef = byRef;
byRef = newByRef;
if (eNotificationRequired())
eNotify(new ENotificationImpl(this, Notification.SET,
IrPackage.PARAM__BY_REF, oldByRef, byRef));
}
/**
* <!-- begin-user-doc -->
* <!-- end-user-doc -->
* @generated
*/
@Override
public NotificationChain eInverseRemove(InternalEObject otherEnd,
int featureID, NotificationChain msgs) {
switch (featureID) {
case IrPackage.PARAM__VARIABLE:
return basicSetVariable(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 IrPackage.PARAM__VARIABLE:
return getVariable();
case IrPackage.PARAM__BY_REF:
return isByRef();
}
return super.eGet(featureID, resolve, coreType);
}
/**
* <!-- begin-user-doc -->
* <!-- end-user-doc -->
* @generated
*/
@Override
public void eSet(int featureID, Object newValue) {
switch (featureID) {
case IrPackage.PARAM__VARIABLE:
setVariable((Var) newValue);
return;
case IrPackage.PARAM__BY_REF:
setByRef((Boolean) newValue);
return;
}
super.eSet(featureID, newValue);
}
/**
* <!-- begin-user-doc -->
* <!-- end-user-doc -->
* @generated
*/
@Override
public void eUnset(int featureID) {
switch (featureID) {
case IrPackage.PARAM__VARIABLE:
setVariable((Var) null);
return;
case IrPackage.PARAM__BY_REF:
setByRef(BY_REF_EDEFAULT);
return;
}
super.eUnset(featureID);
}
/**
* <!-- begin-user-doc -->
* <!-- end-user-doc -->
* @generated
*/
@Override
public boolean eIsSet(int featureID) {
switch (featureID) {
case IrPackage.PARAM__VARIABLE:
return variable != null;
case IrPackage.PARAM__BY_REF:
return byRef != BY_REF_EDEFAULT;
}
return super.eIsSet(featureID);
}
/**
* <!-- begin-user-doc -->
* <!-- end-user-doc -->
* @generated
*/
@Override
public String toString() {
if (eIsProxy())
return super.toString();
StringBuffer result = new StringBuffer(super.toString());
result.append(" (byRef: ");
result.append(byRef);
result.append(')');
return result.toString();
}
} //ParamImpl