/**
*/
package edu.ksu.cis.projects.mdcf.devicemodel.deviceModelingLanguage.impl;
import edu.ksu.cis.projects.mdcf.devicemodel.deviceModelingLanguage.DeviceModelingLanguagePackage;
import edu.ksu.cis.projects.mdcf.devicemodel.deviceModelingLanguage.Exp;
import edu.ksu.cis.projects.mdcf.devicemodel.deviceModelingLanguage.UnaryExp;
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>Unary Exp</b></em>'.
* <!-- end-user-doc -->
* <p>
* The following features are implemented:
* <ul>
* <li>{@link edu.ksu.cis.projects.mdcf.devicemodel.deviceModelingLanguage.impl.UnaryExpImpl#getOp <em>Op</em>}</li>
* <li>{@link edu.ksu.cis.projects.mdcf.devicemodel.deviceModelingLanguage.impl.UnaryExpImpl#getArg <em>Arg</em>}</li>
* </ul>
* </p>
*
* @generated
*/
public class UnaryExpImpl extends ExpImpl implements UnaryExp
{
/**
* The default value of the '{@link #getOp() <em>Op</em>}' attribute.
* <!-- begin-user-doc -->
* <!-- end-user-doc -->
* @see #getOp()
* @generated
* @ordered
*/
protected static final String OP_EDEFAULT = null;
/**
* The cached value of the '{@link #getOp() <em>Op</em>}' attribute.
* <!-- begin-user-doc -->
* <!-- end-user-doc -->
* @see #getOp()
* @generated
* @ordered
*/
protected String op = OP_EDEFAULT;
/**
* The cached value of the '{@link #getArg() <em>Arg</em>}' containment reference.
* <!-- begin-user-doc -->
* <!-- end-user-doc -->
* @see #getArg()
* @generated
* @ordered
*/
protected Exp arg;
/**
* <!-- begin-user-doc -->
* <!-- end-user-doc -->
* @generated
*/
protected UnaryExpImpl()
{
super();
}
/**
* <!-- begin-user-doc -->
* <!-- end-user-doc -->
* @generated
*/
@Override
protected EClass eStaticClass()
{
return DeviceModelingLanguagePackage.Literals.UNARY_EXP;
}
/**
* <!-- begin-user-doc -->
* <!-- end-user-doc -->
* @generated
*/
public String getOp()
{
return op;
}
/**
* <!-- begin-user-doc -->
* <!-- end-user-doc -->
* @generated
*/
public void setOp(String newOp)
{
String oldOp = op;
op = newOp;
if (eNotificationRequired())
eNotify(new ENotificationImpl(this, Notification.SET, DeviceModelingLanguagePackage.UNARY_EXP__OP, oldOp, op));
}
/**
* <!-- begin-user-doc -->
* <!-- end-user-doc -->
* @generated
*/
public Exp getArg()
{
return arg;
}
/**
* <!-- begin-user-doc -->
* <!-- end-user-doc -->
* @generated
*/
public NotificationChain basicSetArg(Exp newArg, NotificationChain msgs)
{
Exp oldArg = arg;
arg = newArg;
if (eNotificationRequired())
{
ENotificationImpl notification = new ENotificationImpl(this, Notification.SET, DeviceModelingLanguagePackage.UNARY_EXP__ARG, oldArg, newArg);
if (msgs == null) msgs = notification; else msgs.add(notification);
}
return msgs;
}
/**
* <!-- begin-user-doc -->
* <!-- end-user-doc -->
* @generated
*/
public void setArg(Exp newArg)
{
if (newArg != arg)
{
NotificationChain msgs = null;
if (arg != null)
msgs = ((InternalEObject)arg).eInverseRemove(this, EOPPOSITE_FEATURE_BASE - DeviceModelingLanguagePackage.UNARY_EXP__ARG, null, msgs);
if (newArg != null)
msgs = ((InternalEObject)newArg).eInverseAdd(this, EOPPOSITE_FEATURE_BASE - DeviceModelingLanguagePackage.UNARY_EXP__ARG, null, msgs);
msgs = basicSetArg(newArg, msgs);
if (msgs != null) msgs.dispatch();
}
else if (eNotificationRequired())
eNotify(new ENotificationImpl(this, Notification.SET, DeviceModelingLanguagePackage.UNARY_EXP__ARG, newArg, newArg));
}
/**
* <!-- begin-user-doc -->
* <!-- end-user-doc -->
* @generated
*/
@Override
public NotificationChain eInverseRemove(InternalEObject otherEnd, int featureID, NotificationChain msgs)
{
switch (featureID)
{
case DeviceModelingLanguagePackage.UNARY_EXP__ARG:
return basicSetArg(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 DeviceModelingLanguagePackage.UNARY_EXP__OP:
return getOp();
case DeviceModelingLanguagePackage.UNARY_EXP__ARG:
return getArg();
}
return super.eGet(featureID, resolve, coreType);
}
/**
* <!-- begin-user-doc -->
* <!-- end-user-doc -->
* @generated
*/
@Override
public void eSet(int featureID, Object newValue)
{
switch (featureID)
{
case DeviceModelingLanguagePackage.UNARY_EXP__OP:
setOp((String)newValue);
return;
case DeviceModelingLanguagePackage.UNARY_EXP__ARG:
setArg((Exp)newValue);
return;
}
super.eSet(featureID, newValue);
}
/**
* <!-- begin-user-doc -->
* <!-- end-user-doc -->
* @generated
*/
@Override
public void eUnset(int featureID)
{
switch (featureID)
{
case DeviceModelingLanguagePackage.UNARY_EXP__OP:
setOp(OP_EDEFAULT);
return;
case DeviceModelingLanguagePackage.UNARY_EXP__ARG:
setArg((Exp)null);
return;
}
super.eUnset(featureID);
}
/**
* <!-- begin-user-doc -->
* <!-- end-user-doc -->
* @generated
*/
@Override
public boolean eIsSet(int featureID)
{
switch (featureID)
{
case DeviceModelingLanguagePackage.UNARY_EXP__OP:
return OP_EDEFAULT == null ? op != null : !OP_EDEFAULT.equals(op);
case DeviceModelingLanguagePackage.UNARY_EXP__ARG:
return arg != null;
}
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(" (op: ");
result.append(op);
result.append(')');
return result.toString();
}
} //UnaryExpImpl