/**
* <copyright>
* </copyright>
*
*/
package urban.urban.impl;
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;
import urban.urban.Atom;
import urban.urban.Op;
import urban.urban.UrbanPackage;
import urban.urban.ValueCalc;
/**
* <!-- begin-user-doc -->
* An implementation of the model object '<em><b>Atom</b></em>'.
* <!-- end-user-doc -->
* <p>
* The following features are implemented:
* <ul>
* <li>{@link urban.urban.impl.AtomImpl#getOp <em>Op</em>}</li>
* <li>{@link urban.urban.impl.AtomImpl#getRhs <em>Rhs</em>}</li>
* <li>{@link urban.urban.impl.AtomImpl#getExp <em>Exp</em>}</li>
* <li>{@link urban.urban.impl.AtomImpl#getLabel <em>Label</em>}</li>
* <li>{@link urban.urban.impl.AtomImpl#getNumber <em>Number</em>}</li>
* </ul>
* </p>
*
* @generated
*/
public class AtomImpl extends ValueCalcImpl implements Atom
{
/**
* The cached value of the '{@link #getOp() <em>Op</em>}' containment reference.
* <!-- begin-user-doc -->
* <!-- end-user-doc -->
* @see #getOp()
* @generated
* @ordered
*/
protected Op op;
/**
* The cached value of the '{@link #getRhs() <em>Rhs</em>}' containment reference.
* <!-- begin-user-doc -->
* <!-- end-user-doc -->
* @see #getRhs()
* @generated
* @ordered
*/
protected ValueCalc rhs;
/**
* The cached value of the '{@link #getExp() <em>Exp</em>}' containment reference.
* <!-- begin-user-doc -->
* <!-- end-user-doc -->
* @see #getExp()
* @generated
* @ordered
*/
protected ValueCalc exp;
/**
* The default value of the '{@link #getLabel() <em>Label</em>}' attribute.
* <!-- begin-user-doc -->
* <!-- end-user-doc -->
* @see #getLabel()
* @generated
* @ordered
*/
protected static final String LABEL_EDEFAULT = null;
/**
* The cached value of the '{@link #getLabel() <em>Label</em>}' attribute.
* <!-- begin-user-doc -->
* <!-- end-user-doc -->
* @see #getLabel()
* @generated
* @ordered
*/
protected String label = LABEL_EDEFAULT;
/**
* The cached value of the '{@link #getNumber() <em>Number</em>}' containment reference.
* <!-- begin-user-doc -->
* <!-- end-user-doc -->
* @see #getNumber()
* @generated
* @ordered
*/
protected urban.urban.Number number;
/**
* <!-- begin-user-doc -->
* <!-- end-user-doc -->
* @generated
*/
protected AtomImpl()
{
super();
}
/**
* <!-- begin-user-doc -->
* <!-- end-user-doc -->
* @generated
*/
@Override
protected EClass eStaticClass()
{
return UrbanPackage.Literals.ATOM;
}
/**
* <!-- begin-user-doc -->
* <!-- end-user-doc -->
* @generated
*/
public Op getOp()
{
return op;
}
/**
* <!-- begin-user-doc -->
* <!-- end-user-doc -->
* @generated
*/
public NotificationChain basicSetOp(Op newOp, NotificationChain msgs)
{
Op oldOp = op;
op = newOp;
if (eNotificationRequired())
{
ENotificationImpl notification = new ENotificationImpl(this, Notification.SET, UrbanPackage.ATOM__OP, oldOp, newOp);
if (msgs == null) msgs = notification; else msgs.add(notification);
}
return msgs;
}
/**
* <!-- begin-user-doc -->
* <!-- end-user-doc -->
* @generated
*/
public void setOp(Op newOp)
{
if (newOp != op)
{
NotificationChain msgs = null;
if (op != null)
msgs = ((InternalEObject)op).eInverseRemove(this, EOPPOSITE_FEATURE_BASE - UrbanPackage.ATOM__OP, null, msgs);
if (newOp != null)
msgs = ((InternalEObject)newOp).eInverseAdd(this, EOPPOSITE_FEATURE_BASE - UrbanPackage.ATOM__OP, null, msgs);
msgs = basicSetOp(newOp, msgs);
if (msgs != null) msgs.dispatch();
}
else if (eNotificationRequired())
eNotify(new ENotificationImpl(this, Notification.SET, UrbanPackage.ATOM__OP, newOp, newOp));
}
/**
* <!-- begin-user-doc -->
* <!-- end-user-doc -->
* @generated
*/
public ValueCalc getRhs()
{
return rhs;
}
/**
* <!-- begin-user-doc -->
* <!-- end-user-doc -->
* @generated
*/
public NotificationChain basicSetRhs(ValueCalc newRhs, NotificationChain msgs)
{
ValueCalc oldRhs = rhs;
rhs = newRhs;
if (eNotificationRequired())
{
ENotificationImpl notification = new ENotificationImpl(this, Notification.SET, UrbanPackage.ATOM__RHS, oldRhs, newRhs);
if (msgs == null) msgs = notification; else msgs.add(notification);
}
return msgs;
}
/**
* <!-- begin-user-doc -->
* <!-- end-user-doc -->
* @generated
*/
public void setRhs(ValueCalc newRhs)
{
if (newRhs != rhs)
{
NotificationChain msgs = null;
if (rhs != null)
msgs = ((InternalEObject)rhs).eInverseRemove(this, EOPPOSITE_FEATURE_BASE - UrbanPackage.ATOM__RHS, null, msgs);
if (newRhs != null)
msgs = ((InternalEObject)newRhs).eInverseAdd(this, EOPPOSITE_FEATURE_BASE - UrbanPackage.ATOM__RHS, null, msgs);
msgs = basicSetRhs(newRhs, msgs);
if (msgs != null) msgs.dispatch();
}
else if (eNotificationRequired())
eNotify(new ENotificationImpl(this, Notification.SET, UrbanPackage.ATOM__RHS, newRhs, newRhs));
}
/**
* <!-- begin-user-doc -->
* <!-- end-user-doc -->
* @generated
*/
public ValueCalc getExp()
{
return exp;
}
/**
* <!-- begin-user-doc -->
* <!-- end-user-doc -->
* @generated
*/
public NotificationChain basicSetExp(ValueCalc newExp, NotificationChain msgs)
{
ValueCalc oldExp = exp;
exp = newExp;
if (eNotificationRequired())
{
ENotificationImpl notification = new ENotificationImpl(this, Notification.SET, UrbanPackage.ATOM__EXP, oldExp, newExp);
if (msgs == null) msgs = notification; else msgs.add(notification);
}
return msgs;
}
/**
* <!-- begin-user-doc -->
* <!-- end-user-doc -->
* @generated
*/
public void setExp(ValueCalc newExp)
{
if (newExp != exp)
{
NotificationChain msgs = null;
if (exp != null)
msgs = ((InternalEObject)exp).eInverseRemove(this, EOPPOSITE_FEATURE_BASE - UrbanPackage.ATOM__EXP, null, msgs);
if (newExp != null)
msgs = ((InternalEObject)newExp).eInverseAdd(this, EOPPOSITE_FEATURE_BASE - UrbanPackage.ATOM__EXP, null, msgs);
msgs = basicSetExp(newExp, msgs);
if (msgs != null) msgs.dispatch();
}
else if (eNotificationRequired())
eNotify(new ENotificationImpl(this, Notification.SET, UrbanPackage.ATOM__EXP, newExp, newExp));
}
/**
* <!-- begin-user-doc -->
* <!-- end-user-doc -->
* @generated
*/
public String getLabel()
{
return label;
}
/**
* <!-- begin-user-doc -->
* <!-- end-user-doc -->
* @generated
*/
public void setLabel(String newLabel)
{
String oldLabel = label;
label = newLabel;
if (eNotificationRequired())
eNotify(new ENotificationImpl(this, Notification.SET, UrbanPackage.ATOM__LABEL, oldLabel, label));
}
/**
* <!-- begin-user-doc -->
* <!-- end-user-doc -->
* @generated
*/
public urban.urban.Number getNumber()
{
return number;
}
/**
* <!-- begin-user-doc -->
* <!-- end-user-doc -->
* @generated
*/
public NotificationChain basicSetNumber(urban.urban.Number newNumber, NotificationChain msgs)
{
urban.urban.Number oldNumber = number;
number = newNumber;
if (eNotificationRequired())
{
ENotificationImpl notification = new ENotificationImpl(this, Notification.SET, UrbanPackage.ATOM__NUMBER, oldNumber, newNumber);
if (msgs == null) msgs = notification; else msgs.add(notification);
}
return msgs;
}
/**
* <!-- begin-user-doc -->
* <!-- end-user-doc -->
* @generated
*/
public void setNumber(urban.urban.Number newNumber)
{
if (newNumber != number)
{
NotificationChain msgs = null;
if (number != null)
msgs = ((InternalEObject)number).eInverseRemove(this, EOPPOSITE_FEATURE_BASE - UrbanPackage.ATOM__NUMBER, null, msgs);
if (newNumber != null)
msgs = ((InternalEObject)newNumber).eInverseAdd(this, EOPPOSITE_FEATURE_BASE - UrbanPackage.ATOM__NUMBER, null, msgs);
msgs = basicSetNumber(newNumber, msgs);
if (msgs != null) msgs.dispatch();
}
else if (eNotificationRequired())
eNotify(new ENotificationImpl(this, Notification.SET, UrbanPackage.ATOM__NUMBER, newNumber, newNumber));
}
/**
* <!-- begin-user-doc -->
* <!-- end-user-doc -->
* @generated
*/
@Override
public NotificationChain eInverseRemove(InternalEObject otherEnd, int featureID, NotificationChain msgs)
{
switch (featureID)
{
case UrbanPackage.ATOM__OP:
return basicSetOp(null, msgs);
case UrbanPackage.ATOM__RHS:
return basicSetRhs(null, msgs);
case UrbanPackage.ATOM__EXP:
return basicSetExp(null, msgs);
case UrbanPackage.ATOM__NUMBER:
return basicSetNumber(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 UrbanPackage.ATOM__OP:
return getOp();
case UrbanPackage.ATOM__RHS:
return getRhs();
case UrbanPackage.ATOM__EXP:
return getExp();
case UrbanPackage.ATOM__LABEL:
return getLabel();
case UrbanPackage.ATOM__NUMBER:
return getNumber();
}
return super.eGet(featureID, resolve, coreType);
}
/**
* <!-- begin-user-doc -->
* <!-- end-user-doc -->
* @generated
*/
@Override
public void eSet(int featureID, Object newValue)
{
switch (featureID)
{
case UrbanPackage.ATOM__OP:
setOp((Op)newValue);
return;
case UrbanPackage.ATOM__RHS:
setRhs((ValueCalc)newValue);
return;
case UrbanPackage.ATOM__EXP:
setExp((ValueCalc)newValue);
return;
case UrbanPackage.ATOM__LABEL:
setLabel((String)newValue);
return;
case UrbanPackage.ATOM__NUMBER:
setNumber((urban.urban.Number)newValue);
return;
}
super.eSet(featureID, newValue);
}
/**
* <!-- begin-user-doc -->
* <!-- end-user-doc -->
* @generated
*/
@Override
public void eUnset(int featureID)
{
switch (featureID)
{
case UrbanPackage.ATOM__OP:
setOp((Op)null);
return;
case UrbanPackage.ATOM__RHS:
setRhs((ValueCalc)null);
return;
case UrbanPackage.ATOM__EXP:
setExp((ValueCalc)null);
return;
case UrbanPackage.ATOM__LABEL:
setLabel(LABEL_EDEFAULT);
return;
case UrbanPackage.ATOM__NUMBER:
setNumber((urban.urban.Number)null);
return;
}
super.eUnset(featureID);
}
/**
* <!-- begin-user-doc -->
* <!-- end-user-doc -->
* @generated
*/
@Override
public boolean eIsSet(int featureID)
{
switch (featureID)
{
case UrbanPackage.ATOM__OP:
return op != null;
case UrbanPackage.ATOM__RHS:
return rhs != null;
case UrbanPackage.ATOM__EXP:
return exp != null;
case UrbanPackage.ATOM__LABEL:
return LABEL_EDEFAULT == null ? label != null : !LABEL_EDEFAULT.equals(label);
case UrbanPackage.ATOM__NUMBER:
return number != 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(" (label: ");
result.append(label);
result.append(')');
return result.toString();
}
} //AtomImpl