/**
*/
package simpleStatechart.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.MinimalEObjectImpl;
import org.eclipse.emf.ecore.util.EObjectContainmentEList;
import org.eclipse.emf.ecore.util.InternalEList;
import simpleStatechart.Entry;
import simpleStatechart.SimpleStatechartPackage;
import simpleStatechart.State;
import simpleStatechart.Statechart;
/**
*
* An implementation of the model object 'Statechart'.
*
*
* The following features are implemented:
*
*
* - {@link simpleStatechart.impl.StatechartImpl#getState State}
* - {@link simpleStatechart.impl.StatechartImpl#getEntry Entry}
*
*
* @generated
*/
public class StatechartImpl extends MinimalEObjectImpl.Container implements Statechart {
/**
* The cached value of the '{@link #getState() State}' containment reference list.
*
*
* @see #getState()
* @generated
* @ordered
*/
protected EList state;
/**
* The cached value of the '{@link #getEntry() Entry}' containment reference.
*
*
* @see #getEntry()
* @generated
* @ordered
*/
protected Entry entry;
/**
*
*
* @generated
*/
protected StatechartImpl() {
super();
}
/**
*
*
* @generated
*/
@Override
protected EClass eStaticClass() {
return SimpleStatechartPackage.Literals.STATECHART;
}
/**
*
*
* @generated
*/
public EList getState() {
if (state == null) {
state = new EObjectContainmentEList(State.class, this, SimpleStatechartPackage.STATECHART__STATE);
}
return state;
}
/**
*
*
* @generated
*/
public Entry getEntry() {
return entry;
}
/**
*
*
* @generated
*/
public NotificationChain basicSetEntry(Entry newEntry, NotificationChain msgs) {
Entry oldEntry = entry;
entry = newEntry;
if (eNotificationRequired()) {
ENotificationImpl notification = new ENotificationImpl(this, Notification.SET, SimpleStatechartPackage.STATECHART__ENTRY, oldEntry, newEntry);
if (msgs == null) msgs = notification; else msgs.add(notification);
}
return msgs;
}
/**
*
*
* @generated
*/
public void setEntry(Entry newEntry) {
if (newEntry != entry) {
NotificationChain msgs = null;
if (entry != null)
msgs = ((InternalEObject)entry).eInverseRemove(this, EOPPOSITE_FEATURE_BASE - SimpleStatechartPackage.STATECHART__ENTRY, null, msgs);
if (newEntry != null)
msgs = ((InternalEObject)newEntry).eInverseAdd(this, EOPPOSITE_FEATURE_BASE - SimpleStatechartPackage.STATECHART__ENTRY, null, msgs);
msgs = basicSetEntry(newEntry, msgs);
if (msgs != null) msgs.dispatch();
}
else if (eNotificationRequired())
eNotify(new ENotificationImpl(this, Notification.SET, SimpleStatechartPackage.STATECHART__ENTRY, newEntry, newEntry));
}
/**
*
*
* @generated
*/
@Override
public NotificationChain eInverseRemove(InternalEObject otherEnd, int featureID, NotificationChain msgs) {
switch (featureID) {
case SimpleStatechartPackage.STATECHART__STATE:
return ((InternalEList>)getState()).basicRemove(otherEnd, msgs);
case SimpleStatechartPackage.STATECHART__ENTRY:
return basicSetEntry(null, msgs);
}
return super.eInverseRemove(otherEnd, featureID, msgs);
}
/**
*
*
* @generated
*/
@Override
public Object eGet(int featureID, boolean resolve, boolean coreType) {
switch (featureID) {
case SimpleStatechartPackage.STATECHART__STATE:
return getState();
case SimpleStatechartPackage.STATECHART__ENTRY:
return getEntry();
}
return super.eGet(featureID, resolve, coreType);
}
/**
*
*
* @generated
*/
@SuppressWarnings("unchecked")
@Override
public void eSet(int featureID, Object newValue) {
switch (featureID) {
case SimpleStatechartPackage.STATECHART__STATE:
getState().clear();
getState().addAll((Collection extends State>)newValue);
return;
case SimpleStatechartPackage.STATECHART__ENTRY:
setEntry((Entry)newValue);
return;
}
super.eSet(featureID, newValue);
}
/**
*
*
* @generated
*/
@Override
public void eUnset(int featureID) {
switch (featureID) {
case SimpleStatechartPackage.STATECHART__STATE:
getState().clear();
return;
case SimpleStatechartPackage.STATECHART__ENTRY:
setEntry((Entry)null);
return;
}
super.eUnset(featureID);
}
/**
*
*
* @generated
*/
@Override
public boolean eIsSet(int featureID) {
switch (featureID) {
case SimpleStatechartPackage.STATECHART__STATE:
return state != null && !state.isEmpty();
case SimpleStatechartPackage.STATECHART__ENTRY:
return entry != null;
}
return super.eIsSet(featureID);
}
} //StatechartImpl