/** * <copyright> * </copyright> * * $Id$ */ package org.eclipse.etrice.generator.etricegen.impl; import org.eclipse.etrice.core.room.SPPRef; import org.eclipse.etrice.generator.etricegen.ConnectionInstance; import org.eclipse.etrice.generator.etricegen.ETriceGenPackage; import org.eclipse.etrice.generator.etricegen.SPPInstance; 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.util.EObjectWithInverseResolvingEList; import org.eclipse.emf.ecore.util.InternalEList; /** * <!-- begin-user-doc --> * An implementation of the model object '<em><b>SPP Instance</b></em>'. * <!-- end-user-doc --> * <p> * The following features are implemented: * <ul> * <li>{@link org.eclipse.etrice.generator.etricegen.impl.SPPInstanceImpl#getSpp <em>Spp</em>}</li> * <li>{@link org.eclipse.etrice.generator.etricegen.impl.SPPInstanceImpl#getIncoming <em>Incoming</em>}</li> * <li>{@link org.eclipse.etrice.generator.etricegen.impl.SPPInstanceImpl#getOutgoing <em>Outgoing</em>}</li> * </ul> * </p> * * @generated */ public class SPPInstanceImpl extends InstanceBaseImpl implements SPPInstance { /** * The cached value of the '{@link #getSpp() <em>Spp</em>}' reference. * <!-- begin-user-doc --> * <!-- end-user-doc --> * @see #getSpp() * @generated * @ordered */ protected SPPRef spp; /** * The cached value of the '{@link #getIncoming() <em>Incoming</em>}' reference list. * <!-- begin-user-doc --> * <!-- end-user-doc --> * @see #getIncoming() * @generated * @ordered */ protected EList<ConnectionInstance> incoming; /** * The cached value of the '{@link #getOutgoing() <em>Outgoing</em>}' reference. * <!-- begin-user-doc --> * <!-- end-user-doc --> * @see #getOutgoing() * @generated * @ordered */ protected ConnectionInstance outgoing; /** * <!-- begin-user-doc --> * <!-- end-user-doc --> * @generated */ protected SPPInstanceImpl() { super(); } /** * <!-- begin-user-doc --> * <!-- end-user-doc --> * @generated */ @Override protected EClass eStaticClass() { return ETriceGenPackage.Literals.SPP_INSTANCE; } /** * <!-- begin-user-doc --> * <!-- end-user-doc --> * @generated */ public SPPRef getSpp() { if (spp != null && spp.eIsProxy()) { InternalEObject oldSpp = (InternalEObject)spp; spp = (SPPRef)eResolveProxy(oldSpp); if (spp != oldSpp) { if (eNotificationRequired()) eNotify(new ENotificationImpl(this, Notification.RESOLVE, ETriceGenPackage.SPP_INSTANCE__SPP, oldSpp, spp)); } } return spp; } /** * <!-- begin-user-doc --> * <!-- end-user-doc --> * @generated */ public SPPRef basicGetSpp() { return spp; } /** * <!-- begin-user-doc --> * <!-- end-user-doc --> * @generated */ public void setSpp(SPPRef newSpp) { SPPRef oldSpp = spp; spp = newSpp; if (eNotificationRequired()) eNotify(new ENotificationImpl(this, Notification.SET, ETriceGenPackage.SPP_INSTANCE__SPP, oldSpp, spp)); } /** * <!-- begin-user-doc --> * <!-- end-user-doc --> * @generated */ public EList<ConnectionInstance> getIncoming() { if (incoming == null) { incoming = new EObjectWithInverseResolvingEList<ConnectionInstance>(ConnectionInstance.class, this, ETriceGenPackage.SPP_INSTANCE__INCOMING, ETriceGenPackage.CONNECTION_INSTANCE__TO_SPP); } return incoming; } /** * <!-- begin-user-doc --> * <!-- end-user-doc --> * @generated */ public ConnectionInstance getOutgoing() { if (outgoing != null && outgoing.eIsProxy()) { InternalEObject oldOutgoing = (InternalEObject)outgoing; outgoing = (ConnectionInstance)eResolveProxy(oldOutgoing); if (outgoing != oldOutgoing) { if (eNotificationRequired()) eNotify(new ENotificationImpl(this, Notification.RESOLVE, ETriceGenPackage.SPP_INSTANCE__OUTGOING, oldOutgoing, outgoing)); } } return outgoing; } /** * <!-- begin-user-doc --> * <!-- end-user-doc --> * @generated */ public ConnectionInstance basicGetOutgoing() { return outgoing; } /** * <!-- begin-user-doc --> * <!-- end-user-doc --> * @generated */ public NotificationChain basicSetOutgoing(ConnectionInstance newOutgoing, NotificationChain msgs) { ConnectionInstance oldOutgoing = outgoing; outgoing = newOutgoing; if (eNotificationRequired()) { ENotificationImpl notification = new ENotificationImpl(this, Notification.SET, ETriceGenPackage.SPP_INSTANCE__OUTGOING, oldOutgoing, newOutgoing); if (msgs == null) msgs = notification; else msgs.add(notification); } return msgs; } /** * <!-- begin-user-doc --> * <!-- end-user-doc --> * @generated */ public void setOutgoing(ConnectionInstance newOutgoing) { if (newOutgoing != outgoing) { NotificationChain msgs = null; if (outgoing != null) msgs = ((InternalEObject)outgoing).eInverseRemove(this, ETriceGenPackage.CONNECTION_INSTANCE__FROM_SPP, ConnectionInstance.class, msgs); if (newOutgoing != null) msgs = ((InternalEObject)newOutgoing).eInverseAdd(this, ETriceGenPackage.CONNECTION_INSTANCE__FROM_SPP, ConnectionInstance.class, msgs); msgs = basicSetOutgoing(newOutgoing, msgs); if (msgs != null) msgs.dispatch(); } else if (eNotificationRequired()) eNotify(new ENotificationImpl(this, Notification.SET, ETriceGenPackage.SPP_INSTANCE__OUTGOING, newOutgoing, newOutgoing)); } /** * <!-- begin-user-doc --> * <!-- end-user-doc --> * @generated */ @SuppressWarnings("unchecked") @Override public NotificationChain eInverseAdd(InternalEObject otherEnd, int featureID, NotificationChain msgs) { switch (featureID) { case ETriceGenPackage.SPP_INSTANCE__INCOMING: return ((InternalEList<InternalEObject>)(InternalEList<?>)getIncoming()).basicAdd(otherEnd, msgs); case ETriceGenPackage.SPP_INSTANCE__OUTGOING: if (outgoing != null) msgs = ((InternalEObject)outgoing).eInverseRemove(this, ETriceGenPackage.CONNECTION_INSTANCE__FROM_SPP, ConnectionInstance.class, msgs); return basicSetOutgoing((ConnectionInstance)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 ETriceGenPackage.SPP_INSTANCE__INCOMING: return ((InternalEList<?>)getIncoming()).basicRemove(otherEnd, msgs); case ETriceGenPackage.SPP_INSTANCE__OUTGOING: return basicSetOutgoing(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 ETriceGenPackage.SPP_INSTANCE__SPP: if (resolve) return getSpp(); return basicGetSpp(); case ETriceGenPackage.SPP_INSTANCE__INCOMING: return getIncoming(); case ETriceGenPackage.SPP_INSTANCE__OUTGOING: if (resolve) return getOutgoing(); return basicGetOutgoing(); } return super.eGet(featureID, resolve, coreType); } /** * <!-- begin-user-doc --> * <!-- end-user-doc --> * @generated */ @SuppressWarnings("unchecked") @Override public void eSet(int featureID, Object newValue) { switch (featureID) { case ETriceGenPackage.SPP_INSTANCE__SPP: setSpp((SPPRef)newValue); return; case ETriceGenPackage.SPP_INSTANCE__INCOMING: getIncoming().clear(); getIncoming().addAll((Collection<? extends ConnectionInstance>)newValue); return; case ETriceGenPackage.SPP_INSTANCE__OUTGOING: setOutgoing((ConnectionInstance)newValue); return; } super.eSet(featureID, newValue); } /** * <!-- begin-user-doc --> * <!-- end-user-doc --> * @generated */ @Override public void eUnset(int featureID) { switch (featureID) { case ETriceGenPackage.SPP_INSTANCE__SPP: setSpp((SPPRef)null); return; case ETriceGenPackage.SPP_INSTANCE__INCOMING: getIncoming().clear(); return; case ETriceGenPackage.SPP_INSTANCE__OUTGOING: setOutgoing((ConnectionInstance)null); return; } super.eUnset(featureID); } /** * <!-- begin-user-doc --> * <!-- end-user-doc --> * @generated */ @Override public boolean eIsSet(int featureID) { switch (featureID) { case ETriceGenPackage.SPP_INSTANCE__SPP: return spp != null; case ETriceGenPackage.SPP_INSTANCE__INCOMING: return incoming != null && !incoming.isEmpty(); case ETriceGenPackage.SPP_INSTANCE__OUTGOING: return outgoing != null; } return super.eIsSet(featureID); } } //SPPInstanceImpl