/**
* generated by Xtext 2.10.0
*/
package com.arm.cmsis.pack.debugseq.debugSeq.impl;
import com.arm.cmsis.pack.debugseq.debugSeq.DebugSeqPackage;
import com.arm.cmsis.pack.debugseq.debugSeq.Expression;
import com.arm.cmsis.pack.debugseq.debugSeq.Ternary;
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>Ternary</b></em>'.
* <!-- end-user-doc -->
* <p>
* The following features are implemented:
* </p>
* <ul>
* <li>{@link com.arm.cmsis.pack.debugseq.debugSeq.impl.TernaryImpl#getLeft <em>Left</em>}</li>
* <li>{@link com.arm.cmsis.pack.debugseq.debugSeq.impl.TernaryImpl#getExp1 <em>Exp1</em>}</li>
* <li>{@link com.arm.cmsis.pack.debugseq.debugSeq.impl.TernaryImpl#getExp2 <em>Exp2</em>}</li>
* </ul>
*
* @generated
*/
public class TernaryImpl extends ExpressionImpl implements Ternary
{
/**
* The cached value of the '{@link #getLeft() <em>Left</em>}' containment reference.
* <!-- begin-user-doc -->
* <!-- end-user-doc -->
* @see #getLeft()
* @generated
* @ordered
*/
protected Expression left;
/**
* The cached value of the '{@link #getExp1() <em>Exp1</em>}' containment reference.
* <!-- begin-user-doc -->
* <!-- end-user-doc -->
* @see #getExp1()
* @generated
* @ordered
*/
protected Expression exp1;
/**
* The cached value of the '{@link #getExp2() <em>Exp2</em>}' containment reference.
* <!-- begin-user-doc -->
* <!-- end-user-doc -->
* @see #getExp2()
* @generated
* @ordered
*/
protected Expression exp2;
/**
* <!-- begin-user-doc -->
* <!-- end-user-doc -->
* @generated
*/
protected TernaryImpl()
{
super();
}
/**
* <!-- begin-user-doc -->
* <!-- end-user-doc -->
* @generated
*/
@Override
protected EClass eStaticClass()
{
return DebugSeqPackage.Literals.TERNARY;
}
/**
* <!-- begin-user-doc -->
* <!-- end-user-doc -->
* @generated
*/
public Expression getLeft()
{
return left;
}
/**
* <!-- begin-user-doc -->
* <!-- end-user-doc -->
* @generated
*/
public NotificationChain basicSetLeft(Expression newLeft, NotificationChain msgs)
{
Expression oldLeft = left;
left = newLeft;
if (eNotificationRequired())
{
ENotificationImpl notification = new ENotificationImpl(this, Notification.SET, DebugSeqPackage.TERNARY__LEFT, oldLeft, newLeft);
if (msgs == null) msgs = notification; else msgs.add(notification);
}
return msgs;
}
/**
* <!-- begin-user-doc -->
* <!-- end-user-doc -->
* @generated
*/
public void setLeft(Expression newLeft)
{
if (newLeft != left)
{
NotificationChain msgs = null;
if (left != null)
msgs = ((InternalEObject)left).eInverseRemove(this, EOPPOSITE_FEATURE_BASE - DebugSeqPackage.TERNARY__LEFT, null, msgs);
if (newLeft != null)
msgs = ((InternalEObject)newLeft).eInverseAdd(this, EOPPOSITE_FEATURE_BASE - DebugSeqPackage.TERNARY__LEFT, null, msgs);
msgs = basicSetLeft(newLeft, msgs);
if (msgs != null) msgs.dispatch();
}
else if (eNotificationRequired())
eNotify(new ENotificationImpl(this, Notification.SET, DebugSeqPackage.TERNARY__LEFT, newLeft, newLeft));
}
/**
* <!-- begin-user-doc -->
* <!-- end-user-doc -->
* @generated
*/
public Expression getExp1()
{
return exp1;
}
/**
* <!-- begin-user-doc -->
* <!-- end-user-doc -->
* @generated
*/
public NotificationChain basicSetExp1(Expression newExp1, NotificationChain msgs)
{
Expression oldExp1 = exp1;
exp1 = newExp1;
if (eNotificationRequired())
{
ENotificationImpl notification = new ENotificationImpl(this, Notification.SET, DebugSeqPackage.TERNARY__EXP1, oldExp1, newExp1);
if (msgs == null) msgs = notification; else msgs.add(notification);
}
return msgs;
}
/**
* <!-- begin-user-doc -->
* <!-- end-user-doc -->
* @generated
*/
public void setExp1(Expression newExp1)
{
if (newExp1 != exp1)
{
NotificationChain msgs = null;
if (exp1 != null)
msgs = ((InternalEObject)exp1).eInverseRemove(this, EOPPOSITE_FEATURE_BASE - DebugSeqPackage.TERNARY__EXP1, null, msgs);
if (newExp1 != null)
msgs = ((InternalEObject)newExp1).eInverseAdd(this, EOPPOSITE_FEATURE_BASE - DebugSeqPackage.TERNARY__EXP1, null, msgs);
msgs = basicSetExp1(newExp1, msgs);
if (msgs != null) msgs.dispatch();
}
else if (eNotificationRequired())
eNotify(new ENotificationImpl(this, Notification.SET, DebugSeqPackage.TERNARY__EXP1, newExp1, newExp1));
}
/**
* <!-- begin-user-doc -->
* <!-- end-user-doc -->
* @generated
*/
public Expression getExp2()
{
return exp2;
}
/**
* <!-- begin-user-doc -->
* <!-- end-user-doc -->
* @generated
*/
public NotificationChain basicSetExp2(Expression newExp2, NotificationChain msgs)
{
Expression oldExp2 = exp2;
exp2 = newExp2;
if (eNotificationRequired())
{
ENotificationImpl notification = new ENotificationImpl(this, Notification.SET, DebugSeqPackage.TERNARY__EXP2, oldExp2, newExp2);
if (msgs == null) msgs = notification; else msgs.add(notification);
}
return msgs;
}
/**
* <!-- begin-user-doc -->
* <!-- end-user-doc -->
* @generated
*/
public void setExp2(Expression newExp2)
{
if (newExp2 != exp2)
{
NotificationChain msgs = null;
if (exp2 != null)
msgs = ((InternalEObject)exp2).eInverseRemove(this, EOPPOSITE_FEATURE_BASE - DebugSeqPackage.TERNARY__EXP2, null, msgs);
if (newExp2 != null)
msgs = ((InternalEObject)newExp2).eInverseAdd(this, EOPPOSITE_FEATURE_BASE - DebugSeqPackage.TERNARY__EXP2, null, msgs);
msgs = basicSetExp2(newExp2, msgs);
if (msgs != null) msgs.dispatch();
}
else if (eNotificationRequired())
eNotify(new ENotificationImpl(this, Notification.SET, DebugSeqPackage.TERNARY__EXP2, newExp2, newExp2));
}
/**
* <!-- begin-user-doc -->
* <!-- end-user-doc -->
* @generated
*/
@Override
public NotificationChain eInverseRemove(InternalEObject otherEnd, int featureID, NotificationChain msgs)
{
switch (featureID)
{
case DebugSeqPackage.TERNARY__LEFT:
return basicSetLeft(null, msgs);
case DebugSeqPackage.TERNARY__EXP1:
return basicSetExp1(null, msgs);
case DebugSeqPackage.TERNARY__EXP2:
return basicSetExp2(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 DebugSeqPackage.TERNARY__LEFT:
return getLeft();
case DebugSeqPackage.TERNARY__EXP1:
return getExp1();
case DebugSeqPackage.TERNARY__EXP2:
return getExp2();
}
return super.eGet(featureID, resolve, coreType);
}
/**
* <!-- begin-user-doc -->
* <!-- end-user-doc -->
* @generated
*/
@Override
public void eSet(int featureID, Object newValue)
{
switch (featureID)
{
case DebugSeqPackage.TERNARY__LEFT:
setLeft((Expression)newValue);
return;
case DebugSeqPackage.TERNARY__EXP1:
setExp1((Expression)newValue);
return;
case DebugSeqPackage.TERNARY__EXP2:
setExp2((Expression)newValue);
return;
}
super.eSet(featureID, newValue);
}
/**
* <!-- begin-user-doc -->
* <!-- end-user-doc -->
* @generated
*/
@Override
public void eUnset(int featureID)
{
switch (featureID)
{
case DebugSeqPackage.TERNARY__LEFT:
setLeft((Expression)null);
return;
case DebugSeqPackage.TERNARY__EXP1:
setExp1((Expression)null);
return;
case DebugSeqPackage.TERNARY__EXP2:
setExp2((Expression)null);
return;
}
super.eUnset(featureID);
}
/**
* <!-- begin-user-doc -->
* <!-- end-user-doc -->
* @generated
*/
@Override
public boolean eIsSet(int featureID)
{
switch (featureID)
{
case DebugSeqPackage.TERNARY__LEFT:
return left != null;
case DebugSeqPackage.TERNARY__EXP1:
return exp1 != null;
case DebugSeqPackage.TERNARY__EXP2:
return exp2 != null;
}
return super.eIsSet(featureID);
}
} //TernaryImpl