/** * Copyright (c) 2012-2016 Marsha Chechik, Alessio Di Sandro, Michalis Famelis, * Rick Salay. * All rights reserved. This program and the accompanying materials * are made available under the terms of the Eclipse Public License v1.0 * which accompanies this distribution, and is available at * http://www.eclipse.org/legal/epl-v10.html * * Contributors: * Alessio Di Sandro - Implementation. */ package edu.toronto.cs.se.modelepedia.statemachine_mavo.impl; import edu.toronto.cs.se.modelepedia.statemachine_mavo.AbstractState; import edu.toronto.cs.se.modelepedia.statemachine_mavo.StateMachine_MAVOPackage; import edu.toronto.cs.se.modelepedia.statemachine_mavo.Transition; 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>Transition</b></em>'. * <!-- end-user-doc --> * <p> * The following features are implemented: * </p> * <ul> * <li>{@link edu.toronto.cs.se.modelepedia.statemachine_mavo.impl.TransitionImpl#getSource <em>Source</em>}</li> * <li>{@link edu.toronto.cs.se.modelepedia.statemachine_mavo.impl.TransitionImpl#getTarget <em>Target</em>}</li> * </ul> * * @generated */ public class TransitionImpl extends FiringElementImpl implements Transition { /** * The cached value of the '{@link #getSource() <em>Source</em>}' reference. * <!-- begin-user-doc --> * <!-- end-user-doc --> * @see #getSource() * @generated * @ordered */ protected AbstractState source; /** * The cached value of the '{@link #getTarget() <em>Target</em>}' reference. * <!-- begin-user-doc --> * <!-- end-user-doc --> * @see #getTarget() * @generated * @ordered */ protected AbstractState target; /** * <!-- begin-user-doc --> * <!-- end-user-doc --> * @generated */ protected TransitionImpl() { super(); } /** * <!-- begin-user-doc --> * <!-- end-user-doc --> * @generated */ @Override protected EClass eStaticClass() { return StateMachine_MAVOPackage.Literals.TRANSITION; } /** * <!-- begin-user-doc --> * <!-- end-user-doc --> * @generated */ public AbstractState getSource() { if (source != null && source.eIsProxy()) { InternalEObject oldSource = (InternalEObject)source; source = (AbstractState)eResolveProxy(oldSource); if (source != oldSource) { if (eNotificationRequired()) eNotify(new ENotificationImpl(this, Notification.RESOLVE, StateMachine_MAVOPackage.TRANSITION__SOURCE, oldSource, source)); } } return source; } /** * <!-- begin-user-doc --> * <!-- end-user-doc --> * @generated */ public AbstractState basicGetSource() { return source; } /** * <!-- begin-user-doc --> * <!-- end-user-doc --> * @generated */ public NotificationChain basicSetSource(AbstractState newSource, NotificationChain msgs) { AbstractState oldSource = source; source = newSource; if (eNotificationRequired()) { ENotificationImpl notification = new ENotificationImpl(this, Notification.SET, StateMachine_MAVOPackage.TRANSITION__SOURCE, oldSource, newSource); if (msgs == null) msgs = notification; else msgs.add(notification); } return msgs; } /** * <!-- begin-user-doc --> * <!-- end-user-doc --> * @generated */ public void setSource(AbstractState newSource) { if (newSource != source) { NotificationChain msgs = null; if (source != null) msgs = ((InternalEObject)source).eInverseRemove(this, StateMachine_MAVOPackage.ABSTRACT_STATE__TRANSITIONS_AS_SOURCE, AbstractState.class, msgs); if (newSource != null) msgs = ((InternalEObject)newSource).eInverseAdd(this, StateMachine_MAVOPackage.ABSTRACT_STATE__TRANSITIONS_AS_SOURCE, AbstractState.class, msgs); msgs = basicSetSource(newSource, msgs); if (msgs != null) msgs.dispatch(); } else if (eNotificationRequired()) eNotify(new ENotificationImpl(this, Notification.SET, StateMachine_MAVOPackage.TRANSITION__SOURCE, newSource, newSource)); } /** * <!-- begin-user-doc --> * <!-- end-user-doc --> * @generated */ public AbstractState getTarget() { if (target != null && target.eIsProxy()) { InternalEObject oldTarget = (InternalEObject)target; target = (AbstractState)eResolveProxy(oldTarget); if (target != oldTarget) { if (eNotificationRequired()) eNotify(new ENotificationImpl(this, Notification.RESOLVE, StateMachine_MAVOPackage.TRANSITION__TARGET, oldTarget, target)); } } return target; } /** * <!-- begin-user-doc --> * <!-- end-user-doc --> * @generated */ public AbstractState basicGetTarget() { return target; } /** * <!-- begin-user-doc --> * <!-- end-user-doc --> * @generated */ public NotificationChain basicSetTarget(AbstractState newTarget, NotificationChain msgs) { AbstractState oldTarget = target; target = newTarget; if (eNotificationRequired()) { ENotificationImpl notification = new ENotificationImpl(this, Notification.SET, StateMachine_MAVOPackage.TRANSITION__TARGET, oldTarget, newTarget); if (msgs == null) msgs = notification; else msgs.add(notification); } return msgs; } /** * <!-- begin-user-doc --> * <!-- end-user-doc --> * @generated */ public void setTarget(AbstractState newTarget) { if (newTarget != target) { NotificationChain msgs = null; if (target != null) msgs = ((InternalEObject)target).eInverseRemove(this, StateMachine_MAVOPackage.ABSTRACT_STATE__TRANSITIONS_AS_TARGET, AbstractState.class, msgs); if (newTarget != null) msgs = ((InternalEObject)newTarget).eInverseAdd(this, StateMachine_MAVOPackage.ABSTRACT_STATE__TRANSITIONS_AS_TARGET, AbstractState.class, msgs); msgs = basicSetTarget(newTarget, msgs); if (msgs != null) msgs.dispatch(); } else if (eNotificationRequired()) eNotify(new ENotificationImpl(this, Notification.SET, StateMachine_MAVOPackage.TRANSITION__TARGET, newTarget, newTarget)); } /** * <!-- begin-user-doc --> * <!-- end-user-doc --> * @generated */ @Override public NotificationChain eInverseAdd(InternalEObject otherEnd, int featureID, NotificationChain msgs) { switch (featureID) { case StateMachine_MAVOPackage.TRANSITION__SOURCE: if (source != null) msgs = ((InternalEObject)source).eInverseRemove(this, StateMachine_MAVOPackage.ABSTRACT_STATE__TRANSITIONS_AS_SOURCE, AbstractState.class, msgs); return basicSetSource((AbstractState)otherEnd, msgs); case StateMachine_MAVOPackage.TRANSITION__TARGET: if (target != null) msgs = ((InternalEObject)target).eInverseRemove(this, StateMachine_MAVOPackage.ABSTRACT_STATE__TRANSITIONS_AS_TARGET, AbstractState.class, msgs); return basicSetTarget((AbstractState)otherEnd, msgs); } return super.eInverseAdd(otherEnd, featureID, msgs); } /** * <!-- begin-user-doc --> * <!-- end-user-doc --> * @generated */ @Override public NotificationChain eInverseRemove(InternalEObject otherEnd, int featureID, NotificationChain msgs) { switch (featureID) { case StateMachine_MAVOPackage.TRANSITION__SOURCE: return basicSetSource(null, msgs); case StateMachine_MAVOPackage.TRANSITION__TARGET: return basicSetTarget(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 StateMachine_MAVOPackage.TRANSITION__SOURCE: if (resolve) return getSource(); return basicGetSource(); case StateMachine_MAVOPackage.TRANSITION__TARGET: if (resolve) return getTarget(); return basicGetTarget(); } return super.eGet(featureID, resolve, coreType); } /** * <!-- begin-user-doc --> * <!-- end-user-doc --> * @generated */ @Override public void eSet(int featureID, Object newValue) { switch (featureID) { case StateMachine_MAVOPackage.TRANSITION__SOURCE: setSource((AbstractState)newValue); return; case StateMachine_MAVOPackage.TRANSITION__TARGET: setTarget((AbstractState)newValue); return; } super.eSet(featureID, newValue); } /** * <!-- begin-user-doc --> * <!-- end-user-doc --> * @generated */ @Override public void eUnset(int featureID) { switch (featureID) { case StateMachine_MAVOPackage.TRANSITION__SOURCE: setSource((AbstractState)null); return; case StateMachine_MAVOPackage.TRANSITION__TARGET: setTarget((AbstractState)null); return; } super.eUnset(featureID); } /** * <!-- begin-user-doc --> * <!-- end-user-doc --> * @generated */ @Override public boolean eIsSet(int featureID) { switch (featureID) { case StateMachine_MAVOPackage.TRANSITION__SOURCE: return source != null; case StateMachine_MAVOPackage.TRANSITION__TARGET: return target != null; } return super.eIsSet(featureID); } } //TransitionImpl