| /** |
| * ******************************************************************************* |
| * Copyright (c) 2015-2021 Robert Bosch GmbH and others. |
| * |
| * This program and the accompanying materials are made |
| * available under the terms of the Eclipse Public License 2.0 |
| * which is available at https://www.eclipse.org/legal/epl-2.0/ |
| * |
| * SPDX-License-Identifier: EPL-2.0 |
| * |
| * Generated using Eclipse EMF |
| * |
| * ******************************************************************************* |
| */ |
| package org.eclipse.app4mc.amalthea.model.impl; |
| |
| import java.util.Collection; |
| |
| import org.eclipse.app4mc.amalthea.model.AmaltheaPackage; |
| import org.eclipse.app4mc.amalthea.model.ConnectionHandler; |
| import org.eclipse.app4mc.amalthea.model.ConnectionHandlerDefinition; |
| import org.eclipse.app4mc.amalthea.model.HwConnection; |
| |
| 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.EObjectContainmentEList; |
| import org.eclipse.emf.ecore.util.InternalEList; |
| |
| /** |
| * <!-- begin-user-doc --> |
| * An implementation of the model object '<em><b>Connection Handler</b></em>'. |
| * <!-- end-user-doc --> |
| * <p> |
| * The following features are implemented: |
| * </p> |
| * <ul> |
| * <li>{@link org.eclipse.app4mc.amalthea.model.impl.ConnectionHandlerImpl#getDefinition <em>Definition</em>}</li> |
| * <li>{@link org.eclipse.app4mc.amalthea.model.impl.ConnectionHandlerImpl#getInternalConnections <em>Internal Connections</em>}</li> |
| * </ul> |
| * |
| * @generated |
| */ |
| public class ConnectionHandlerImpl extends HwModuleImpl implements ConnectionHandler { |
| /** |
| * The cached value of the '{@link #getDefinition() <em>Definition</em>}' reference. |
| * <!-- begin-user-doc --> |
| * <!-- end-user-doc --> |
| * @see #getDefinition() |
| * @generated |
| * @ordered |
| */ |
| protected ConnectionHandlerDefinition definition; |
| |
| /** |
| * The cached value of the '{@link #getInternalConnections() <em>Internal Connections</em>}' containment reference list. |
| * <!-- begin-user-doc --> |
| * <!-- end-user-doc --> |
| * @see #getInternalConnections() |
| * @generated |
| * @ordered |
| */ |
| protected EList<HwConnection> internalConnections; |
| |
| /** |
| * <!-- begin-user-doc --> |
| * <!-- end-user-doc --> |
| * @generated |
| */ |
| protected ConnectionHandlerImpl() { |
| super(); |
| } |
| |
| /** |
| * <!-- begin-user-doc --> |
| * <!-- end-user-doc --> |
| * @generated |
| */ |
| @Override |
| protected EClass eStaticClass() { |
| return AmaltheaPackage.eINSTANCE.getConnectionHandler(); |
| } |
| |
| /** |
| * <!-- begin-user-doc --> |
| * <!-- end-user-doc --> |
| * @generated |
| */ |
| @Override |
| public ConnectionHandlerDefinition getDefinition() { |
| if (definition != null && definition.eIsProxy()) { |
| InternalEObject oldDefinition = (InternalEObject)definition; |
| definition = (ConnectionHandlerDefinition)eResolveProxy(oldDefinition); |
| if (definition != oldDefinition) { |
| if (eNotificationRequired()) |
| eNotify(new ENotificationImpl(this, Notification.RESOLVE, AmaltheaPackage.CONNECTION_HANDLER__DEFINITION, oldDefinition, definition)); |
| } |
| } |
| return definition; |
| } |
| |
| /** |
| * <!-- begin-user-doc --> |
| * <!-- end-user-doc --> |
| * @generated |
| */ |
| public ConnectionHandlerDefinition basicGetDefinition() { |
| return definition; |
| } |
| |
| /** |
| * <!-- begin-user-doc --> |
| * <!-- end-user-doc --> |
| * @generated |
| */ |
| @Override |
| public void setDefinition(ConnectionHandlerDefinition newDefinition) { |
| ConnectionHandlerDefinition oldDefinition = definition; |
| definition = newDefinition; |
| if (eNotificationRequired()) |
| eNotify(new ENotificationImpl(this, Notification.SET, AmaltheaPackage.CONNECTION_HANDLER__DEFINITION, oldDefinition, definition)); |
| } |
| |
| /** |
| * <!-- begin-user-doc --> |
| * <!-- end-user-doc --> |
| * @generated |
| */ |
| @Override |
| public EList<HwConnection> getInternalConnections() { |
| if (internalConnections == null) { |
| internalConnections = new EObjectContainmentEList<HwConnection>(HwConnection.class, this, AmaltheaPackage.CONNECTION_HANDLER__INTERNAL_CONNECTIONS); |
| } |
| return internalConnections; |
| } |
| |
| /** |
| * <!-- begin-user-doc --> |
| * <!-- end-user-doc --> |
| * @generated |
| */ |
| @Override |
| public NotificationChain eInverseRemove(InternalEObject otherEnd, int featureID, NotificationChain msgs) { |
| switch (featureID) { |
| case AmaltheaPackage.CONNECTION_HANDLER__INTERNAL_CONNECTIONS: |
| return ((InternalEList<?>)getInternalConnections()).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 AmaltheaPackage.CONNECTION_HANDLER__DEFINITION: |
| if (resolve) return getDefinition(); |
| return basicGetDefinition(); |
| case AmaltheaPackage.CONNECTION_HANDLER__INTERNAL_CONNECTIONS: |
| return getInternalConnections(); |
| } |
| 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 AmaltheaPackage.CONNECTION_HANDLER__DEFINITION: |
| setDefinition((ConnectionHandlerDefinition)newValue); |
| return; |
| case AmaltheaPackage.CONNECTION_HANDLER__INTERNAL_CONNECTIONS: |
| getInternalConnections().clear(); |
| getInternalConnections().addAll((Collection<? extends HwConnection>)newValue); |
| return; |
| } |
| super.eSet(featureID, newValue); |
| } |
| |
| /** |
| * <!-- begin-user-doc --> |
| * <!-- end-user-doc --> |
| * @generated |
| */ |
| @Override |
| public void eUnset(int featureID) { |
| switch (featureID) { |
| case AmaltheaPackage.CONNECTION_HANDLER__DEFINITION: |
| setDefinition((ConnectionHandlerDefinition)null); |
| return; |
| case AmaltheaPackage.CONNECTION_HANDLER__INTERNAL_CONNECTIONS: |
| getInternalConnections().clear(); |
| return; |
| } |
| super.eUnset(featureID); |
| } |
| |
| /** |
| * <!-- begin-user-doc --> |
| * <!-- end-user-doc --> |
| * @generated |
| */ |
| @Override |
| public boolean eIsSet(int featureID) { |
| switch (featureID) { |
| case AmaltheaPackage.CONNECTION_HANDLER__DEFINITION: |
| return definition != null; |
| case AmaltheaPackage.CONNECTION_HANDLER__INTERNAL_CONNECTIONS: |
| return internalConnections != null && !internalConnections.isEmpty(); |
| } |
| return super.eIsSet(featureID); |
| } |
| |
| } //ConnectionHandlerImpl |