| /** | |
| * <copyright> | |
| * </copyright> | |
| * | |
| * $Id$ | |
| */ | |
| package statemachine.impl; | |
| import java.util.Collection; | |
| 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; | |
| import statemachine.Region; | |
| import statemachine.State; | |
| import statemachine.StatemachinePackage; | |
| /** | |
| * <!-- begin-user-doc --> | |
| * An implementation of the model object '<em><b>Region</b></em>'. | |
| * <!-- end-user-doc --> | |
| * <p> | |
| * The following features are implemented: | |
| * <ul> | |
| * <li>{@link statemachine.impl.RegionImpl#getState <em>State</em>}</li> | |
| * <li>{@link statemachine.impl.RegionImpl#getInitial <em>Initial</em>}</li> | |
| * </ul> | |
| * </p> | |
| * | |
| * @generated | |
| */ | |
| public class RegionImpl extends EObjectImpl implements Region { | |
| /** | |
| * The cached value of the '{@link #getState() <em>State</em>}' containment reference list. | |
| * <!-- begin-user-doc --> | |
| * <!-- end-user-doc --> | |
| * @see #getState() | |
| * @generated | |
| * @ordered | |
| */ | |
| protected EList state; | |
| /** | |
| * The cached value of the '{@link #getInitial() <em>Initial</em>}' reference. | |
| * <!-- begin-user-doc --> | |
| * <!-- end-user-doc --> | |
| * @see #getInitial() | |
| * @generated | |
| * @ordered | |
| */ | |
| protected State initial; | |
| /** | |
| * <!-- begin-user-doc --> | |
| * <!-- end-user-doc --> | |
| * @generated | |
| */ | |
| protected RegionImpl() { | |
| super(); | |
| } | |
| /** | |
| * <!-- begin-user-doc --> | |
| * <!-- end-user-doc --> | |
| * @generated | |
| */ | |
| protected EClass eStaticClass() { | |
| return StatemachinePackage.Literals.REGION; | |
| } | |
| /** | |
| * <!-- begin-user-doc --> | |
| * <!-- end-user-doc --> | |
| * @generated | |
| */ | |
| public EList getState() { | |
| if (state == null) { | |
| state = new EObjectContainmentEList(State.class, this, StatemachinePackage.REGION__STATE); | |
| } | |
| return state; | |
| } | |
| /** | |
| * <!-- begin-user-doc --> | |
| * <!-- end-user-doc --> | |
| * @generated | |
| */ | |
| public State getInitial() { | |
| if (initial != null && initial.eIsProxy()) { | |
| InternalEObject oldInitial = (InternalEObject)initial; | |
| initial = (State)eResolveProxy(oldInitial); | |
| if (initial != oldInitial) { | |
| if (eNotificationRequired()) | |
| eNotify(new ENotificationImpl(this, Notification.RESOLVE, StatemachinePackage.REGION__INITIAL, oldInitial, initial)); | |
| } | |
| } | |
| return initial; | |
| } | |
| /** | |
| * <!-- begin-user-doc --> | |
| * <!-- end-user-doc --> | |
| * @generated | |
| */ | |
| public State basicGetInitial() { | |
| return initial; | |
| } | |
| /** | |
| * <!-- begin-user-doc --> | |
| * <!-- end-user-doc --> | |
| * @generated | |
| */ | |
| public void setInitial(State newInitial) { | |
| State oldInitial = initial; | |
| initial = newInitial; | |
| if (eNotificationRequired()) | |
| eNotify(new ENotificationImpl(this, Notification.SET, StatemachinePackage.REGION__INITIAL, oldInitial, initial)); | |
| } | |
| /** | |
| * <!-- begin-user-doc --> | |
| * <!-- end-user-doc --> | |
| * @generated | |
| */ | |
| public NotificationChain eInverseRemove(InternalEObject otherEnd, int featureID, NotificationChain msgs) { | |
| switch (featureID) { | |
| case StatemachinePackage.REGION__STATE: | |
| return ((InternalEList)getState()).basicRemove(otherEnd, msgs); | |
| } | |
| return super.eInverseRemove(otherEnd, featureID, msgs); | |
| } | |
| /** | |
| * <!-- begin-user-doc --> | |
| * <!-- end-user-doc --> | |
| * @generated | |
| */ | |
| public Object eGet(int featureID, boolean resolve, boolean coreType) { | |
| switch (featureID) { | |
| case StatemachinePackage.REGION__STATE: | |
| return getState(); | |
| case StatemachinePackage.REGION__INITIAL: | |
| if (resolve) return getInitial(); | |
| return basicGetInitial(); | |
| } | |
| return super.eGet(featureID, resolve, coreType); | |
| } | |
| /** | |
| * <!-- begin-user-doc --> | |
| * <!-- end-user-doc --> | |
| * @generated | |
| */ | |
| public void eSet(int featureID, Object newValue) { | |
| switch (featureID) { | |
| case StatemachinePackage.REGION__STATE: | |
| getState().clear(); | |
| getState().addAll((Collection)newValue); | |
| return; | |
| case StatemachinePackage.REGION__INITIAL: | |
| setInitial((State)newValue); | |
| return; | |
| } | |
| super.eSet(featureID, newValue); | |
| } | |
| /** | |
| * <!-- begin-user-doc --> | |
| * <!-- end-user-doc --> | |
| * @generated | |
| */ | |
| public void eUnset(int featureID) { | |
| switch (featureID) { | |
| case StatemachinePackage.REGION__STATE: | |
| getState().clear(); | |
| return; | |
| case StatemachinePackage.REGION__INITIAL: | |
| setInitial((State)null); | |
| return; | |
| } | |
| super.eUnset(featureID); | |
| } | |
| /** | |
| * <!-- begin-user-doc --> | |
| * <!-- end-user-doc --> | |
| * @generated | |
| */ | |
| public boolean eIsSet(int featureID) { | |
| switch (featureID) { | |
| case StatemachinePackage.REGION__STATE: | |
| return state != null && !state.isEmpty(); | |
| case StatemachinePackage.REGION__INITIAL: | |
| return initial != null; | |
| } | |
| return super.eIsSet(featureID); | |
| } | |
| } //RegionImpl |