/** * 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.VariableDeclaration; 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>Variable Declaration</b></em>'. * <!-- end-user-doc --> * <p> * The following features are implemented: * </p> * <ul> * <li>{@link com.arm.cmsis.pack.debugseq.debugSeq.impl.VariableDeclarationImpl#getName <em>Name</em>}</li> * <li>{@link com.arm.cmsis.pack.debugseq.debugSeq.impl.VariableDeclarationImpl#getValue <em>Value</em>}</li> * </ul> * * @generated */ public class VariableDeclarationImpl extends StatementImpl implements VariableDeclaration { /** * The default value of the '{@link #getName() <em>Name</em>}' attribute. * <!-- begin-user-doc --> * <!-- end-user-doc --> * @see #getName() * @generated * @ordered */ protected static final String NAME_EDEFAULT = null; /** * The cached value of the '{@link #getName() <em>Name</em>}' attribute. * <!-- begin-user-doc --> * <!-- end-user-doc --> * @see #getName() * @generated * @ordered */ protected String name = NAME_EDEFAULT; /** * The cached value of the '{@link #getValue() <em>Value</em>}' containment reference. * <!-- begin-user-doc --> * <!-- end-user-doc --> * @see #getValue() * @generated * @ordered */ protected Expression value; /** * <!-- begin-user-doc --> * <!-- end-user-doc --> * @generated */ protected VariableDeclarationImpl() { super(); } /** * <!-- begin-user-doc --> * <!-- end-user-doc --> * @generated */ @Override protected EClass eStaticClass() { return DebugSeqPackage.Literals.VARIABLE_DECLARATION; } /** * <!-- begin-user-doc --> * <!-- end-user-doc --> * @generated */ public String getName() { return name; } /** * <!-- begin-user-doc --> * <!-- end-user-doc --> * @generated */ public void setName(String newName) { String oldName = name; name = newName; if (eNotificationRequired()) eNotify(new ENotificationImpl(this, Notification.SET, DebugSeqPackage.VARIABLE_DECLARATION__NAME, oldName, name)); } /** * <!-- begin-user-doc --> * <!-- end-user-doc --> * @generated */ public Expression getValue() { return value; } /** * <!-- begin-user-doc --> * <!-- end-user-doc --> * @generated */ public NotificationChain basicSetValue(Expression newValue, NotificationChain msgs) { Expression oldValue = value; value = newValue; if (eNotificationRequired()) { ENotificationImpl notification = new ENotificationImpl(this, Notification.SET, DebugSeqPackage.VARIABLE_DECLARATION__VALUE, oldValue, newValue); if (msgs == null) msgs = notification; else msgs.add(notification); } return msgs; } /** * <!-- begin-user-doc --> * <!-- end-user-doc --> * @generated */ public void setValue(Expression newValue) { if (newValue != value) { NotificationChain msgs = null; if (value != null) msgs = ((InternalEObject)value).eInverseRemove(this, EOPPOSITE_FEATURE_BASE - DebugSeqPackage.VARIABLE_DECLARATION__VALUE, null, msgs); if (newValue != null) msgs = ((InternalEObject)newValue).eInverseAdd(this, EOPPOSITE_FEATURE_BASE - DebugSeqPackage.VARIABLE_DECLARATION__VALUE, null, msgs); msgs = basicSetValue(newValue, msgs); if (msgs != null) msgs.dispatch(); } else if (eNotificationRequired()) eNotify(new ENotificationImpl(this, Notification.SET, DebugSeqPackage.VARIABLE_DECLARATION__VALUE, newValue, newValue)); } /** * <!-- begin-user-doc --> * <!-- end-user-doc --> * @generated */ @Override public NotificationChain eInverseRemove(InternalEObject otherEnd, int featureID, NotificationChain msgs) { switch (featureID) { case DebugSeqPackage.VARIABLE_DECLARATION__VALUE: return basicSetValue(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.VARIABLE_DECLARATION__NAME: return getName(); case DebugSeqPackage.VARIABLE_DECLARATION__VALUE: return getValue(); } 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.VARIABLE_DECLARATION__NAME: setName((String)newValue); return; case DebugSeqPackage.VARIABLE_DECLARATION__VALUE: setValue((Expression)newValue); return; } super.eSet(featureID, newValue); } /** * <!-- begin-user-doc --> * <!-- end-user-doc --> * @generated */ @Override public void eUnset(int featureID) { switch (featureID) { case DebugSeqPackage.VARIABLE_DECLARATION__NAME: setName(NAME_EDEFAULT); return; case DebugSeqPackage.VARIABLE_DECLARATION__VALUE: setValue((Expression)null); return; } super.eUnset(featureID); } /** * <!-- begin-user-doc --> * <!-- end-user-doc --> * @generated */ @Override public boolean eIsSet(int featureID) { switch (featureID) { case DebugSeqPackage.VARIABLE_DECLARATION__NAME: return NAME_EDEFAULT == null ? name != null : !NAME_EDEFAULT.equals(name); case DebugSeqPackage.VARIABLE_DECLARATION__VALUE: return value != 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(" (name: "); result.append(name); result.append(')'); return result.toString(); } } //VariableDeclarationImpl