/** | |
* <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.EObjectContainmentWithInverseEList; | |
import org.eclipse.emf.ecore.util.EObjectWithInverseResolvingEList; | |
import org.eclipse.emf.ecore.util.InternalEList; | |
import statemachine.State; | |
import statemachine.StatemachinePackage; | |
import statemachine.Transition; | |
/** | |
* <!-- 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 statemachine.impl.StateImpl#getName <em>Name</em>}</li> | |
* <li>{@link statemachine.impl.StateImpl#getIncoming <em>Incoming</em>}</li> | |
* <li>{@link statemachine.impl.StateImpl#getOutgoing <em>Outgoing</em>}</li> | |
* </ul> | |
* </p> | |
* | |
* @generated | |
*/ | |
public class StateImpl extends EObjectImpl implements State { | |
/** | |
* 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 #getIncoming() <em>Incoming</em>}' reference list. | |
* <!-- begin-user-doc --> | |
* <!-- end-user-doc --> | |
* @see #getIncoming() | |
* @generated | |
* @ordered | |
*/ | |
protected EList incoming; | |
/** | |
* The cached value of the '{@link #getOutgoing() <em>Outgoing</em>}' containment reference list. | |
* <!-- begin-user-doc --> | |
* <!-- end-user-doc --> | |
* @see #getOutgoing() | |
* @generated | |
* @ordered | |
*/ | |
protected EList outgoing; | |
/** | |
* <!-- begin-user-doc --> | |
* <!-- end-user-doc --> | |
* @generated | |
*/ | |
protected StateImpl() { | |
super(); | |
} | |
/** | |
* <!-- begin-user-doc --> | |
* <!-- end-user-doc --> | |
* @generated | |
*/ | |
protected EClass eStaticClass() { | |
return StatemachinePackage.Literals.STATE; | |
} | |
/** | |
* <!-- 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, StatemachinePackage.STATE__NAME, oldName, name)); | |
} | |
/** | |
* <!-- begin-user-doc --> | |
* <!-- end-user-doc --> | |
* @generated | |
*/ | |
public EList getIncoming() { | |
if (incoming == null) { | |
incoming = new EObjectWithInverseResolvingEList(Transition.class, this, StatemachinePackage.STATE__INCOMING, StatemachinePackage.TRANSITION__TARGET); | |
} | |
return incoming; | |
} | |
/** | |
* <!-- begin-user-doc --> | |
* <!-- end-user-doc --> | |
* @generated | |
*/ | |
public EList getOutgoing() { | |
if (outgoing == null) { | |
outgoing = new EObjectContainmentWithInverseEList(Transition.class, this, StatemachinePackage.STATE__OUTGOING, StatemachinePackage.TRANSITION__SOURCE); | |
} | |
return outgoing; | |
} | |
/** | |
* <!-- begin-user-doc --> | |
* <!-- end-user-doc --> | |
* @generated | |
*/ | |
public NotificationChain eInverseAdd(InternalEObject otherEnd, int featureID, NotificationChain msgs) { | |
switch (featureID) { | |
case StatemachinePackage.STATE__INCOMING: | |
return ((InternalEList)getIncoming()).basicAdd(otherEnd, msgs); | |
case StatemachinePackage.STATE__OUTGOING: | |
return ((InternalEList)getOutgoing()).basicAdd(otherEnd, msgs); | |
} | |
return super.eInverseAdd(otherEnd, featureID, msgs); | |
} | |
/** | |
* <!-- begin-user-doc --> | |
* <!-- end-user-doc --> | |
* @generated | |
*/ | |
public NotificationChain eInverseRemove(InternalEObject otherEnd, int featureID, NotificationChain msgs) { | |
switch (featureID) { | |
case StatemachinePackage.STATE__INCOMING: | |
return ((InternalEList)getIncoming()).basicRemove(otherEnd, msgs); | |
case StatemachinePackage.STATE__OUTGOING: | |
return ((InternalEList)getOutgoing()).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.STATE__NAME: | |
return getName(); | |
case StatemachinePackage.STATE__INCOMING: | |
return getIncoming(); | |
case StatemachinePackage.STATE__OUTGOING: | |
return getOutgoing(); | |
} | |
return super.eGet(featureID, resolve, coreType); | |
} | |
/** | |
* <!-- begin-user-doc --> | |
* <!-- end-user-doc --> | |
* @generated | |
*/ | |
public void eSet(int featureID, Object newValue) { | |
switch (featureID) { | |
case StatemachinePackage.STATE__NAME: | |
setName((String)newValue); | |
return; | |
case StatemachinePackage.STATE__INCOMING: | |
getIncoming().clear(); | |
getIncoming().addAll((Collection)newValue); | |
return; | |
case StatemachinePackage.STATE__OUTGOING: | |
getOutgoing().clear(); | |
getOutgoing().addAll((Collection)newValue); | |
return; | |
} | |
super.eSet(featureID, newValue); | |
} | |
/** | |
* <!-- begin-user-doc --> | |
* <!-- end-user-doc --> | |
* @generated | |
*/ | |
public void eUnset(int featureID) { | |
switch (featureID) { | |
case StatemachinePackage.STATE__NAME: | |
setName(NAME_EDEFAULT); | |
return; | |
case StatemachinePackage.STATE__INCOMING: | |
getIncoming().clear(); | |
return; | |
case StatemachinePackage.STATE__OUTGOING: | |
getOutgoing().clear(); | |
return; | |
} | |
super.eUnset(featureID); | |
} | |
/** | |
* <!-- begin-user-doc --> | |
* <!-- end-user-doc --> | |
* @generated | |
*/ | |
public boolean eIsSet(int featureID) { | |
switch (featureID) { | |
case StatemachinePackage.STATE__NAME: | |
return NAME_EDEFAULT == null ? name != null : !NAME_EDEFAULT.equals(name); | |
case StatemachinePackage.STATE__INCOMING: | |
return incoming != null && !incoming.isEmpty(); | |
case StatemachinePackage.STATE__OUTGOING: | |
return outgoing != null && !outgoing.isEmpty(); | |
} | |
return super.eIsSet(featureID); | |
} | |
/** | |
* <!-- begin-user-doc --> | |
* <!-- end-user-doc --> | |
* @generated | |
*/ | |
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 |