/** * <copyright> * </copyright> * * $Id: SDMessageImpl.java,v 1.1 2009/01/28 05:27:46 mgolubev Exp $ */ package org.eclipse.uml2.diagram.sequence.model.sequenced.impl; 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.uml2.diagram.sequence.model.sequenced.SDExecution; import org.eclipse.uml2.diagram.sequence.model.sequenced.SDInvocation; import org.eclipse.uml2.diagram.sequence.model.sequenced.SDMessage; import org.eclipse.uml2.diagram.sequence.model.sequenced.SDPackage; /** * <!-- begin-user-doc --> * An implementation of the model object '<em><b>Message</b></em>'. * <!-- end-user-doc --> * <p> * The following features are implemented: * <ul> * <li>{@link org.eclipse.uml2.diagram.sequence.model.sequenced.impl.SDMessageImpl#getSource <em>Source</em>}</li> * <li>{@link org.eclipse.uml2.diagram.sequence.model.sequenced.impl.SDMessageImpl#getTarget <em>Target</em>}</li> * </ul> * </p> * * @generated */ public class SDMessageImpl extends SDAbstractMessageImpl implements SDMessage { /** * The cached value of the '{@link #getSource() <em>Source</em>}' reference. * <!-- begin-user-doc --> * <!-- end-user-doc --> * @see #getSource() * @generated * @ordered */ protected SDInvocation source; /** * The cached value of the '{@link #getTarget() <em>Target</em>}' reference. * <!-- begin-user-doc --> * <!-- end-user-doc --> * @see #getTarget() * @generated * @ordered */ protected SDExecution target; /** * <!-- begin-user-doc --> * <!-- end-user-doc --> * @generated */ protected SDMessageImpl() { super(); } /** * <!-- begin-user-doc --> * <!-- end-user-doc --> * @generated */ @Override protected EClass eStaticClass() { return SDPackage.Literals.SD_MESSAGE; } /** * <!-- begin-user-doc --> * <!-- end-user-doc --> * @generated */ public SDInvocation getSource() { if (source != null && source.eIsProxy()) { InternalEObject oldSource = (InternalEObject)source; source = (SDInvocation)eResolveProxy(oldSource); if (source != oldSource) { if (eNotificationRequired()) eNotify(new ENotificationImpl(this, Notification.RESOLVE, SDPackage.SD_MESSAGE__SOURCE, oldSource, source)); } } return source; } /** * <!-- begin-user-doc --> * <!-- end-user-doc --> * @generated */ public SDInvocation basicGetSource() { return source; } /** * <!-- begin-user-doc --> * <!-- end-user-doc --> * @generated */ public NotificationChain basicSetSource(SDInvocation newSource, NotificationChain msgs) { SDInvocation oldSource = source; source = newSource; if (eNotificationRequired()) { ENotificationImpl notification = new ENotificationImpl(this, Notification.SET, SDPackage.SD_MESSAGE__SOURCE, oldSource, newSource); if (msgs == null) msgs = notification; else msgs.add(notification); } return msgs; } /** * <!-- begin-user-doc --> * <!-- end-user-doc --> * @generated */ public void setSource(SDInvocation newSource) { if (newSource != source) { NotificationChain msgs = null; if (source != null) msgs = ((InternalEObject)source).eInverseRemove(this, SDPackage.SD_INVOCATION__OUTGOING_MESSAGE, SDInvocation.class, msgs); if (newSource != null) msgs = ((InternalEObject)newSource).eInverseAdd(this, SDPackage.SD_INVOCATION__OUTGOING_MESSAGE, SDInvocation.class, msgs); msgs = basicSetSource(newSource, msgs); if (msgs != null) msgs.dispatch(); } else if (eNotificationRequired()) eNotify(new ENotificationImpl(this, Notification.SET, SDPackage.SD_MESSAGE__SOURCE, newSource, newSource)); } /** * <!-- begin-user-doc --> * <!-- end-user-doc --> * @generated */ public SDExecution getTarget() { if (target != null && target.eIsProxy()) { InternalEObject oldTarget = (InternalEObject)target; target = (SDExecution)eResolveProxy(oldTarget); if (target != oldTarget) { if (eNotificationRequired()) eNotify(new ENotificationImpl(this, Notification.RESOLVE, SDPackage.SD_MESSAGE__TARGET, oldTarget, target)); } } return target; } /** * <!-- begin-user-doc --> * <!-- end-user-doc --> * @generated */ public SDExecution basicGetTarget() { return target; } /** * <!-- begin-user-doc --> * <!-- end-user-doc --> * @generated */ public NotificationChain basicSetTarget(SDExecution newTarget, NotificationChain msgs) { SDExecution oldTarget = target; target = newTarget; if (eNotificationRequired()) { ENotificationImpl notification = new ENotificationImpl(this, Notification.SET, SDPackage.SD_MESSAGE__TARGET, oldTarget, newTarget); if (msgs == null) msgs = notification; else msgs.add(notification); } return msgs; } /** * <!-- begin-user-doc --> * <!-- end-user-doc --> * @generated */ public void setTarget(SDExecution newTarget) { if (newTarget != target) { NotificationChain msgs = null; if (target != null) msgs = ((InternalEObject)target).eInverseRemove(this, SDPackage.SD_EXECUTION__INCOMING_MESSAGE, SDExecution.class, msgs); if (newTarget != null) msgs = ((InternalEObject)newTarget).eInverseAdd(this, SDPackage.SD_EXECUTION__INCOMING_MESSAGE, SDExecution.class, msgs); msgs = basicSetTarget(newTarget, msgs); if (msgs != null) msgs.dispatch(); } else if (eNotificationRequired()) eNotify(new ENotificationImpl(this, Notification.SET, SDPackage.SD_MESSAGE__TARGET, newTarget, newTarget)); } /** * <!-- begin-user-doc --> * <!-- end-user-doc --> * @generated */ @Override public NotificationChain eInverseAdd(InternalEObject otherEnd, int featureID, NotificationChain msgs) { switch (featureID) { case SDPackage.SD_MESSAGE__SOURCE: if (source != null) msgs = ((InternalEObject)source).eInverseRemove(this, SDPackage.SD_INVOCATION__OUTGOING_MESSAGE, SDInvocation.class, msgs); return basicSetSource((SDInvocation)otherEnd, msgs); case SDPackage.SD_MESSAGE__TARGET: if (target != null) msgs = ((InternalEObject)target).eInverseRemove(this, SDPackage.SD_EXECUTION__INCOMING_MESSAGE, SDExecution.class, msgs); return basicSetTarget((SDExecution)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 SDPackage.SD_MESSAGE__SOURCE: return basicSetSource(null, msgs); case SDPackage.SD_MESSAGE__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 SDPackage.SD_MESSAGE__SOURCE: if (resolve) return getSource(); return basicGetSource(); case SDPackage.SD_MESSAGE__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 SDPackage.SD_MESSAGE__SOURCE: setSource((SDInvocation)newValue); return; case SDPackage.SD_MESSAGE__TARGET: setTarget((SDExecution)newValue); return; } super.eSet(featureID, newValue); } /** * <!-- begin-user-doc --> * <!-- end-user-doc --> * @generated */ @Override public void eUnset(int featureID) { switch (featureID) { case SDPackage.SD_MESSAGE__SOURCE: setSource((SDInvocation)null); return; case SDPackage.SD_MESSAGE__TARGET: setTarget((SDExecution)null); return; } super.eUnset(featureID); } /** * <!-- begin-user-doc --> * <!-- end-user-doc --> * @generated */ @Override public boolean eIsSet(int featureID) { switch (featureID) { case SDPackage.SD_MESSAGE__SOURCE: return source != null; case SDPackage.SD_MESSAGE__TARGET: return target != null; } return super.eIsSet(featureID); } } //SDMessageImpl