| /** |
| * ******************************************************************************* |
| * Copyright (c) 2015-2019 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.util.Collection; |
| |
| import org.eclipse.app4mc.amalthea.model.AmaltheaPackage; |
| import org.eclipse.app4mc.amalthea.model.Frequency; |
| import org.eclipse.app4mc.amalthea.model.FrequencyMetric; |
| import org.eclipse.app4mc.amalthea.model.FrequencyMetricMeasurement; |
| |
| 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; |
| |
| import org.eclipse.emf.ecore.util.EObjectContainmentEList; |
| import org.eclipse.emf.ecore.util.InternalEList; |
| |
| /** |
| * <!-- begin-user-doc --> |
| * An implementation of the model object '<em><b>Frequency Metric Measurement</b></em>'. |
| * <!-- end-user-doc --> |
| * <p> |
| * The following features are implemented: |
| * </p> |
| * <ul> |
| * <li>{@link org.eclipse.app4mc.amalthea.model.impl.FrequencyMetricMeasurementImpl#getMetric <em>Metric</em>}</li> |
| * <li>{@link org.eclipse.app4mc.amalthea.model.impl.FrequencyMetricMeasurementImpl#getValues <em>Values</em>}</li> |
| * </ul> |
| * |
| * @generated |
| */ |
| public class FrequencyMetricMeasurementImpl extends MetricMeasurementImpl implements FrequencyMetricMeasurement { |
| /** |
| * The default value of the '{@link #getMetric() <em>Metric</em>}' attribute. |
| * <!-- begin-user-doc --> |
| * <!-- end-user-doc --> |
| * @see #getMetric() |
| * @generated |
| * @ordered |
| */ |
| protected static final FrequencyMetric METRIC_EDEFAULT = FrequencyMetric._UNDEFINED_; |
| |
| /** |
| * The cached value of the '{@link #getMetric() <em>Metric</em>}' attribute. |
| * <!-- begin-user-doc --> |
| * <!-- end-user-doc --> |
| * @see #getMetric() |
| * @generated |
| * @ordered |
| */ |
| protected FrequencyMetric metric = METRIC_EDEFAULT; |
| |
| /** |
| * The cached value of the '{@link #getValues() <em>Values</em>}' containment reference list. |
| * <!-- begin-user-doc --> |
| * <!-- end-user-doc --> |
| * @see #getValues() |
| * @generated |
| * @ordered |
| */ |
| protected EList<Frequency> values; |
| |
| /** |
| * <!-- begin-user-doc --> |
| * <!-- end-user-doc --> |
| * @generated |
| */ |
| protected FrequencyMetricMeasurementImpl() { |
| super(); |
| } |
| |
| /** |
| * <!-- begin-user-doc --> |
| * <!-- end-user-doc --> |
| * @generated |
| */ |
| @Override |
| protected EClass eStaticClass() { |
| return AmaltheaPackage.eINSTANCE.getFrequencyMetricMeasurement(); |
| } |
| |
| /** |
| * <!-- begin-user-doc --> |
| * <!-- end-user-doc --> |
| * @generated |
| */ |
| @Override |
| public FrequencyMetric getMetric() { |
| return metric; |
| } |
| |
| /** |
| * <!-- begin-user-doc --> |
| * <!-- end-user-doc --> |
| * @generated |
| */ |
| @Override |
| public void setMetric(FrequencyMetric newMetric) { |
| FrequencyMetric oldMetric = metric; |
| metric = newMetric == null ? METRIC_EDEFAULT : newMetric; |
| if (eNotificationRequired()) |
| eNotify(new ENotificationImpl(this, Notification.SET, AmaltheaPackage.FREQUENCY_METRIC_MEASUREMENT__METRIC, oldMetric, metric)); |
| } |
| |
| /** |
| * <!-- begin-user-doc --> |
| * <!-- end-user-doc --> |
| * @generated |
| */ |
| @Override |
| public EList<Frequency> getValues() { |
| if (values == null) { |
| values = new EObjectContainmentEList<Frequency>(Frequency.class, this, AmaltheaPackage.FREQUENCY_METRIC_MEASUREMENT__VALUES); |
| } |
| return values; |
| } |
| |
| /** |
| * <!-- begin-user-doc --> |
| * <!-- end-user-doc --> |
| * @generated |
| */ |
| @Override |
| public NotificationChain eInverseRemove(InternalEObject otherEnd, int featureID, NotificationChain msgs) { |
| switch (featureID) { |
| case AmaltheaPackage.FREQUENCY_METRIC_MEASUREMENT__VALUES: |
| return ((InternalEList<?>)getValues()).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.FREQUENCY_METRIC_MEASUREMENT__METRIC: |
| return getMetric(); |
| case AmaltheaPackage.FREQUENCY_METRIC_MEASUREMENT__VALUES: |
| return getValues(); |
| } |
| return super.eGet(featureID, resolve, coreType); |
| } |
| |
| /** |
| * <!-- begin-user-doc --> |
| * <!-- end-user-doc --> |
| * @generated |
| */ |
| @SuppressWarnings("unchecked") |
| @Override |
| public void eSet(int featureID, Object newValue) { |
| switch (featureID) { |
| case AmaltheaPackage.FREQUENCY_METRIC_MEASUREMENT__METRIC: |
| setMetric((FrequencyMetric)newValue); |
| return; |
| case AmaltheaPackage.FREQUENCY_METRIC_MEASUREMENT__VALUES: |
| getValues().clear(); |
| getValues().addAll((Collection<? extends Frequency>)newValue); |
| return; |
| } |
| super.eSet(featureID, newValue); |
| } |
| |
| /** |
| * <!-- begin-user-doc --> |
| * <!-- end-user-doc --> |
| * @generated |
| */ |
| @Override |
| public void eUnset(int featureID) { |
| switch (featureID) { |
| case AmaltheaPackage.FREQUENCY_METRIC_MEASUREMENT__METRIC: |
| setMetric(METRIC_EDEFAULT); |
| return; |
| case AmaltheaPackage.FREQUENCY_METRIC_MEASUREMENT__VALUES: |
| getValues().clear(); |
| return; |
| } |
| super.eUnset(featureID); |
| } |
| |
| /** |
| * <!-- begin-user-doc --> |
| * <!-- end-user-doc --> |
| * @generated |
| */ |
| @Override |
| public boolean eIsSet(int featureID) { |
| switch (featureID) { |
| case AmaltheaPackage.FREQUENCY_METRIC_MEASUREMENT__METRIC: |
| return metric != METRIC_EDEFAULT; |
| case AmaltheaPackage.FREQUENCY_METRIC_MEASUREMENT__VALUES: |
| return values != null && !values.isEmpty(); |
| } |
| return super.eIsSet(featureID); |
| } |
| |
| /** |
| * <!-- begin-user-doc --> |
| * <!-- end-user-doc --> |
| * @generated |
| */ |
| @Override |
| public String toString() { |
| if (eIsProxy()) return super.toString(); |
| |
| StringBuilder result = new StringBuilder(super.toString()); |
| result.append(" (metric: "); |
| result.append(metric); |
| result.append(')'); |
| return result.toString(); |
| } |
| |
| } //FrequencyMetricMeasurementImpl |