| /** |
| * ******************************************************************************* |
| * 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.ArithmeticExpression; |
| import org.eclipse.app4mc.amalthea.model.ArithmeticOperator; |
| import org.eclipse.app4mc.amalthea.model.ILocalModeValueSource; |
| |
| import org.eclipse.app4mc.amalthea.model.Mode; |
| import org.eclipse.app4mc.amalthea.model.emf.AmaltheaEObjectImpl; |
| |
| 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; |
| |
| /** |
| * <!-- begin-user-doc --> |
| * An implementation of the model object '<em><b>Arithmetic Expression</b></em>'. |
| * <!-- end-user-doc --> |
| * <p> |
| * The following features are implemented: |
| * </p> |
| * <ul> |
| * <li>{@link org.eclipse.app4mc.amalthea.model.impl.ArithmeticExpressionImpl#getOperand1 <em>Operand1</em>}</li> |
| * <li>{@link org.eclipse.app4mc.amalthea.model.impl.ArithmeticExpressionImpl#getOperand2 <em>Operand2</em>}</li> |
| * <li>{@link org.eclipse.app4mc.amalthea.model.impl.ArithmeticExpressionImpl#getOperator <em>Operator</em>}</li> |
| * </ul> |
| * |
| * @generated |
| */ |
| public class ArithmeticExpressionImpl extends AmaltheaEObjectImpl implements ArithmeticExpression { |
| /** |
| * The cached value of the '{@link #getOperand1() <em>Operand1</em>}' containment reference. |
| * <!-- begin-user-doc --> |
| * <!-- end-user-doc --> |
| * @see #getOperand1() |
| * @generated |
| * @ordered |
| */ |
| protected ILocalModeValueSource operand1; |
| |
| /** |
| * The cached value of the '{@link #getOperand2() <em>Operand2</em>}' containment reference. |
| * <!-- begin-user-doc --> |
| * <!-- end-user-doc --> |
| * @see #getOperand2() |
| * @generated |
| * @ordered |
| */ |
| protected ILocalModeValueSource operand2; |
| |
| /** |
| * The default value of the '{@link #getOperator() <em>Operator</em>}' attribute. |
| * <!-- begin-user-doc --> |
| * <!-- end-user-doc --> |
| * @see #getOperator() |
| * @generated |
| * @ordered |
| */ |
| protected static final ArithmeticOperator OPERATOR_EDEFAULT = ArithmeticOperator._UNDEFINED_; |
| |
| /** |
| * The cached value of the '{@link #getOperator() <em>Operator</em>}' attribute. |
| * <!-- begin-user-doc --> |
| * <!-- end-user-doc --> |
| * @see #getOperator() |
| * @generated |
| * @ordered |
| */ |
| protected ArithmeticOperator operator = OPERATOR_EDEFAULT; |
| |
| /** |
| * <!-- begin-user-doc --> |
| * <!-- end-user-doc --> |
| * @generated |
| */ |
| protected ArithmeticExpressionImpl() { |
| super(); |
| } |
| |
| /** |
| * <!-- begin-user-doc --> |
| * <!-- end-user-doc --> |
| * @generated |
| */ |
| @Override |
| protected EClass eStaticClass() { |
| return AmaltheaPackage.eINSTANCE.getArithmeticExpression(); |
| } |
| |
| /** |
| * <!-- begin-user-doc --> |
| * <!-- end-user-doc --> |
| * @generated |
| */ |
| @Override |
| public ILocalModeValueSource getOperand1() { |
| return operand1; |
| } |
| |
| /** |
| * <!-- begin-user-doc --> |
| * <!-- end-user-doc --> |
| * @generated |
| */ |
| public NotificationChain basicSetOperand1(ILocalModeValueSource newOperand1, NotificationChain msgs) { |
| ILocalModeValueSource oldOperand1 = operand1; |
| operand1 = newOperand1; |
| if (eNotificationRequired()) { |
| ENotificationImpl notification = new ENotificationImpl(this, Notification.SET, AmaltheaPackage.ARITHMETIC_EXPRESSION__OPERAND1, oldOperand1, newOperand1); |
| if (msgs == null) msgs = notification; else msgs.add(notification); |
| } |
| return msgs; |
| } |
| |
| /** |
| * <!-- begin-user-doc --> |
| * <!-- end-user-doc --> |
| * @generated |
| */ |
| @Override |
| public void setOperand1(ILocalModeValueSource newOperand1) { |
| if (newOperand1 != operand1) { |
| NotificationChain msgs = null; |
| if (operand1 != null) |
| msgs = ((InternalEObject)operand1).eInverseRemove(this, EOPPOSITE_FEATURE_BASE - AmaltheaPackage.ARITHMETIC_EXPRESSION__OPERAND1, null, msgs); |
| if (newOperand1 != null) |
| msgs = ((InternalEObject)newOperand1).eInverseAdd(this, EOPPOSITE_FEATURE_BASE - AmaltheaPackage.ARITHMETIC_EXPRESSION__OPERAND1, null, msgs); |
| msgs = basicSetOperand1(newOperand1, msgs); |
| if (msgs != null) msgs.dispatch(); |
| } |
| else if (eNotificationRequired()) |
| eNotify(new ENotificationImpl(this, Notification.SET, AmaltheaPackage.ARITHMETIC_EXPRESSION__OPERAND1, newOperand1, newOperand1)); |
| } |
| |
| /** |
| * <!-- begin-user-doc --> |
| * <!-- end-user-doc --> |
| * @generated |
| */ |
| @Override |
| public ILocalModeValueSource getOperand2() { |
| return operand2; |
| } |
| |
| /** |
| * <!-- begin-user-doc --> |
| * <!-- end-user-doc --> |
| * @generated |
| */ |
| public NotificationChain basicSetOperand2(ILocalModeValueSource newOperand2, NotificationChain msgs) { |
| ILocalModeValueSource oldOperand2 = operand2; |
| operand2 = newOperand2; |
| if (eNotificationRequired()) { |
| ENotificationImpl notification = new ENotificationImpl(this, Notification.SET, AmaltheaPackage.ARITHMETIC_EXPRESSION__OPERAND2, oldOperand2, newOperand2); |
| if (msgs == null) msgs = notification; else msgs.add(notification); |
| } |
| return msgs; |
| } |
| |
| /** |
| * <!-- begin-user-doc --> |
| * <!-- end-user-doc --> |
| * @generated |
| */ |
| @Override |
| public void setOperand2(ILocalModeValueSource newOperand2) { |
| if (newOperand2 != operand2) { |
| NotificationChain msgs = null; |
| if (operand2 != null) |
| msgs = ((InternalEObject)operand2).eInverseRemove(this, EOPPOSITE_FEATURE_BASE - AmaltheaPackage.ARITHMETIC_EXPRESSION__OPERAND2, null, msgs); |
| if (newOperand2 != null) |
| msgs = ((InternalEObject)newOperand2).eInverseAdd(this, EOPPOSITE_FEATURE_BASE - AmaltheaPackage.ARITHMETIC_EXPRESSION__OPERAND2, null, msgs); |
| msgs = basicSetOperand2(newOperand2, msgs); |
| if (msgs != null) msgs.dispatch(); |
| } |
| else if (eNotificationRequired()) |
| eNotify(new ENotificationImpl(this, Notification.SET, AmaltheaPackage.ARITHMETIC_EXPRESSION__OPERAND2, newOperand2, newOperand2)); |
| } |
| |
| /** |
| * <!-- begin-user-doc --> |
| * <!-- end-user-doc --> |
| * @generated |
| */ |
| @Override |
| public ArithmeticOperator getOperator() { |
| return operator; |
| } |
| |
| /** |
| * <!-- begin-user-doc --> |
| * <!-- end-user-doc --> |
| * @generated |
| */ |
| @Override |
| public void setOperator(ArithmeticOperator newOperator) { |
| ArithmeticOperator oldOperator = operator; |
| operator = newOperator == null ? OPERATOR_EDEFAULT : newOperator; |
| if (eNotificationRequired()) |
| eNotify(new ENotificationImpl(this, Notification.SET, AmaltheaPackage.ARITHMETIC_EXPRESSION__OPERATOR, oldOperator, operator)); |
| } |
| |
| /** |
| * <!-- begin-user-doc --> |
| * <!-- end-user-doc --> |
| * @generated |
| */ |
| @Override |
| public boolean isNumeric() { |
| return true; |
| } |
| |
| /** |
| * <!-- begin-user-doc --> |
| * <!-- end-user-doc --> |
| * @generated |
| */ |
| @Override |
| public boolean isEnum() { |
| return false; |
| } |
| |
| /** |
| * <!-- begin-user-doc --> |
| * <!-- end-user-doc --> |
| * @generated |
| */ |
| @Override |
| public Mode getMode() { |
| return null; |
| } |
| |
| /** |
| * <!-- begin-user-doc --> |
| * <!-- end-user-doc --> |
| * @generated |
| */ |
| @Override |
| public NotificationChain eInverseRemove(InternalEObject otherEnd, int featureID, NotificationChain msgs) { |
| switch (featureID) { |
| case AmaltheaPackage.ARITHMETIC_EXPRESSION__OPERAND1: |
| return basicSetOperand1(null, msgs); |
| case AmaltheaPackage.ARITHMETIC_EXPRESSION__OPERAND2: |
| return basicSetOperand2(null, 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.ARITHMETIC_EXPRESSION__OPERAND1: |
| return getOperand1(); |
| case AmaltheaPackage.ARITHMETIC_EXPRESSION__OPERAND2: |
| return getOperand2(); |
| case AmaltheaPackage.ARITHMETIC_EXPRESSION__OPERATOR: |
| return getOperator(); |
| } |
| 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.ARITHMETIC_EXPRESSION__OPERAND1: |
| setOperand1((ILocalModeValueSource)newValue); |
| return; |
| case AmaltheaPackage.ARITHMETIC_EXPRESSION__OPERAND2: |
| setOperand2((ILocalModeValueSource)newValue); |
| return; |
| case AmaltheaPackage.ARITHMETIC_EXPRESSION__OPERATOR: |
| setOperator((ArithmeticOperator)newValue); |
| return; |
| } |
| super.eSet(featureID, newValue); |
| } |
| |
| /** |
| * <!-- begin-user-doc --> |
| * <!-- end-user-doc --> |
| * @generated |
| */ |
| @Override |
| public void eUnset(int featureID) { |
| switch (featureID) { |
| case AmaltheaPackage.ARITHMETIC_EXPRESSION__OPERAND1: |
| setOperand1((ILocalModeValueSource)null); |
| return; |
| case AmaltheaPackage.ARITHMETIC_EXPRESSION__OPERAND2: |
| setOperand2((ILocalModeValueSource)null); |
| return; |
| case AmaltheaPackage.ARITHMETIC_EXPRESSION__OPERATOR: |
| setOperator(OPERATOR_EDEFAULT); |
| return; |
| } |
| super.eUnset(featureID); |
| } |
| |
| /** |
| * <!-- begin-user-doc --> |
| * <!-- end-user-doc --> |
| * @generated |
| */ |
| @Override |
| public boolean eIsSet(int featureID) { |
| switch (featureID) { |
| case AmaltheaPackage.ARITHMETIC_EXPRESSION__OPERAND1: |
| return operand1 != null; |
| case AmaltheaPackage.ARITHMETIC_EXPRESSION__OPERAND2: |
| return operand2 != null; |
| case AmaltheaPackage.ARITHMETIC_EXPRESSION__OPERATOR: |
| return operator != OPERATOR_EDEFAULT; |
| } |
| return super.eIsSet(featureID); |
| } |
| |
| /** |
| * <!-- begin-user-doc --> |
| * <!-- end-user-doc --> |
| * @generated |
| */ |
| @Override |
| public Object eInvoke(int operationID, EList<?> arguments) throws InvocationTargetException { |
| switch (operationID) { |
| case AmaltheaPackage.ARITHMETIC_EXPRESSION___IS_NUMERIC: |
| return isNumeric(); |
| case AmaltheaPackage.ARITHMETIC_EXPRESSION___IS_ENUM: |
| return isEnum(); |
| case AmaltheaPackage.ARITHMETIC_EXPRESSION___GET_MODE: |
| return getMode(); |
| } |
| 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(" (operator: "); |
| result.append(operator); |
| result.append(')'); |
| return result.toString(); |
| } |
| |
| } //ArithmeticExpressionImpl |