/******************************************************************************* * 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.Port; import hu.bme.mit.massif.simulink.PortBlock; 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>Port Block</b></em>'. * <!-- end-user-doc --> * <p> * The following features are implemented: * <ul> * <li>{@link hu.bme.mit.massif.simulink.impl.PortBlockImpl#getPort <em>Port</em>}</li> * </ul> * </p> * * @generated */ public abstract class PortBlockImpl extends VirtualBlockImpl implements PortBlock { /** * The cached value of the '{@link #getPort() <em>Port</em>}' reference. * <!-- begin-user-doc --> * <!-- end-user-doc --> * @see #getPort() * @generated * @ordered */ protected Port port; /** * <!-- begin-user-doc --> * <!-- end-user-doc --> * @generated */ protected PortBlockImpl() { super(); } /** * <!-- begin-user-doc --> * <!-- end-user-doc --> * @generated */ @Override protected EClass eStaticClass() { return SimulinkPackage.Literals.PORT_BLOCK; } /** * <!-- begin-user-doc --> * <!-- end-user-doc --> * @generated */ public Port getPort() { if (port != null && port.eIsProxy()) { InternalEObject oldPort = (InternalEObject)port; port = (Port)eResolveProxy(oldPort); if (port != oldPort) { if (eNotificationRequired()) eNotify(new ENotificationImpl(this, Notification.RESOLVE, SimulinkPackage.PORT_BLOCK__PORT, oldPort, port)); } } return port; } /** * <!-- begin-user-doc --> * <!-- end-user-doc --> * @generated */ public Port basicGetPort() { return port; } /** * <!-- begin-user-doc --> * <!-- end-user-doc --> * @generated */ public NotificationChain basicSetPort(Port newPort, NotificationChain msgs) { Port oldPort = port; port = newPort; if (eNotificationRequired()) { ENotificationImpl notification = new ENotificationImpl(this, Notification.SET, SimulinkPackage.PORT_BLOCK__PORT, oldPort, newPort); if (msgs == null) msgs = notification; else msgs.add(notification); } return msgs; } /** * <!-- begin-user-doc --> * <!-- end-user-doc --> * @generated */ public void setPort(Port newPort) { if (newPort != port) { NotificationChain msgs = null; if (port != null) msgs = ((InternalEObject)port).eInverseRemove(this, SimulinkPackage.PORT__PORT_BLOCK, Port.class, msgs); if (newPort != null) msgs = ((InternalEObject)newPort).eInverseAdd(this, SimulinkPackage.PORT__PORT_BLOCK, Port.class, msgs); msgs = basicSetPort(newPort, msgs); if (msgs != null) msgs.dispatch(); } else if (eNotificationRequired()) eNotify(new ENotificationImpl(this, Notification.SET, SimulinkPackage.PORT_BLOCK__PORT, newPort, newPort)); } /** * <!-- begin-user-doc --> * <!-- end-user-doc --> * @generated */ @Override public NotificationChain eInverseAdd(InternalEObject otherEnd, int featureID, NotificationChain msgs) { switch (featureID) { case SimulinkPackage.PORT_BLOCK__PORT: if (port != null) msgs = ((InternalEObject)port).eInverseRemove(this, SimulinkPackage.PORT__PORT_BLOCK, Port.class, msgs); return basicSetPort((Port)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.PORT_BLOCK__PORT: return basicSetPort(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.PORT_BLOCK__PORT: if (resolve) return getPort(); return basicGetPort(); } 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.PORT_BLOCK__PORT: setPort((Port)newValue); return; } super.eSet(featureID, newValue); } /** * <!-- begin-user-doc --> * <!-- end-user-doc --> * @generated */ @Override public void eUnset(int featureID) { switch (featureID) { case SimulinkPackage.PORT_BLOCK__PORT: setPort((Port)null); return; } super.eUnset(featureID); } /** * <!-- begin-user-doc --> * <!-- end-user-doc --> * @generated */ @Override public boolean eIsSet(int featureID) { switch (featureID) { case SimulinkPackage.PORT_BLOCK__PORT: return port != null; } return super.eIsSet(featureID); } } //PortBlockImpl