| /** |
| * ******************************************************************************* |
| * 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 java.util.Map; |
| |
| import org.eclipse.app4mc.amalthea.model.AmaltheaPackage; |
| import org.eclipse.app4mc.amalthea.model.AmaltheaServices2; |
| import org.eclipse.app4mc.amalthea.model.AmaltheaValidations; |
| import org.eclipse.app4mc.amalthea.model.Time; |
| import org.eclipse.app4mc.amalthea.model.TimeInterval; |
| |
| 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.DiagnosticChain; |
| 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>Time Interval</b></em>'. |
| * <!-- end-user-doc --> |
| * <p> |
| * The following features are implemented: |
| * </p> |
| * <ul> |
| * <li>{@link org.eclipse.app4mc.amalthea.model.impl.TimeIntervalImpl#getLowerBound <em>Lower Bound</em>}</li> |
| * <li>{@link org.eclipse.app4mc.amalthea.model.impl.TimeIntervalImpl#getUpperBound <em>Upper Bound</em>}</li> |
| * </ul> |
| * |
| * @generated |
| */ |
| public abstract class TimeIntervalImpl extends AmaltheaEObjectImpl implements TimeInterval { |
| /** |
| * The cached value of the '{@link #getLowerBound() <em>Lower Bound</em>}' containment reference. |
| * <!-- begin-user-doc --> |
| * <!-- end-user-doc --> |
| * @see #getLowerBound() |
| * @generated |
| * @ordered |
| */ |
| protected Time lowerBound; |
| |
| /** |
| * The cached value of the '{@link #getUpperBound() <em>Upper Bound</em>}' containment reference. |
| * <!-- begin-user-doc --> |
| * <!-- end-user-doc --> |
| * @see #getUpperBound() |
| * @generated |
| * @ordered |
| */ |
| protected Time upperBound; |
| |
| /** |
| * <!-- begin-user-doc --> |
| * <!-- end-user-doc --> |
| * @generated |
| */ |
| protected TimeIntervalImpl() { |
| super(); |
| } |
| |
| /** |
| * <!-- begin-user-doc --> |
| * <!-- end-user-doc --> |
| * @generated |
| */ |
| @Override |
| protected EClass eStaticClass() { |
| return AmaltheaPackage.eINSTANCE.getTimeInterval(); |
| } |
| |
| /** |
| * <!-- begin-user-doc --> |
| * <!-- end-user-doc --> |
| * @generated |
| */ |
| @Override |
| public Time getLowerBound() { |
| return lowerBound; |
| } |
| |
| /** |
| * <!-- begin-user-doc --> |
| * <!-- end-user-doc --> |
| * @generated |
| */ |
| public NotificationChain basicSetLowerBound(Time newLowerBound, NotificationChain msgs) { |
| Time oldLowerBound = lowerBound; |
| lowerBound = newLowerBound; |
| if (eNotificationRequired()) { |
| ENotificationImpl notification = new ENotificationImpl(this, Notification.SET, AmaltheaPackage.TIME_INTERVAL__LOWER_BOUND, oldLowerBound, newLowerBound); |
| if (msgs == null) msgs = notification; else msgs.add(notification); |
| } |
| return msgs; |
| } |
| |
| /** |
| * <!-- begin-user-doc --> |
| * <!-- end-user-doc --> |
| * @generated |
| */ |
| @Override |
| public void setLowerBound(Time newLowerBound) { |
| if (newLowerBound != lowerBound) { |
| NotificationChain msgs = null; |
| if (lowerBound != null) |
| msgs = ((InternalEObject)lowerBound).eInverseRemove(this, EOPPOSITE_FEATURE_BASE - AmaltheaPackage.TIME_INTERVAL__LOWER_BOUND, null, msgs); |
| if (newLowerBound != null) |
| msgs = ((InternalEObject)newLowerBound).eInverseAdd(this, EOPPOSITE_FEATURE_BASE - AmaltheaPackage.TIME_INTERVAL__LOWER_BOUND, null, msgs); |
| msgs = basicSetLowerBound(newLowerBound, msgs); |
| if (msgs != null) msgs.dispatch(); |
| } |
| else if (eNotificationRequired()) |
| eNotify(new ENotificationImpl(this, Notification.SET, AmaltheaPackage.TIME_INTERVAL__LOWER_BOUND, newLowerBound, newLowerBound)); |
| } |
| |
| /** |
| * <!-- begin-user-doc --> |
| * <!-- end-user-doc --> |
| * @generated |
| */ |
| @Override |
| public Time getUpperBound() { |
| return upperBound; |
| } |
| |
| /** |
| * <!-- begin-user-doc --> |
| * <!-- end-user-doc --> |
| * @generated |
| */ |
| public NotificationChain basicSetUpperBound(Time newUpperBound, NotificationChain msgs) { |
| Time oldUpperBound = upperBound; |
| upperBound = newUpperBound; |
| if (eNotificationRequired()) { |
| ENotificationImpl notification = new ENotificationImpl(this, Notification.SET, AmaltheaPackage.TIME_INTERVAL__UPPER_BOUND, oldUpperBound, newUpperBound); |
| if (msgs == null) msgs = notification; else msgs.add(notification); |
| } |
| return msgs; |
| } |
| |
| /** |
| * <!-- begin-user-doc --> |
| * <!-- end-user-doc --> |
| * @generated |
| */ |
| @Override |
| public void setUpperBound(Time newUpperBound) { |
| if (newUpperBound != upperBound) { |
| NotificationChain msgs = null; |
| if (upperBound != null) |
| msgs = ((InternalEObject)upperBound).eInverseRemove(this, EOPPOSITE_FEATURE_BASE - AmaltheaPackage.TIME_INTERVAL__UPPER_BOUND, null, msgs); |
| if (newUpperBound != null) |
| msgs = ((InternalEObject)newUpperBound).eInverseAdd(this, EOPPOSITE_FEATURE_BASE - AmaltheaPackage.TIME_INTERVAL__UPPER_BOUND, null, msgs); |
| msgs = basicSetUpperBound(newUpperBound, msgs); |
| if (msgs != null) msgs.dispatch(); |
| } |
| else if (eNotificationRequired()) |
| eNotify(new ENotificationImpl(this, Notification.SET, AmaltheaPackage.TIME_INTERVAL__UPPER_BOUND, newUpperBound, newUpperBound)); |
| } |
| |
| /** |
| * <!-- begin-user-doc --> |
| * <!-- end-user-doc --> |
| * @generated |
| */ |
| @Override |
| public Time getAverage() { |
| return AmaltheaServices2.getAverage(this.getLowerBound(), this.getUpperBound()); |
| } |
| |
| /** |
| * <!-- begin-user-doc --> |
| * <!-- end-user-doc --> |
| * @generated |
| */ |
| @Override |
| public boolean validateInvariants(final DiagnosticChain diagnostics, final Map<Object, Object> context) { |
| return AmaltheaValidations.validateInvariants(this, diagnostics); |
| } |
| |
| /** |
| * <!-- begin-user-doc --> |
| * <!-- end-user-doc --> |
| * @generated |
| */ |
| @Override |
| public NotificationChain eInverseRemove(InternalEObject otherEnd, int featureID, NotificationChain msgs) { |
| switch (featureID) { |
| case AmaltheaPackage.TIME_INTERVAL__LOWER_BOUND: |
| return basicSetLowerBound(null, msgs); |
| case AmaltheaPackage.TIME_INTERVAL__UPPER_BOUND: |
| return basicSetUpperBound(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.TIME_INTERVAL__LOWER_BOUND: |
| return getLowerBound(); |
| case AmaltheaPackage.TIME_INTERVAL__UPPER_BOUND: |
| return getUpperBound(); |
| } |
| 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.TIME_INTERVAL__LOWER_BOUND: |
| setLowerBound((Time)newValue); |
| return; |
| case AmaltheaPackage.TIME_INTERVAL__UPPER_BOUND: |
| setUpperBound((Time)newValue); |
| return; |
| } |
| super.eSet(featureID, newValue); |
| } |
| |
| /** |
| * <!-- begin-user-doc --> |
| * <!-- end-user-doc --> |
| * @generated |
| */ |
| @Override |
| public void eUnset(int featureID) { |
| switch (featureID) { |
| case AmaltheaPackage.TIME_INTERVAL__LOWER_BOUND: |
| setLowerBound((Time)null); |
| return; |
| case AmaltheaPackage.TIME_INTERVAL__UPPER_BOUND: |
| setUpperBound((Time)null); |
| return; |
| } |
| super.eUnset(featureID); |
| } |
| |
| /** |
| * <!-- begin-user-doc --> |
| * <!-- end-user-doc --> |
| * @generated |
| */ |
| @Override |
| public boolean eIsSet(int featureID) { |
| switch (featureID) { |
| case AmaltheaPackage.TIME_INTERVAL__LOWER_BOUND: |
| return lowerBound != null; |
| case AmaltheaPackage.TIME_INTERVAL__UPPER_BOUND: |
| return upperBound != null; |
| } |
| return super.eIsSet(featureID); |
| } |
| |
| /** |
| * <!-- begin-user-doc --> |
| * <!-- end-user-doc --> |
| * @generated |
| */ |
| @Override |
| @SuppressWarnings("unchecked") |
| public Object eInvoke(int operationID, EList<?> arguments) throws InvocationTargetException { |
| switch (operationID) { |
| case AmaltheaPackage.TIME_INTERVAL___GET_AVERAGE: |
| return getAverage(); |
| case AmaltheaPackage.TIME_INTERVAL___VALIDATE_INVARIANTS__DIAGNOSTICCHAIN_MAP: |
| return validateInvariants((DiagnosticChain)arguments.get(0), (Map<Object, Object>)arguments.get(1)); |
| } |
| return super.eInvoke(operationID, arguments); |
| } |
| |
| } //TimeIntervalImpl |