| /******************************************************************************* |
| * Copyright (c) 2016 ALL4TEC & CEA LIST. |
| * All rights reserved. This program and the accompanying materials |
| * are made available under the terms of the Eclipse Public License 2.0 |
| * which accompanies this distribution, and is available at |
| * https://www.eclipse.org/legal/epl-2.0/ |
| * |
| * SPDX-License-Identifier: EPL-2.0 |
| * |
| * Contributors: |
| * ALL4TEC & CEA LIST - initial API and implementation |
| ******************************************************************************/ |
| package org.polarsys.esf.esfarchitectureconcepts.impl; |
| |
| import java.util.Collection; |
| import org.eclipse.emf.common.notify.Notification; |
| import org.eclipse.emf.common.util.EList; |
| |
| import org.eclipse.emf.ecore.EClass; |
| import org.eclipse.emf.ecore.impl.ENotificationImpl; |
| import org.polarsys.esf.esfarchitectureconcepts.IAbstractSConnectableElement; |
| import org.polarsys.esf.esfarchitectureconcepts.IESFArchitectureConceptsPackage; |
| import org.polarsys.esf.esfarchitectureconcepts.ISConnector; |
| |
| import org.polarsys.esf.esfarchitectureconcepts.SDirection; |
| import org.polarsys.esf.esfcore.impl.AbstractSArchitectureElement; |
| |
| /** |
| * <!-- begin-user-doc --> |
| * An implementation of the model object '<em><b>Abstract SConnectable Element</b></em>'. |
| * <!-- end-user-doc --> |
| * <p> |
| * The following features are implemented: |
| * </p> |
| * <ul> |
| * <li>{@link org.polarsys.esf.esfarchitectureconcepts.impl.AbstractSConnectableElement#getSConnectorsList |
| * <em>SConnectors List</em>}</li> |
| * <li>{@link org.polarsys.esf.esfarchitectureconcepts.impl.AbstractSConnectableElement#getSDirection |
| * <em>SDirection</em>}</li> |
| * </ul> |
| * |
| * @generated |
| */ |
| public abstract class AbstractSConnectableElement |
| extends AbstractSArchitectureElement |
| implements IAbstractSConnectableElement { |
| |
| /** |
| * The default value of the '{@link #getSDirection() <em>SDirection</em>}' attribute. |
| * <!-- begin-user-doc --> |
| * <!-- end-user-doc --> |
| * |
| * @see #getSDirection() |
| * @generated |
| * @ordered |
| */ |
| protected static final SDirection SDIRECTION_EDEFAULT = SDirection.INOUT; |
| |
| /** |
| * The cached value of the '{@link #getSDirection() <em>SDirection</em>}' attribute. |
| * <!-- begin-user-doc --> |
| * <!-- end-user-doc --> |
| * |
| * @see #getSDirection() |
| * @generated |
| * @ordered |
| */ |
| protected SDirection sDirection = SDIRECTION_EDEFAULT; |
| |
| /** |
| * <!-- begin-user-doc --> |
| * <!-- end-user-doc --> |
| * |
| * @generated |
| */ |
| protected AbstractSConnectableElement() { |
| super(); |
| } |
| |
| /** |
| * <!-- begin-user-doc --> |
| * <!-- end-user-doc --> |
| * |
| * @generated |
| */ |
| @Override |
| protected EClass eStaticClass() { |
| return IESFArchitectureConceptsPackage.Literals.ABSTRACT_SCONNECTABLE_ELEMENT; |
| } |
| |
| /** |
| * <!-- begin-user-doc --> |
| * <!-- end-user-doc --> |
| * |
| * @generated |
| */ |
| public EList<ISConnector> getSConnectorsList() { |
| // TODO: implement this method to return the 'SConnectors List' reference list |
| // Ensure that you remove @generated or mark it @generated NOT |
| throw new UnsupportedOperationException(); |
| } |
| |
| /** |
| * <!-- begin-user-doc --> |
| * <!-- end-user-doc --> |
| * |
| * @generated |
| */ |
| public SDirection getSDirection() { |
| return sDirection; |
| } |
| |
| /** |
| * <!-- begin-user-doc --> |
| * <!-- end-user-doc --> |
| * |
| * @generated |
| */ |
| public void setSDirection(SDirection newSDirection) { |
| SDirection oldSDirection = sDirection; |
| sDirection = newSDirection == null ? SDIRECTION_EDEFAULT : newSDirection; |
| if (eNotificationRequired()) |
| eNotify(new ENotificationImpl( |
| this, |
| Notification.SET, |
| IESFArchitectureConceptsPackage.ABSTRACT_SCONNECTABLE_ELEMENT__SDIRECTION, |
| oldSDirection, |
| sDirection)); |
| } |
| |
| /** |
| * <!-- begin-user-doc --> |
| * <!-- end-user-doc --> |
| * |
| * @generated |
| */ |
| @Override |
| public Object eGet(int featureID, boolean resolve, boolean coreType) { |
| switch (featureID) { |
| case IESFArchitectureConceptsPackage.ABSTRACT_SCONNECTABLE_ELEMENT__SCONNECTORS_LIST: |
| return getSConnectorsList(); |
| case IESFArchitectureConceptsPackage.ABSTRACT_SCONNECTABLE_ELEMENT__SDIRECTION: |
| return getSDirection(); |
| } |
| 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 IESFArchitectureConceptsPackage.ABSTRACT_SCONNECTABLE_ELEMENT__SCONNECTORS_LIST: |
| getSConnectorsList().clear(); |
| getSConnectorsList().addAll((Collection<? extends ISConnector>) newValue); |
| return; |
| case IESFArchitectureConceptsPackage.ABSTRACT_SCONNECTABLE_ELEMENT__SDIRECTION: |
| setSDirection((SDirection) newValue); |
| return; |
| } |
| super.eSet(featureID, newValue); |
| } |
| |
| /** |
| * <!-- begin-user-doc --> |
| * <!-- end-user-doc --> |
| * |
| * @generated |
| */ |
| @Override |
| public void eUnset(int featureID) { |
| switch (featureID) { |
| case IESFArchitectureConceptsPackage.ABSTRACT_SCONNECTABLE_ELEMENT__SCONNECTORS_LIST: |
| getSConnectorsList().clear(); |
| return; |
| case IESFArchitectureConceptsPackage.ABSTRACT_SCONNECTABLE_ELEMENT__SDIRECTION: |
| setSDirection(SDIRECTION_EDEFAULT); |
| return; |
| } |
| super.eUnset(featureID); |
| } |
| |
| /** |
| * <!-- begin-user-doc --> |
| * <!-- end-user-doc --> |
| * |
| * @generated |
| */ |
| @Override |
| public boolean eIsSet(int featureID) { |
| switch (featureID) { |
| case IESFArchitectureConceptsPackage.ABSTRACT_SCONNECTABLE_ELEMENT__SCONNECTORS_LIST: |
| return !getSConnectorsList().isEmpty(); |
| case IESFArchitectureConceptsPackage.ABSTRACT_SCONNECTABLE_ELEMENT__SDIRECTION: |
| return sDirection != SDIRECTION_EDEFAULT; |
| } |
| return super.eIsSet(featureID); |
| } |
| |
| /** |
| * <!-- begin-user-doc --> |
| * <!-- end-user-doc --> |
| * |
| * @generated |
| */ |
| @Override |
| public String toString() { |
| if (eIsProxy()) |
| return super.toString(); |
| |
| StringBuffer result = new StringBuffer(super.toString()); |
| result.append(" (sDirection: "); //$NON-NLS-1$ |
| result.append(sDirection); |
| result.append(')'); |
| return result.toString(); |
| } |
| |
| } // AbstractSConnectableElement |