/** * <copyright> * </copyright> * */ package org.eclipse.etrice.core.room.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.emf.ecore.impl.MinimalEObjectImpl; import org.eclipse.etrice.core.room.LayerConnection; import org.eclipse.etrice.core.room.RoomPackage; import org.eclipse.etrice.core.room.SAPoint; import org.eclipse.etrice.core.room.SPPoint; /** * <!-- begin-user-doc --> * An implementation of the model object '<em><b>Layer Connection</b></em>'. * <!-- end-user-doc --> * <p> * The following features are implemented: * <ul> * <li>{@link org.eclipse.etrice.core.room.impl.LayerConnectionImpl#getFrom <em>From</em>}</li> * <li>{@link org.eclipse.etrice.core.room.impl.LayerConnectionImpl#getTo <em>To</em>}</li> * </ul> * </p> * * @generated */ public class LayerConnectionImpl extends MinimalEObjectImpl.Container implements LayerConnection { /** * The cached value of the '{@link #getFrom() <em>From</em>}' containment reference. * <!-- begin-user-doc --> * <!-- end-user-doc --> * @see #getFrom() * @generated * @ordered */ protected SAPoint from; /** * The cached value of the '{@link #getTo() <em>To</em>}' containment reference. * <!-- begin-user-doc --> * <!-- end-user-doc --> * @see #getTo() * @generated * @ordered */ protected SPPoint to; /** * <!-- begin-user-doc --> * <!-- end-user-doc --> * @generated */ protected LayerConnectionImpl() { super(); } /** * <!-- begin-user-doc --> * <!-- end-user-doc --> * @generated */ @Override protected EClass eStaticClass() { return RoomPackage.Literals.LAYER_CONNECTION; } /** * <!-- begin-user-doc --> * <!-- end-user-doc --> * @generated */ public SAPoint getFrom() { return from; } /** * <!-- begin-user-doc --> * <!-- end-user-doc --> * @generated */ public NotificationChain basicSetFrom(SAPoint newFrom, NotificationChain msgs) { SAPoint oldFrom = from; from = newFrom; if (eNotificationRequired()) { ENotificationImpl notification = new ENotificationImpl(this, Notification.SET, RoomPackage.LAYER_CONNECTION__FROM, oldFrom, newFrom); if (msgs == null) msgs = notification; else msgs.add(notification); } return msgs; } /** * <!-- begin-user-doc --> * <!-- end-user-doc --> * @generated */ public void setFrom(SAPoint newFrom) { if (newFrom != from) { NotificationChain msgs = null; if (from != null) msgs = ((InternalEObject)from).eInverseRemove(this, EOPPOSITE_FEATURE_BASE - RoomPackage.LAYER_CONNECTION__FROM, null, msgs); if (newFrom != null) msgs = ((InternalEObject)newFrom).eInverseAdd(this, EOPPOSITE_FEATURE_BASE - RoomPackage.LAYER_CONNECTION__FROM, null, msgs); msgs = basicSetFrom(newFrom, msgs); if (msgs != null) msgs.dispatch(); } else if (eNotificationRequired()) eNotify(new ENotificationImpl(this, Notification.SET, RoomPackage.LAYER_CONNECTION__FROM, newFrom, newFrom)); } /** * <!-- begin-user-doc --> * <!-- end-user-doc --> * @generated */ public SPPoint getTo() { return to; } /** * <!-- begin-user-doc --> * <!-- end-user-doc --> * @generated */ public NotificationChain basicSetTo(SPPoint newTo, NotificationChain msgs) { SPPoint oldTo = to; to = newTo; if (eNotificationRequired()) { ENotificationImpl notification = new ENotificationImpl(this, Notification.SET, RoomPackage.LAYER_CONNECTION__TO, oldTo, newTo); if (msgs == null) msgs = notification; else msgs.add(notification); } return msgs; } /** * <!-- begin-user-doc --> * <!-- end-user-doc --> * @generated */ public void setTo(SPPoint newTo) { if (newTo != to) { NotificationChain msgs = null; if (to != null) msgs = ((InternalEObject)to).eInverseRemove(this, EOPPOSITE_FEATURE_BASE - RoomPackage.LAYER_CONNECTION__TO, null, msgs); if (newTo != null) msgs = ((InternalEObject)newTo).eInverseAdd(this, EOPPOSITE_FEATURE_BASE - RoomPackage.LAYER_CONNECTION__TO, null, msgs); msgs = basicSetTo(newTo, msgs); if (msgs != null) msgs.dispatch(); } else if (eNotificationRequired()) eNotify(new ENotificationImpl(this, Notification.SET, RoomPackage.LAYER_CONNECTION__TO, newTo, newTo)); } /** * <!-- begin-user-doc --> * <!-- end-user-doc --> * @generated */ @Override public NotificationChain eInverseRemove(InternalEObject otherEnd, int featureID, NotificationChain msgs) { switch (featureID) { case RoomPackage.LAYER_CONNECTION__FROM: return basicSetFrom(null, msgs); case RoomPackage.LAYER_CONNECTION__TO: return basicSetTo(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 RoomPackage.LAYER_CONNECTION__FROM: return getFrom(); case RoomPackage.LAYER_CONNECTION__TO: return getTo(); } return super.eGet(featureID, resolve, coreType); } /** * <!-- begin-user-doc --> * <!-- end-user-doc --> * @generated */ @Override public void eSet(int featureID, Object newValue) { switch (featureID) { case RoomPackage.LAYER_CONNECTION__FROM: setFrom((SAPoint)newValue); return; case RoomPackage.LAYER_CONNECTION__TO: setTo((SPPoint)newValue); return; } super.eSet(featureID, newValue); } /** * <!-- begin-user-doc --> * <!-- end-user-doc --> * @generated */ @Override public void eUnset(int featureID) { switch (featureID) { case RoomPackage.LAYER_CONNECTION__FROM: setFrom((SAPoint)null); return; case RoomPackage.LAYER_CONNECTION__TO: setTo((SPPoint)null); return; } super.eUnset(featureID); } /** * <!-- begin-user-doc --> * <!-- end-user-doc --> * @generated */ @Override public boolean eIsSet(int featureID) { switch (featureID) { case RoomPackage.LAYER_CONNECTION__FROM: return from != null; case RoomPackage.LAYER_CONNECTION__TO: return to != null; } return super.eIsSet(featureID); } } //LayerConnectionImpl