| /** |
| * ******************************************************************************* |
| * 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.lang.reflect.InvocationTargetException; |
| |
| import org.eclipse.app4mc.amalthea.model.AmaltheaPackage; |
| import org.eclipse.app4mc.amalthea.model.HwFeature; |
| import org.eclipse.app4mc.amalthea.model.HwFeatureCategory; |
| import org.eclipse.app4mc.amalthea.model.INamed; |
| import org.eclipse.app4mc.amalthea.model.IReferable; |
| import org.eclipse.app4mc.amalthea.model.ReferableBaseObject; |
| |
| import org.eclipse.emf.common.notify.Notification; |
| import org.eclipse.emf.common.notify.NotificationChain; |
| import org.eclipse.emf.common.util.BasicEList; |
| 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.xcore.lib.XcoreCollectionLiterals; |
| import org.eclipse.xtext.xbase.lib.StringExtensions; |
| |
| /** |
| * <!-- begin-user-doc --> |
| * An implementation of the model object '<em><b>Hw Feature</b></em>'. |
| * <!-- end-user-doc --> |
| * <p> |
| * The following features are implemented: |
| * </p> |
| * <ul> |
| * <li>{@link org.eclipse.app4mc.amalthea.model.impl.HwFeatureImpl#getContainingCategory <em>Containing Category</em>}</li> |
| * <li>{@link org.eclipse.app4mc.amalthea.model.impl.HwFeatureImpl#getValue <em>Value</em>}</li> |
| * </ul> |
| * |
| * @generated |
| */ |
| public class HwFeatureImpl extends ReferableBaseObjectImpl implements HwFeature { |
| /** |
| * The default value of the '{@link #getValue() <em>Value</em>}' attribute. |
| * <!-- begin-user-doc --> |
| * <!-- end-user-doc --> |
| * @see #getValue() |
| * @generated |
| * @ordered |
| */ |
| protected static final double VALUE_EDEFAULT = 0.0; |
| |
| /** |
| * The cached value of the '{@link #getValue() <em>Value</em>}' attribute. |
| * <!-- begin-user-doc --> |
| * <!-- end-user-doc --> |
| * @see #getValue() |
| * @generated |
| * @ordered |
| */ |
| protected double value = VALUE_EDEFAULT; |
| |
| /** |
| * <!-- begin-user-doc --> |
| * <!-- end-user-doc --> |
| * @generated |
| */ |
| protected HwFeatureImpl() { |
| super(); |
| } |
| |
| /** |
| * <!-- begin-user-doc --> |
| * <!-- end-user-doc --> |
| * @generated |
| */ |
| @Override |
| protected EClass eStaticClass() { |
| return AmaltheaPackage.eINSTANCE.getHwFeature(); |
| } |
| |
| /** |
| * <!-- begin-user-doc --> |
| * <!-- end-user-doc --> |
| * @generated |
| */ |
| @Override |
| public HwFeatureCategory getContainingCategory() { |
| if (eContainerFeatureID() != AmaltheaPackage.HW_FEATURE__CONTAINING_CATEGORY) return null; |
| return (HwFeatureCategory)eContainer(); |
| } |
| |
| /** |
| * <!-- begin-user-doc --> |
| * <!-- end-user-doc --> |
| * @generated |
| */ |
| public HwFeatureCategory basicGetContainingCategory() { |
| if (eContainerFeatureID() != AmaltheaPackage.HW_FEATURE__CONTAINING_CATEGORY) return null; |
| return (HwFeatureCategory)eInternalContainer(); |
| } |
| |
| /** |
| * <!-- begin-user-doc --> |
| * <!-- end-user-doc --> |
| * @generated |
| */ |
| @Override |
| public double getValue() { |
| return value; |
| } |
| |
| /** |
| * <!-- begin-user-doc --> |
| * <!-- end-user-doc --> |
| * @generated |
| */ |
| @Override |
| public void setValue(double newValue) { |
| double oldValue = value; |
| value = newValue; |
| if (eNotificationRequired()) |
| eNotify(new ENotificationImpl(this, Notification.SET, AmaltheaPackage.HW_FEATURE__VALUE, oldValue, value)); |
| } |
| |
| /** |
| * <!-- begin-user-doc --> |
| * <!-- end-user-doc --> |
| * @generated |
| */ |
| @Override |
| public EList<String> getNamePrefixSegments() { |
| EList<String> _elvis = null; |
| HwFeatureCategory _containingCategory = this.getContainingCategory(); |
| EList<String> _qualifiedNameSegments = null; |
| if (_containingCategory!=null) { |
| _qualifiedNameSegments=_containingCategory.getQualifiedNameSegments(); |
| } |
| if (_qualifiedNameSegments != null) { |
| _elvis = _qualifiedNameSegments; |
| } else { |
| BasicEList<String> _newBasicEList = XcoreCollectionLiterals.<String>newBasicEList(); |
| _elvis = _newBasicEList; |
| } |
| return _elvis; |
| } |
| |
| /** |
| * <!-- begin-user-doc --> |
| * <!-- end-user-doc --> |
| * @generated |
| */ |
| @Override |
| public String toString() { |
| HwFeatureCategory _containingCategory = this.getContainingCategory(); |
| String _name = null; |
| if (_containingCategory!=null) { |
| _name=_containingCategory.getName(); |
| } |
| final String featureName = _name; |
| String _xifexpression = null; |
| boolean _isNullOrEmpty = StringExtensions.isNullOrEmpty(featureName); |
| if (_isNullOrEmpty) { |
| _xifexpression = "<category>"; |
| } |
| else { |
| _xifexpression = featureName; |
| } |
| String _plus = (_xifexpression + "::"); |
| String _xifexpression_1 = null; |
| boolean _isNullOrEmpty_1 = StringExtensions.isNullOrEmpty(this.getName()); |
| if (_isNullOrEmpty_1) { |
| _xifexpression_1 = "<feature>"; |
| } |
| else { |
| _xifexpression_1 = this.getName(); |
| } |
| return (_plus + _xifexpression_1); |
| } |
| |
| /** |
| * <!-- begin-user-doc --> |
| * <!-- end-user-doc --> |
| * @generated |
| */ |
| @Override |
| public NotificationChain eInverseAdd(InternalEObject otherEnd, int featureID, NotificationChain msgs) { |
| switch (featureID) { |
| case AmaltheaPackage.HW_FEATURE__CONTAINING_CATEGORY: |
| if (eInternalContainer() != null) |
| msgs = eBasicRemoveFromContainer(msgs); |
| return eBasicSetContainer(otherEnd, AmaltheaPackage.HW_FEATURE__CONTAINING_CATEGORY, 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 AmaltheaPackage.HW_FEATURE__CONTAINING_CATEGORY: |
| return eBasicSetContainer(null, AmaltheaPackage.HW_FEATURE__CONTAINING_CATEGORY, msgs); |
| } |
| return super.eInverseRemove(otherEnd, featureID, msgs); |
| } |
| |
| /** |
| * <!-- begin-user-doc --> |
| * <!-- end-user-doc --> |
| * @generated |
| */ |
| @Override |
| public NotificationChain eBasicRemoveFromContainerFeature(NotificationChain msgs) { |
| switch (eContainerFeatureID()) { |
| case AmaltheaPackage.HW_FEATURE__CONTAINING_CATEGORY: |
| return eInternalContainer().eInverseRemove(this, AmaltheaPackage.HW_FEATURE_CATEGORY__FEATURES, HwFeatureCategory.class, msgs); |
| } |
| return super.eBasicRemoveFromContainerFeature(msgs); |
| } |
| |
| /** |
| * <!-- begin-user-doc --> |
| * <!-- end-user-doc --> |
| * @generated |
| */ |
| @Override |
| public Object eGet(int featureID, boolean resolve, boolean coreType) { |
| switch (featureID) { |
| case AmaltheaPackage.HW_FEATURE__CONTAINING_CATEGORY: |
| if (resolve) return getContainingCategory(); |
| return basicGetContainingCategory(); |
| case AmaltheaPackage.HW_FEATURE__VALUE: |
| return getValue(); |
| } |
| return super.eGet(featureID, resolve, coreType); |
| } |
| |
| /** |
| * <!-- begin-user-doc --> |
| * <!-- end-user-doc --> |
| * @generated |
| */ |
| @Override |
| public void eSet(int featureID, Object newValue) { |
| switch (featureID) { |
| case AmaltheaPackage.HW_FEATURE__VALUE: |
| setValue((Double)newValue); |
| return; |
| } |
| super.eSet(featureID, newValue); |
| } |
| |
| /** |
| * <!-- begin-user-doc --> |
| * <!-- end-user-doc --> |
| * @generated |
| */ |
| @Override |
| public void eUnset(int featureID) { |
| switch (featureID) { |
| case AmaltheaPackage.HW_FEATURE__VALUE: |
| setValue(VALUE_EDEFAULT); |
| return; |
| } |
| super.eUnset(featureID); |
| } |
| |
| /** |
| * <!-- begin-user-doc --> |
| * <!-- end-user-doc --> |
| * @generated |
| */ |
| @Override |
| public boolean eIsSet(int featureID) { |
| switch (featureID) { |
| case AmaltheaPackage.HW_FEATURE__CONTAINING_CATEGORY: |
| return basicGetContainingCategory() != null; |
| case AmaltheaPackage.HW_FEATURE__VALUE: |
| return value != VALUE_EDEFAULT; |
| } |
| return super.eIsSet(featureID); |
| } |
| |
| /** |
| * <!-- begin-user-doc --> |
| * <!-- end-user-doc --> |
| * @generated |
| */ |
| @Override |
| public int eDerivedOperationID(int baseOperationID, Class<?> baseClass) { |
| if (baseClass == INamed.class) { |
| switch (baseOperationID) { |
| case AmaltheaPackage.INAMED___GET_NAME_PREFIX_SEGMENTS: return AmaltheaPackage.HW_FEATURE___GET_NAME_PREFIX_SEGMENTS; |
| default: return super.eDerivedOperationID(baseOperationID, baseClass); |
| } |
| } |
| if (baseClass == IReferable.class) { |
| switch (baseOperationID) { |
| case AmaltheaPackage.IREFERABLE___GET_NAME_PREFIX_SEGMENTS: return AmaltheaPackage.HW_FEATURE___GET_NAME_PREFIX_SEGMENTS; |
| default: return super.eDerivedOperationID(baseOperationID, baseClass); |
| } |
| } |
| if (baseClass == ReferableBaseObject.class) { |
| switch (baseOperationID) { |
| case AmaltheaPackage.REFERABLE_BASE_OBJECT___GET_NAME_PREFIX_SEGMENTS: return AmaltheaPackage.HW_FEATURE___GET_NAME_PREFIX_SEGMENTS; |
| default: return super.eDerivedOperationID(baseOperationID, baseClass); |
| } |
| } |
| return super.eDerivedOperationID(baseOperationID, baseClass); |
| } |
| |
| /** |
| * <!-- begin-user-doc --> |
| * <!-- end-user-doc --> |
| * @generated |
| */ |
| @Override |
| public Object eInvoke(int operationID, EList<?> arguments) throws InvocationTargetException { |
| switch (operationID) { |
| case AmaltheaPackage.HW_FEATURE___GET_NAME_PREFIX_SEGMENTS: |
| return getNamePrefixSegments(); |
| case AmaltheaPackage.HW_FEATURE___TO_STRING: |
| return toString(); |
| } |
| return super.eInvoke(operationID, arguments); |
| } |
| |
| } //HwFeatureImpl |