/******************************************************************************* * Copyright (c) 2010-2013, Embraer S.A., Budapest University of Technology and Economics * 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: * Abel Hegedus, Akos Horvath - initial API and implementation *******************************************************************************/ /** */ package hu.bme.mit.massif.simulink.impl; import hu.bme.mit.massif.simulink.Connection; import hu.bme.mit.massif.simulink.OutPort; import hu.bme.mit.massif.simulink.SimulinkPackage; 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>Out Port</b></em>'. * <!-- end-user-doc --> * <p> * The following features are implemented: * <ul> * <li>{@link hu.bme.mit.massif.simulink.impl.OutPortImpl#getConnection <em>Connection</em>}</li> * </ul> * </p> * * @generated */ public class OutPortImpl extends PortImpl implements OutPort { /** * The cached value of the '{@link #getConnection() <em>Connection</em>}' containment reference. * <!-- begin-user-doc --> * <!-- end-user-doc --> * @see #getConnection() * @generated * @ordered */ protected Connection connection; /** * <!-- begin-user-doc --> * <!-- end-user-doc --> * @generated */ protected OutPortImpl() { super(); } /** * <!-- begin-user-doc --> * <!-- end-user-doc --> * @generated */ @Override protected EClass eStaticClass() { return SimulinkPackage.Literals.OUT_PORT; } /** * <!-- begin-user-doc --> * <!-- end-user-doc --> * @generated */ public Connection getConnection() { return connection; } /** * <!-- begin-user-doc --> * <!-- end-user-doc --> * @generated */ public NotificationChain basicSetConnection(Connection newConnection, NotificationChain msgs) { Connection oldConnection = connection; connection = newConnection; if (eNotificationRequired()) { ENotificationImpl notification = new ENotificationImpl(this, Notification.SET, SimulinkPackage.OUT_PORT__CONNECTION, oldConnection, newConnection); if (msgs == null) msgs = notification; else msgs.add(notification); } return msgs; } /** * <!-- begin-user-doc --> * <!-- end-user-doc --> * @generated */ public void setConnection(Connection newConnection) { if (newConnection != connection) { NotificationChain msgs = null; if (connection != null) msgs = ((InternalEObject)connection).eInverseRemove(this, SimulinkPackage.CONNECTION__FROM, Connection.class, msgs); if (newConnection != null) msgs = ((InternalEObject)newConnection).eInverseAdd(this, SimulinkPackage.CONNECTION__FROM, Connection.class, msgs); msgs = basicSetConnection(newConnection, msgs); if (msgs != null) msgs.dispatch(); } else if (eNotificationRequired()) eNotify(new ENotificationImpl(this, Notification.SET, SimulinkPackage.OUT_PORT__CONNECTION, newConnection, newConnection)); } /** * <!-- begin-user-doc --> * <!-- end-user-doc --> * @generated */ @Override public NotificationChain eInverseAdd(InternalEObject otherEnd, int featureID, NotificationChain msgs) { switch (featureID) { case SimulinkPackage.OUT_PORT__CONNECTION: if (connection != null) msgs = ((InternalEObject)connection).eInverseRemove(this, EOPPOSITE_FEATURE_BASE - SimulinkPackage.OUT_PORT__CONNECTION, null, msgs); return basicSetConnection((Connection)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 SimulinkPackage.OUT_PORT__CONNECTION: return basicSetConnection(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 SimulinkPackage.OUT_PORT__CONNECTION: return getConnection(); } return super.eGet(featureID, resolve, coreType); } /** * <!-- begin-user-doc --> * <!-- end-user-doc --> * @generated */ @Override public void eSet(int featureID, Object newValue) { switch (featureID) { case SimulinkPackage.OUT_PORT__CONNECTION: setConnection((Connection)newValue); return; } super.eSet(featureID, newValue); } /** * <!-- begin-user-doc --> * <!-- end-user-doc --> * @generated */ @Override public void eUnset(int featureID) { switch (featureID) { case SimulinkPackage.OUT_PORT__CONNECTION: setConnection((Connection)null); return; } super.eUnset(featureID); } /** * <!-- begin-user-doc --> * <!-- end-user-doc --> * @generated */ @Override public boolean eIsSet(int featureID) { switch (featureID) { case SimulinkPackage.OUT_PORT__CONNECTION: return connection != null; } return super.eIsSet(featureID); } } //OutPortImpl