/**
*/
package ca.mcgill.ecse.dslreasoner.standalone.test.yakindu.impl;
import ca.mcgill.ecse.dslreasoner.standalone.test.yakindu.Transition;
import ca.mcgill.ecse.dslreasoner.standalone.test.yakindu.Vertex;
import ca.mcgill.ecse.dslreasoner.standalone.test.yakindu.yakinduPackage;
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;
import org.eclipse.emf.ecore.impl.MinimalEObjectImpl;
import org.eclipse.emf.ecore.util.EcoreUtil;
/**
*
* An implementation of the model object 'Transition'.
*
*
* The following features are implemented:
*
*
* - {@link ca.mcgill.ecse.dslreasoner.standalone.test.yakindu.impl.TransitionImpl#getTarget Target}
* - {@link ca.mcgill.ecse.dslreasoner.standalone.test.yakindu.impl.TransitionImpl#getSource Source}
*
*
* @generated
*/
public class TransitionImpl extends MinimalEObjectImpl.Container implements Transition {
/**
* The cached value of the '{@link #getTarget() Target}' reference.
*
*
* @see #getTarget()
* @generated
* @ordered
*/
protected Vertex target;
/**
*
*
* @generated
*/
protected TransitionImpl() {
super();
}
/**
*
*
* @generated
*/
@Override
protected EClass eStaticClass() {
return yakinduPackage.Literals.TRANSITION;
}
/**
*
*
* @generated
*/
public Vertex getTarget() {
if (target != null && target.eIsProxy()) {
InternalEObject oldTarget = (InternalEObject)target;
target = (Vertex)eResolveProxy(oldTarget);
if (target != oldTarget) {
if (eNotificationRequired())
eNotify(new ENotificationImpl(this, Notification.RESOLVE, yakinduPackage.TRANSITION__TARGET, oldTarget, target));
}
}
return target;
}
/**
*
*
* @generated
*/
public Vertex basicGetTarget() {
return target;
}
/**
*
*
* @generated
*/
public NotificationChain basicSetTarget(Vertex newTarget, NotificationChain msgs) {
Vertex oldTarget = target;
target = newTarget;
if (eNotificationRequired()) {
ENotificationImpl notification = new ENotificationImpl(this, Notification.SET, yakinduPackage.TRANSITION__TARGET, oldTarget, newTarget);
if (msgs == null) msgs = notification; else msgs.add(notification);
}
return msgs;
}
/**
*
*
* @generated
*/
public void setTarget(Vertex newTarget) {
if (newTarget != target) {
NotificationChain msgs = null;
if (target != null)
msgs = ((InternalEObject)target).eInverseRemove(this, yakinduPackage.VERTEX__INCOMING_TRANSITIONS, Vertex.class, msgs);
if (newTarget != null)
msgs = ((InternalEObject)newTarget).eInverseAdd(this, yakinduPackage.VERTEX__INCOMING_TRANSITIONS, Vertex.class, msgs);
msgs = basicSetTarget(newTarget, msgs);
if (msgs != null) msgs.dispatch();
}
else if (eNotificationRequired())
eNotify(new ENotificationImpl(this, Notification.SET, yakinduPackage.TRANSITION__TARGET, newTarget, newTarget));
}
/**
*
*
* @generated
*/
public Vertex getSource() {
if (eContainerFeatureID() != yakinduPackage.TRANSITION__SOURCE) return null;
return (Vertex)eInternalContainer();
}
/**
*
*
* @generated
*/
public NotificationChain basicSetSource(Vertex newSource, NotificationChain msgs) {
msgs = eBasicSetContainer((InternalEObject)newSource, yakinduPackage.TRANSITION__SOURCE, msgs);
return msgs;
}
/**
*
*
* @generated
*/
public void setSource(Vertex newSource) {
if (newSource != eInternalContainer() || (eContainerFeatureID() != yakinduPackage.TRANSITION__SOURCE && newSource != null)) {
if (EcoreUtil.isAncestor(this, newSource))
throw new IllegalArgumentException("Recursive containment not allowed for " + toString());
NotificationChain msgs = null;
if (eInternalContainer() != null)
msgs = eBasicRemoveFromContainer(msgs);
if (newSource != null)
msgs = ((InternalEObject)newSource).eInverseAdd(this, yakinduPackage.VERTEX__OUTGOING_TRANSITIONS, Vertex.class, msgs);
msgs = basicSetSource(newSource, msgs);
if (msgs != null) msgs.dispatch();
}
else if (eNotificationRequired())
eNotify(new ENotificationImpl(this, Notification.SET, yakinduPackage.TRANSITION__SOURCE, newSource, newSource));
}
/**
*
*
* @generated
*/
@Override
public NotificationChain eInverseAdd(InternalEObject otherEnd, int featureID, NotificationChain msgs) {
switch (featureID) {
case yakinduPackage.TRANSITION__TARGET:
if (target != null)
msgs = ((InternalEObject)target).eInverseRemove(this, yakinduPackage.VERTEX__INCOMING_TRANSITIONS, Vertex.class, msgs);
return basicSetTarget((Vertex)otherEnd, msgs);
case yakinduPackage.TRANSITION__SOURCE:
if (eInternalContainer() != null)
msgs = eBasicRemoveFromContainer(msgs);
return basicSetSource((Vertex)otherEnd, msgs);
}
return super.eInverseAdd(otherEnd, featureID, msgs);
}
/**
*
*
* @generated
*/
@Override
public NotificationChain eInverseRemove(InternalEObject otherEnd, int featureID, NotificationChain msgs) {
switch (featureID) {
case yakinduPackage.TRANSITION__TARGET:
return basicSetTarget(null, msgs);
case yakinduPackage.TRANSITION__SOURCE:
return basicSetSource(null, msgs);
}
return super.eInverseRemove(otherEnd, featureID, msgs);
}
/**
*
*
* @generated
*/
@Override
public NotificationChain eBasicRemoveFromContainerFeature(NotificationChain msgs) {
switch (eContainerFeatureID()) {
case yakinduPackage.TRANSITION__SOURCE:
return eInternalContainer().eInverseRemove(this, yakinduPackage.VERTEX__OUTGOING_TRANSITIONS, Vertex.class, msgs);
}
return super.eBasicRemoveFromContainerFeature(msgs);
}
/**
*
*
* @generated
*/
@Override
public Object eGet(int featureID, boolean resolve, boolean coreType) {
switch (featureID) {
case yakinduPackage.TRANSITION__TARGET:
if (resolve) return getTarget();
return basicGetTarget();
case yakinduPackage.TRANSITION__SOURCE:
return getSource();
}
return super.eGet(featureID, resolve, coreType);
}
/**
*
*
* @generated
*/
@Override
public void eSet(int featureID, Object newValue) {
switch (featureID) {
case yakinduPackage.TRANSITION__TARGET:
setTarget((Vertex)newValue);
return;
case yakinduPackage.TRANSITION__SOURCE:
setSource((Vertex)newValue);
return;
}
super.eSet(featureID, newValue);
}
/**
*
*
* @generated
*/
@Override
public void eUnset(int featureID) {
switch (featureID) {
case yakinduPackage.TRANSITION__TARGET:
setTarget((Vertex)null);
return;
case yakinduPackage.TRANSITION__SOURCE:
setSource((Vertex)null);
return;
}
super.eUnset(featureID);
}
/**
*
*
* @generated
*/
@Override
public boolean eIsSet(int featureID) {
switch (featureID) {
case yakinduPackage.TRANSITION__TARGET:
return target != null;
case yakinduPackage.TRANSITION__SOURCE:
return getSource() != null;
}
return super.eIsSet(featureID);
}
} //TransitionImpl