| /** |
| * ******************************************************************************* |
| * 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.AmaltheaValidations; |
| import org.eclipse.app4mc.amalthea.model.MinAvgMaxStatistic; |
| |
| import org.eclipse.app4mc.amalthea.model.emf.AmaltheaEObjectImpl; |
| |
| import org.eclipse.emf.common.notify.Notification; |
| |
| 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.impl.ENotificationImpl; |
| |
| /** |
| * <!-- begin-user-doc --> |
| * An implementation of the model object '<em><b>Min Avg Max Statistic</b></em>'. |
| * <!-- end-user-doc --> |
| * <p> |
| * The following features are implemented: |
| * </p> |
| * <ul> |
| * <li>{@link org.eclipse.app4mc.amalthea.model.impl.MinAvgMaxStatisticImpl#getMin <em>Min</em>}</li> |
| * <li>{@link org.eclipse.app4mc.amalthea.model.impl.MinAvgMaxStatisticImpl#getAvg <em>Avg</em>}</li> |
| * <li>{@link org.eclipse.app4mc.amalthea.model.impl.MinAvgMaxStatisticImpl#getMax <em>Max</em>}</li> |
| * </ul> |
| * |
| * @generated |
| */ |
| public class MinAvgMaxStatisticImpl extends AmaltheaEObjectImpl implements MinAvgMaxStatistic { |
| /** |
| * The default value of the '{@link #getMin() <em>Min</em>}' attribute. |
| * <!-- begin-user-doc --> |
| * <!-- end-user-doc --> |
| * @see #getMin() |
| * @generated |
| * @ordered |
| */ |
| protected static final int MIN_EDEFAULT = 0; |
| |
| /** |
| * The cached value of the '{@link #getMin() <em>Min</em>}' attribute. |
| * <!-- begin-user-doc --> |
| * <!-- end-user-doc --> |
| * @see #getMin() |
| * @generated |
| * @ordered |
| */ |
| protected int min = MIN_EDEFAULT; |
| |
| /** |
| * The default value of the '{@link #getAvg() <em>Avg</em>}' attribute. |
| * <!-- begin-user-doc --> |
| * <!-- end-user-doc --> |
| * @see #getAvg() |
| * @generated |
| * @ordered |
| */ |
| protected static final float AVG_EDEFAULT = 0.0F; |
| |
| /** |
| * The cached value of the '{@link #getAvg() <em>Avg</em>}' attribute. |
| * <!-- begin-user-doc --> |
| * <!-- end-user-doc --> |
| * @see #getAvg() |
| * @generated |
| * @ordered |
| */ |
| protected float avg = AVG_EDEFAULT; |
| |
| /** |
| * The default value of the '{@link #getMax() <em>Max</em>}' attribute. |
| * <!-- begin-user-doc --> |
| * <!-- end-user-doc --> |
| * @see #getMax() |
| * @generated |
| * @ordered |
| */ |
| protected static final int MAX_EDEFAULT = 0; |
| |
| /** |
| * The cached value of the '{@link #getMax() <em>Max</em>}' attribute. |
| * <!-- begin-user-doc --> |
| * <!-- end-user-doc --> |
| * @see #getMax() |
| * @generated |
| * @ordered |
| */ |
| protected int max = MAX_EDEFAULT; |
| |
| /** |
| * <!-- begin-user-doc --> |
| * <!-- end-user-doc --> |
| * @generated |
| */ |
| protected MinAvgMaxStatisticImpl() { |
| super(); |
| } |
| |
| /** |
| * <!-- begin-user-doc --> |
| * <!-- end-user-doc --> |
| * @generated |
| */ |
| @Override |
| protected EClass eStaticClass() { |
| return AmaltheaPackage.eINSTANCE.getMinAvgMaxStatistic(); |
| } |
| |
| /** |
| * <!-- begin-user-doc --> |
| * <!-- end-user-doc --> |
| * @generated |
| */ |
| @Override |
| public int getMin() { |
| return min; |
| } |
| |
| /** |
| * <!-- begin-user-doc --> |
| * <!-- end-user-doc --> |
| * @generated |
| */ |
| @Override |
| public void setMin(int newMin) { |
| int oldMin = min; |
| min = newMin; |
| if (eNotificationRequired()) |
| eNotify(new ENotificationImpl(this, Notification.SET, AmaltheaPackage.MIN_AVG_MAX_STATISTIC__MIN, oldMin, min)); |
| } |
| |
| /** |
| * <!-- begin-user-doc --> |
| * <!-- end-user-doc --> |
| * @generated |
| */ |
| @Override |
| public float getAvg() { |
| return avg; |
| } |
| |
| /** |
| * <!-- begin-user-doc --> |
| * <!-- end-user-doc --> |
| * @generated |
| */ |
| @Override |
| public void setAvg(float newAvg) { |
| float oldAvg = avg; |
| avg = newAvg; |
| if (eNotificationRequired()) |
| eNotify(new ENotificationImpl(this, Notification.SET, AmaltheaPackage.MIN_AVG_MAX_STATISTIC__AVG, oldAvg, avg)); |
| } |
| |
| /** |
| * <!-- begin-user-doc --> |
| * <!-- end-user-doc --> |
| * @generated |
| */ |
| @Override |
| public int getMax() { |
| return max; |
| } |
| |
| /** |
| * <!-- begin-user-doc --> |
| * <!-- end-user-doc --> |
| * @generated |
| */ |
| @Override |
| public void setMax(int newMax) { |
| int oldMax = max; |
| max = newMax; |
| if (eNotificationRequired()) |
| eNotify(new ENotificationImpl(this, Notification.SET, AmaltheaPackage.MIN_AVG_MAX_STATISTIC__MAX, oldMax, max)); |
| } |
| |
| /** |
| * <!-- 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 Object eGet(int featureID, boolean resolve, boolean coreType) { |
| switch (featureID) { |
| case AmaltheaPackage.MIN_AVG_MAX_STATISTIC__MIN: |
| return getMin(); |
| case AmaltheaPackage.MIN_AVG_MAX_STATISTIC__AVG: |
| return getAvg(); |
| case AmaltheaPackage.MIN_AVG_MAX_STATISTIC__MAX: |
| return getMax(); |
| } |
| 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.MIN_AVG_MAX_STATISTIC__MIN: |
| setMin((Integer)newValue); |
| return; |
| case AmaltheaPackage.MIN_AVG_MAX_STATISTIC__AVG: |
| setAvg((Float)newValue); |
| return; |
| case AmaltheaPackage.MIN_AVG_MAX_STATISTIC__MAX: |
| setMax((Integer)newValue); |
| return; |
| } |
| super.eSet(featureID, newValue); |
| } |
| |
| /** |
| * <!-- begin-user-doc --> |
| * <!-- end-user-doc --> |
| * @generated |
| */ |
| @Override |
| public void eUnset(int featureID) { |
| switch (featureID) { |
| case AmaltheaPackage.MIN_AVG_MAX_STATISTIC__MIN: |
| setMin(MIN_EDEFAULT); |
| return; |
| case AmaltheaPackage.MIN_AVG_MAX_STATISTIC__AVG: |
| setAvg(AVG_EDEFAULT); |
| return; |
| case AmaltheaPackage.MIN_AVG_MAX_STATISTIC__MAX: |
| setMax(MAX_EDEFAULT); |
| return; |
| } |
| super.eUnset(featureID); |
| } |
| |
| /** |
| * <!-- begin-user-doc --> |
| * <!-- end-user-doc --> |
| * @generated |
| */ |
| @Override |
| public boolean eIsSet(int featureID) { |
| switch (featureID) { |
| case AmaltheaPackage.MIN_AVG_MAX_STATISTIC__MIN: |
| return min != MIN_EDEFAULT; |
| case AmaltheaPackage.MIN_AVG_MAX_STATISTIC__AVG: |
| return avg != AVG_EDEFAULT; |
| case AmaltheaPackage.MIN_AVG_MAX_STATISTIC__MAX: |
| return max != MAX_EDEFAULT; |
| } |
| 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.MIN_AVG_MAX_STATISTIC___VALIDATE_INVARIANTS__DIAGNOSTICCHAIN_MAP: |
| return validateInvariants((DiagnosticChain)arguments.get(0), (Map<Object, Object>)arguments.get(1)); |
| } |
| 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(" (min: "); |
| result.append(min); |
| result.append(", avg: "); |
| result.append(avg); |
| result.append(", max: "); |
| result.append(max); |
| result.append(')'); |
| return result.toString(); |
| } |
| |
| } //MinAvgMaxStatisticImpl |