| /** |
| * ******************************************************************************* |
| * 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 com.google.common.base.Objects; |
| import java.lang.reflect.InvocationTargetException; |
| |
| 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.ISatisfiable; |
| import org.eclipse.app4mc.amalthea.model.ModeCondition; |
| import org.eclipse.app4mc.amalthea.model.ModeConditionDisjunctionEntry; |
| import org.eclipse.app4mc.amalthea.model.ModeLabel; |
| import org.eclipse.app4mc.amalthea.model.ModeValueCondition; |
| import org.eclipse.app4mc.amalthea.model.RelationalOperator; |
| |
| import org.eclipse.emf.common.notify.Notification; |
| |
| import org.eclipse.emf.common.util.EList; |
| import org.eclipse.emf.common.util.EMap; |
| |
| import org.eclipse.emf.ecore.EClass; |
| |
| import org.eclipse.emf.ecore.impl.ENotificationImpl; |
| |
| /** |
| * <!-- begin-user-doc --> |
| * An implementation of the model object '<em><b>Mode Value Condition</b></em>'. |
| * <!-- end-user-doc --> |
| * <p> |
| * The following features are implemented: |
| * </p> |
| * <ul> |
| * <li>{@link org.eclipse.app4mc.amalthea.model.impl.ModeValueConditionImpl#getRelation <em>Relation</em>}</li> |
| * </ul> |
| * |
| * @generated |
| */ |
| public class ModeValueConditionImpl extends ModeValueImpl implements ModeValueCondition { |
| /** |
| * 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 ModeValueConditionImpl() { |
| super(); |
| } |
| |
| /** |
| * <!-- begin-user-doc --> |
| * <!-- end-user-doc --> |
| * @generated |
| */ |
| @Override |
| protected EClass eStaticClass() { |
| return AmaltheaPackage.eINSTANCE.getModeValueCondition(); |
| } |
| |
| /** |
| * <!-- 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.MODE_VALUE_CONDITION__RELATION, oldRelation, relation)); |
| } |
| |
| /** |
| * <!-- begin-user-doc --> |
| * <!-- end-user-doc --> |
| * @generated |
| */ |
| @Override |
| public boolean isSatisfiedBy(final EMap<ModeLabel, String> context) { |
| String _get = null; |
| if (context!=null) { |
| _get=context.get(this.getLabel()); |
| } |
| final String labelValue = _get; |
| return ((labelValue == null) || Objects.equal(labelValue, this.getValue())); |
| } |
| |
| /** |
| * <!-- begin-user-doc --> |
| * <!-- end-user-doc --> |
| * @generated |
| */ |
| @Override |
| public Object eGet(int featureID, boolean resolve, boolean coreType) { |
| switch (featureID) { |
| case AmaltheaPackage.MODE_VALUE_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.MODE_VALUE_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.MODE_VALUE_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.MODE_VALUE_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 == ISatisfiable.class) { |
| switch (derivedFeatureID) { |
| default: return -1; |
| } |
| } |
| if (baseClass == ModeConditionDisjunctionEntry.class) { |
| switch (derivedFeatureID) { |
| default: return -1; |
| } |
| } |
| if (baseClass == ModeCondition.class) { |
| switch (derivedFeatureID) { |
| case AmaltheaPackage.MODE_VALUE_CONDITION__RELATION: return AmaltheaPackage.MODE_CONDITION__RELATION; |
| 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 == ISatisfiable.class) { |
| switch (baseFeatureID) { |
| default: return -1; |
| } |
| } |
| if (baseClass == ModeConditionDisjunctionEntry.class) { |
| switch (baseFeatureID) { |
| default: return -1; |
| } |
| } |
| if (baseClass == ModeCondition.class) { |
| switch (baseFeatureID) { |
| case AmaltheaPackage.MODE_CONDITION__RELATION: return AmaltheaPackage.MODE_VALUE_CONDITION__RELATION; |
| default: return -1; |
| } |
| } |
| return super.eDerivedStructuralFeatureID(baseFeatureID, baseClass); |
| } |
| |
| /** |
| * <!-- begin-user-doc --> |
| * <!-- end-user-doc --> |
| * @generated |
| */ |
| @Override |
| public int eDerivedOperationID(int baseOperationID, Class<?> baseClass) { |
| if (baseClass == ConditionDisjunctionEntry.class) { |
| switch (baseOperationID) { |
| default: return -1; |
| } |
| } |
| if (baseClass == Condition.class) { |
| switch (baseOperationID) { |
| default: return -1; |
| } |
| } |
| if (baseClass == ISatisfiable.class) { |
| switch (baseOperationID) { |
| case AmaltheaPackage.ISATISFIABLE___IS_SATISFIED_BY__EMAP: return AmaltheaPackage.MODE_VALUE_CONDITION___IS_SATISFIED_BY__EMAP; |
| default: return -1; |
| } |
| } |
| if (baseClass == ModeConditionDisjunctionEntry.class) { |
| switch (baseOperationID) { |
| default: return -1; |
| } |
| } |
| if (baseClass == ModeCondition.class) { |
| switch (baseOperationID) { |
| default: return -1; |
| } |
| } |
| return super.eDerivedOperationID(baseOperationID, baseClass); |
| } |
| |
| /** |
| * <!-- begin-user-doc --> |
| * <!-- end-user-doc --> |
| * @generated |
| */ |
| @Override |
| @SuppressWarnings("unchecked") |
| public Object eInvoke(int operationID, EList<?> arguments) throws InvocationTargetException { |
| switch (operationID) { |
| case AmaltheaPackage.MODE_VALUE_CONDITION___IS_SATISFIED_BY__EMAP: |
| return isSatisfiedBy((EMap<ModeLabel, String>)arguments.get(0)); |
| } |
| return super.eInvoke(operationID, arguments); |
| } |
| |
| /** |
| * <!-- 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(); |
| } |
| |
| } //ModeValueConditionImpl |