/** * <copyright> * </copyright> * * $Id$ */ package no.hal.scxml.scxmlxt.impl; import no.hal.scxml.scxmlxt.InitialTransition; import no.hal.scxml.scxmlxt.ScxmlxtPackage; import no.hal.scxml.scxmlxt.State; 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>State</b></em>'. * <!-- end-user-doc --> * <p> * The following features are implemented: * <ul> * <li>{@link no.hal.scxml.scxmlxt.impl.StateImpl#getInitialTransition <em>Initial Transition</em>}</li> * <li>{@link no.hal.scxml.scxmlxt.impl.StateImpl#getName <em>Name</em>}</li> * </ul> * </p> * * @generated */ public class StateImpl extends AbstractStateImpl implements State { /** * The cached value of the '{@link #getInitialTransition() <em>Initial Transition</em>}' containment reference. * <!-- begin-user-doc --> * <!-- end-user-doc --> * @see #getInitialTransition() * @generated * @ordered */ protected InitialTransition initialTransition; /** * 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; /** * <!-- begin-user-doc --> * <!-- end-user-doc --> * @generated */ protected StateImpl() { super(); } /** * <!-- begin-user-doc --> * <!-- end-user-doc --> * @generated */ @Override protected EClass eStaticClass() { return ScxmlxtPackage.Literals.STATE; } /** * <!-- begin-user-doc --> * <!-- end-user-doc --> * @generated */ public InitialTransition getInitialTransition() { return initialTransition; } /** * <!-- begin-user-doc --> * <!-- end-user-doc --> * @generated */ public NotificationChain basicSetInitialTransition(InitialTransition newInitialTransition, NotificationChain msgs) { InitialTransition oldInitialTransition = initialTransition; initialTransition = newInitialTransition; if (eNotificationRequired()) { ENotificationImpl notification = new ENotificationImpl(this, Notification.SET, ScxmlxtPackage.STATE__INITIAL_TRANSITION, oldInitialTransition, newInitialTransition); if (msgs == null) msgs = notification; else msgs.add(notification); } return msgs; } /** * <!-- begin-user-doc --> * <!-- end-user-doc --> * @generated */ public void setInitialTransition(InitialTransition newInitialTransition) { if (newInitialTransition != initialTransition) { NotificationChain msgs = null; if (initialTransition != null) msgs = ((InternalEObject)initialTransition).eInverseRemove(this, EOPPOSITE_FEATURE_BASE - ScxmlxtPackage.STATE__INITIAL_TRANSITION, null, msgs); if (newInitialTransition != null) msgs = ((InternalEObject)newInitialTransition).eInverseAdd(this, EOPPOSITE_FEATURE_BASE - ScxmlxtPackage.STATE__INITIAL_TRANSITION, null, msgs); msgs = basicSetInitialTransition(newInitialTransition, msgs); if (msgs != null) msgs.dispatch(); } else if (eNotificationRequired()) eNotify(new ENotificationImpl(this, Notification.SET, ScxmlxtPackage.STATE__INITIAL_TRANSITION, newInitialTransition, newInitialTransition)); } /** * <!-- 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, ScxmlxtPackage.STATE__NAME, oldName, name)); } /** * <!-- begin-user-doc --> * <!-- end-user-doc --> * @generated */ @Override public NotificationChain eInverseRemove(InternalEObject otherEnd, int featureID, NotificationChain msgs) { switch (featureID) { case ScxmlxtPackage.STATE__INITIAL_TRANSITION: return basicSetInitialTransition(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 ScxmlxtPackage.STATE__INITIAL_TRANSITION: return getInitialTransition(); case ScxmlxtPackage.STATE__NAME: return getName(); } return super.eGet(featureID, resolve, coreType); } /** * <!-- begin-user-doc --> * <!-- end-user-doc --> * @generated */ @Override public void eSet(int featureID, Object newValue) { switch (featureID) { case ScxmlxtPackage.STATE__INITIAL_TRANSITION: setInitialTransition((InitialTransition)newValue); return; case ScxmlxtPackage.STATE__NAME: setName((String)newValue); return; } super.eSet(featureID, newValue); } /** * <!-- begin-user-doc --> * <!-- end-user-doc --> * @generated */ @Override public void eUnset(int featureID) { switch (featureID) { case ScxmlxtPackage.STATE__INITIAL_TRANSITION: setInitialTransition((InitialTransition)null); return; case ScxmlxtPackage.STATE__NAME: setName(NAME_EDEFAULT); return; } super.eUnset(featureID); } /** * <!-- begin-user-doc --> * <!-- end-user-doc --> * @generated */ @Override public boolean eIsSet(int featureID) { switch (featureID) { case ScxmlxtPackage.STATE__INITIAL_TRANSITION: return initialTransition != null; case ScxmlxtPackage.STATE__NAME: return NAME_EDEFAULT == null ? name != null : !NAME_EDEFAULT.equals(name); } 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(); } } //StateImpl