/******************************************************************************* * 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.MultiConnection; import hu.bme.mit.massif.simulink.SimulinkPackage; import hu.bme.mit.massif.simulink.SingleConnection; import java.util.Collection; 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.util.EObjectContainmentWithInverseEList; import org.eclipse.emf.ecore.util.InternalEList; /** * <!-- begin-user-doc --> * An implementation of the model object '<em><b>Multi Connection</b></em>'. * <!-- end-user-doc --> * <p> * The following features are implemented: * <ul> * <li>{@link hu.bme.mit.massif.simulink.impl.MultiConnectionImpl#getConnections <em>Connections</em>}</li> * </ul> * </p> * * @generated */ public class MultiConnectionImpl extends ConnectionImpl implements MultiConnection { /** * The cached value of the '{@link #getConnections() <em>Connections</em>}' containment reference list. * <!-- begin-user-doc --> * <!-- end-user-doc --> * @see #getConnections() * @generated * @ordered */ protected EList<SingleConnection> connections; /** * <!-- begin-user-doc --> * <!-- end-user-doc --> * @generated */ protected MultiConnectionImpl() { super(); } /** * <!-- begin-user-doc --> * <!-- end-user-doc --> * @generated */ @Override protected EClass eStaticClass() { return SimulinkPackage.Literals.MULTI_CONNECTION; } /** * <!-- begin-user-doc --> * <!-- end-user-doc --> * @generated */ public EList<SingleConnection> getConnections() { if (connections == null) { connections = new EObjectContainmentWithInverseEList<SingleConnection>(SingleConnection.class, this, SimulinkPackage.MULTI_CONNECTION__CONNECTIONS, SimulinkPackage.SINGLE_CONNECTION__PARENT); } return connections; } /** * <!-- begin-user-doc --> * <!-- end-user-doc --> * @generated */ @SuppressWarnings("unchecked") @Override public NotificationChain eInverseAdd(InternalEObject otherEnd, int featureID, NotificationChain msgs) { switch (featureID) { case SimulinkPackage.MULTI_CONNECTION__CONNECTIONS: return ((InternalEList<InternalEObject>)(InternalEList<?>)getConnections()).basicAdd(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.MULTI_CONNECTION__CONNECTIONS: return ((InternalEList<?>)getConnections()).basicRemove(otherEnd, 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.MULTI_CONNECTION__CONNECTIONS: return getConnections(); } 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 SimulinkPackage.MULTI_CONNECTION__CONNECTIONS: getConnections().clear(); getConnections().addAll((Collection<? extends SingleConnection>)newValue); return; } super.eSet(featureID, newValue); } /** * <!-- begin-user-doc --> * <!-- end-user-doc --> * @generated */ @Override public void eUnset(int featureID) { switch (featureID) { case SimulinkPackage.MULTI_CONNECTION__CONNECTIONS: getConnections().clear(); return; } super.eUnset(featureID); } /** * <!-- begin-user-doc --> * <!-- end-user-doc --> * @generated */ @Override public boolean eIsSet(int featureID) { switch (featureID) { case SimulinkPackage.MULTI_CONNECTION__CONNECTIONS: return connections != null && !connections.isEmpty(); } return super.eIsSet(featureID); } } //MultiConnectionImpl