| /** |
| * ******************************************************************************* |
| * 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 org.eclipse.app4mc.amalthea.model.AmaltheaPackage; |
| import org.eclipse.app4mc.amalthea.model.Condition; |
| import org.eclipse.app4mc.amalthea.model.ConditionDisjunctionEntry; |
| import org.eclipse.app4mc.amalthea.model.IAnnotatable; |
| import org.eclipse.app4mc.amalthea.model.LocalModeCondition; |
| import org.eclipse.app4mc.amalthea.model.RelationalOperator; |
| import org.eclipse.app4mc.amalthea.model.Value; |
| |
| import org.eclipse.emf.common.notify.Notification; |
| import org.eclipse.emf.common.notify.NotificationChain; |
| |
| import org.eclipse.emf.common.util.EMap; |
| |
| import org.eclipse.emf.ecore.EClass; |
| import org.eclipse.emf.ecore.EStructuralFeature; |
| import org.eclipse.emf.ecore.InternalEObject; |
| |
| import org.eclipse.emf.ecore.impl.ENotificationImpl; |
| |
| import org.eclipse.emf.ecore.util.EcoreEMap; |
| import org.eclipse.emf.ecore.util.InternalEList; |
| |
| /** |
| * <!-- begin-user-doc --> |
| * An implementation of the model object '<em><b>Local Mode Condition</b></em>'. |
| * <!-- end-user-doc --> |
| * <p> |
| * The following features are implemented: |
| * </p> |
| * <ul> |
| * <li>{@link org.eclipse.app4mc.amalthea.model.impl.LocalModeConditionImpl#getCustomProperties <em>Custom Properties</em>}</li> |
| * <li>{@link org.eclipse.app4mc.amalthea.model.impl.LocalModeConditionImpl#getRelation <em>Relation</em>}</li> |
| * </ul> |
| * |
| * @generated |
| */ |
| public class LocalModeConditionImpl extends LocalModeValueImpl implements LocalModeCondition { |
| /** |
| * The cached value of the '{@link #getCustomProperties() <em>Custom Properties</em>}' map. |
| * <!-- begin-user-doc --> |
| * <!-- end-user-doc --> |
| * @see #getCustomProperties() |
| * @generated |
| * @ordered |
| */ |
| protected EMap<String, Value> customProperties; |
| |
| /** |
| * The default value of the '{@link #getRelation() <em>Relation</em>}' attribute. |
| * <!-- begin-user-doc --> |
| * <!-- end-user-doc --> |
| * @see #getRelation() |
| * @generated |
| * @ordered |
| */ |
| protected static final RelationalOperator RELATION_EDEFAULT = RelationalOperator._UNDEFINED_; |
| |
| /** |
| * The cached value of the '{@link #getRelation() <em>Relation</em>}' attribute. |
| * <!-- begin-user-doc --> |
| * <!-- end-user-doc --> |
| * @see #getRelation() |
| * @generated |
| * @ordered |
| */ |
| protected RelationalOperator relation = RELATION_EDEFAULT; |
| |
| /** |
| * <!-- begin-user-doc --> |
| * <!-- end-user-doc --> |
| * @generated |
| */ |
| protected LocalModeConditionImpl() { |
| super(); |
| } |
| |
| /** |
| * <!-- begin-user-doc --> |
| * <!-- end-user-doc --> |
| * @generated |
| */ |
| @Override |
| protected EClass eStaticClass() { |
| return AmaltheaPackage.eINSTANCE.getLocalModeCondition(); |
| } |
| |
| /** |
| * <!-- begin-user-doc --> |
| * <!-- end-user-doc --> |
| * @generated |
| */ |
| @Override |
| public EMap<String, Value> getCustomProperties() { |
| if (customProperties == null) { |
| customProperties = new EcoreEMap<String,Value>(AmaltheaPackage.eINSTANCE.getCustomProperty(), CustomPropertyImpl.class, this, AmaltheaPackage.LOCAL_MODE_CONDITION__CUSTOM_PROPERTIES); |
| } |
| return customProperties; |
| } |
| |
| /** |
| * <!-- begin-user-doc --> |
| * <!-- end-user-doc --> |
| * @generated |
| */ |
| @Override |
| public RelationalOperator getRelation() { |
| return relation; |
| } |
| |
| /** |
| * <!-- begin-user-doc --> |
| * <!-- end-user-doc --> |
| * @generated |
| */ |
| @Override |
| public void setRelation(RelationalOperator newRelation) { |
| RelationalOperator oldRelation = relation; |
| relation = newRelation == null ? RELATION_EDEFAULT : newRelation; |
| if (eNotificationRequired()) |
| eNotify(new ENotificationImpl(this, Notification.SET, AmaltheaPackage.LOCAL_MODE_CONDITION__RELATION, oldRelation, relation)); |
| } |
| |
| /** |
| * <!-- begin-user-doc --> |
| * <!-- end-user-doc --> |
| * @generated |
| */ |
| @Override |
| public NotificationChain eInverseRemove(InternalEObject otherEnd, int featureID, NotificationChain msgs) { |
| switch (featureID) { |
| case AmaltheaPackage.LOCAL_MODE_CONDITION__CUSTOM_PROPERTIES: |
| return ((InternalEList<?>)getCustomProperties()).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.LOCAL_MODE_CONDITION__CUSTOM_PROPERTIES: |
| if (coreType) return getCustomProperties(); |
| else return getCustomProperties().map(); |
| case AmaltheaPackage.LOCAL_MODE_CONDITION__RELATION: |
| return getRelation(); |
| } |
| 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.LOCAL_MODE_CONDITION__CUSTOM_PROPERTIES: |
| ((EStructuralFeature.Setting)getCustomProperties()).set(newValue); |
| return; |
| case AmaltheaPackage.LOCAL_MODE_CONDITION__RELATION: |
| setRelation((RelationalOperator)newValue); |
| return; |
| } |
| super.eSet(featureID, newValue); |
| } |
| |
| /** |
| * <!-- begin-user-doc --> |
| * <!-- end-user-doc --> |
| * @generated |
| */ |
| @Override |
| public void eUnset(int featureID) { |
| switch (featureID) { |
| case AmaltheaPackage.LOCAL_MODE_CONDITION__CUSTOM_PROPERTIES: |
| getCustomProperties().clear(); |
| return; |
| case AmaltheaPackage.LOCAL_MODE_CONDITION__RELATION: |
| setRelation(RELATION_EDEFAULT); |
| return; |
| } |
| super.eUnset(featureID); |
| } |
| |
| /** |
| * <!-- begin-user-doc --> |
| * <!-- end-user-doc --> |
| * @generated |
| */ |
| @Override |
| public boolean eIsSet(int featureID) { |
| switch (featureID) { |
| case AmaltheaPackage.LOCAL_MODE_CONDITION__CUSTOM_PROPERTIES: |
| return customProperties != null && !customProperties.isEmpty(); |
| case AmaltheaPackage.LOCAL_MODE_CONDITION__RELATION: |
| return relation != RELATION_EDEFAULT; |
| } |
| return super.eIsSet(featureID); |
| } |
| |
| /** |
| * <!-- begin-user-doc --> |
| * <!-- end-user-doc --> |
| * @generated |
| */ |
| @Override |
| public int eBaseStructuralFeatureID(int derivedFeatureID, Class<?> baseClass) { |
| if (baseClass == ConditionDisjunctionEntry.class) { |
| switch (derivedFeatureID) { |
| default: return -1; |
| } |
| } |
| if (baseClass == Condition.class) { |
| switch (derivedFeatureID) { |
| default: return -1; |
| } |
| } |
| if (baseClass == IAnnotatable.class) { |
| switch (derivedFeatureID) { |
| case AmaltheaPackage.LOCAL_MODE_CONDITION__CUSTOM_PROPERTIES: return AmaltheaPackage.IANNOTATABLE__CUSTOM_PROPERTIES; |
| default: return -1; |
| } |
| } |
| return super.eBaseStructuralFeatureID(derivedFeatureID, baseClass); |
| } |
| |
| /** |
| * <!-- begin-user-doc --> |
| * <!-- end-user-doc --> |
| * @generated |
| */ |
| @Override |
| public int eDerivedStructuralFeatureID(int baseFeatureID, Class<?> baseClass) { |
| if (baseClass == ConditionDisjunctionEntry.class) { |
| switch (baseFeatureID) { |
| default: return -1; |
| } |
| } |
| if (baseClass == Condition.class) { |
| switch (baseFeatureID) { |
| default: return -1; |
| } |
| } |
| if (baseClass == IAnnotatable.class) { |
| switch (baseFeatureID) { |
| case AmaltheaPackage.IANNOTATABLE__CUSTOM_PROPERTIES: return AmaltheaPackage.LOCAL_MODE_CONDITION__CUSTOM_PROPERTIES; |
| default: return -1; |
| } |
| } |
| return super.eDerivedStructuralFeatureID(baseFeatureID, baseClass); |
| } |
| |
| /** |
| * <!-- begin-user-doc --> |
| * <!-- end-user-doc --> |
| * @generated |
| */ |
| @Override |
| public String toString() { |
| if (eIsProxy()) return super.toString(); |
| |
| StringBuilder result = new StringBuilder(super.toString()); |
| result.append(" (relation: "); |
| result.append(relation); |
| result.append(')'); |
| return result.toString(); |
| } |
| |
| } //LocalModeConditionImpl |