/** * <copyright> * </copyright> * * $Id$ */ package no.hal.scxml.scxmlxt.impl; import java.util.Collection; import no.hal.scxml.scxmlxt.EPath; import no.hal.scxml.scxmlxt.EStep; import no.hal.scxml.scxmlxt.ScxmlxtPackage; import no.hal.scxml.scxmlxt.VarRef; import org.eclipse.emf.common.notify.Notification; import org.eclipse.emf.common.notify.NotificationChain; import org.eclipse.emf.common.util.EList; import org.eclipse.emf.ecore.EClass; import org.eclipse.emf.ecore.InternalEObject; import org.eclipse.emf.ecore.impl.ENotificationImpl; import org.eclipse.emf.ecore.impl.EObjectImpl; import org.eclipse.emf.ecore.util.EObjectContainmentEList; import org.eclipse.emf.ecore.util.InternalEList; /** * <!-- begin-user-doc --> * An implementation of the model object '<em><b>EPath</b></em>'. * <!-- end-user-doc --> * <p> * The following features are implemented: * <ul> * <li>{@link no.hal.scxml.scxmlxt.impl.EPathImpl#getVar <em>Var</em>}</li> * <li>{@link no.hal.scxml.scxmlxt.impl.EPathImpl#getSteps <em>Steps</em>}</li> * </ul> * </p> * * @generated */ public class EPathImpl extends ExpressionImpl implements EPath { /** * The cached value of the '{@link #getVar() <em>Var</em>}' containment reference. * <!-- begin-user-doc --> * <!-- end-user-doc --> * @see #getVar() * @generated * @ordered */ protected VarRef var; /** * The cached value of the '{@link #getSteps() <em>Steps</em>}' containment reference list. * <!-- begin-user-doc --> * <!-- end-user-doc --> * @see #getSteps() * @generated * @ordered */ protected EList<EStep> steps; /** * <!-- begin-user-doc --> * <!-- end-user-doc --> * @generated */ protected EPathImpl() { super(); } /** * <!-- begin-user-doc --> * <!-- end-user-doc --> * @generated */ @Override protected EClass eStaticClass() { return ScxmlxtPackage.Literals.EPATH; } /** * <!-- begin-user-doc --> * <!-- end-user-doc --> * @generated */ public VarRef getVar() { return var; } /** * <!-- begin-user-doc --> * <!-- end-user-doc --> * @generated */ public NotificationChain basicSetVar(VarRef newVar, NotificationChain msgs) { VarRef oldVar = var; var = newVar; if (eNotificationRequired()) { ENotificationImpl notification = new ENotificationImpl(this, Notification.SET, ScxmlxtPackage.EPATH__VAR, oldVar, newVar); if (msgs == null) msgs = notification; else msgs.add(notification); } return msgs; } /** * <!-- begin-user-doc --> * <!-- end-user-doc --> * @generated */ public void setVar(VarRef newVar) { if (newVar != var) { NotificationChain msgs = null; if (var != null) msgs = ((InternalEObject)var).eInverseRemove(this, EOPPOSITE_FEATURE_BASE - ScxmlxtPackage.EPATH__VAR, null, msgs); if (newVar != null) msgs = ((InternalEObject)newVar).eInverseAdd(this, EOPPOSITE_FEATURE_BASE - ScxmlxtPackage.EPATH__VAR, null, msgs); msgs = basicSetVar(newVar, msgs); if (msgs != null) msgs.dispatch(); } else if (eNotificationRequired()) eNotify(new ENotificationImpl(this, Notification.SET, ScxmlxtPackage.EPATH__VAR, newVar, newVar)); } /** * <!-- begin-user-doc --> * <!-- end-user-doc --> * @generated */ public EList<EStep> getSteps() { if (steps == null) { steps = new EObjectContainmentEList<EStep>(EStep.class, this, ScxmlxtPackage.EPATH__STEPS); } return steps; } /** * <!-- begin-user-doc --> * <!-- end-user-doc --> * @generated */ @Override public NotificationChain eInverseRemove(InternalEObject otherEnd, int featureID, NotificationChain msgs) { switch (featureID) { case ScxmlxtPackage.EPATH__VAR: return basicSetVar(null, msgs); case ScxmlxtPackage.EPATH__STEPS: return ((InternalEList<?>)getSteps()).basicRemove(otherEnd, 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 ScxmlxtPackage.EPATH__VAR: return getVar(); case ScxmlxtPackage.EPATH__STEPS: return getSteps(); } return super.eGet(featureID, resolve, coreType); } /** * <!-- begin-user-doc --> * <!-- end-user-doc --> * @generated */ @SuppressWarnings("unchecked") @Override public void eSet(int featureID, Object newValue) { switch (featureID) { case ScxmlxtPackage.EPATH__VAR: setVar((VarRef)newValue); return; case ScxmlxtPackage.EPATH__STEPS: getSteps().clear(); getSteps().addAll((Collection<? extends EStep>)newValue); return; } super.eSet(featureID, newValue); } /** * <!-- begin-user-doc --> * <!-- end-user-doc --> * @generated */ @Override public void eUnset(int featureID) { switch (featureID) { case ScxmlxtPackage.EPATH__VAR: setVar((VarRef)null); return; case ScxmlxtPackage.EPATH__STEPS: getSteps().clear(); return; } super.eUnset(featureID); } /** * <!-- begin-user-doc --> * <!-- end-user-doc --> * @generated */ @Override public boolean eIsSet(int featureID) { switch (featureID) { case ScxmlxtPackage.EPATH__VAR: return var != null; case ScxmlxtPackage.EPATH__STEPS: return steps != null && !steps.isEmpty(); } return super.eIsSet(featureID); } } //EPathImpl