| /** |
| * ******************************************************************************* |
| * 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.MetricMeasurement; |
| import org.eclipse.app4mc.amalthea.model.RunnableMeasurement; |
| |
| 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>Runnable Measurement</b></em>'. |
| * <!-- end-user-doc --> |
| * <p> |
| * The following features are implemented: |
| * </p> |
| * <ul> |
| * <li>{@link org.eclipse.app4mc.amalthea.model.impl.RunnableMeasurementImpl#getRunnable <em>Runnable</em>}</li> |
| * <li>{@link org.eclipse.app4mc.amalthea.model.impl.RunnableMeasurementImpl#getMeasurements <em>Measurements</em>}</li> |
| * </ul> |
| * |
| * @generated |
| */ |
| public class RunnableMeasurementImpl extends EntityMeasurementImpl implements RunnableMeasurement { |
| /** |
| * The cached value of the '{@link #getRunnable() <em>Runnable</em>}' reference. |
| * <!-- begin-user-doc --> |
| * <!-- end-user-doc --> |
| * @see #getRunnable() |
| * @generated |
| * @ordered |
| */ |
| protected org.eclipse.app4mc.amalthea.model.Runnable runnable; |
| |
| /** |
| * The cached value of the '{@link #getMeasurements() <em>Measurements</em>}' containment reference list. |
| * <!-- begin-user-doc --> |
| * <!-- end-user-doc --> |
| * @see #getMeasurements() |
| * @generated |
| * @ordered |
| */ |
| protected EList<MetricMeasurement> measurements; |
| |
| /** |
| * <!-- begin-user-doc --> |
| * <!-- end-user-doc --> |
| * @generated |
| */ |
| protected RunnableMeasurementImpl() { |
| super(); |
| } |
| |
| /** |
| * <!-- begin-user-doc --> |
| * <!-- end-user-doc --> |
| * @generated |
| */ |
| @Override |
| protected EClass eStaticClass() { |
| return AmaltheaPackage.eINSTANCE.getRunnableMeasurement(); |
| } |
| |
| /** |
| * <!-- begin-user-doc --> |
| * <!-- end-user-doc --> |
| * @generated |
| */ |
| @Override |
| public org.eclipse.app4mc.amalthea.model.Runnable getRunnable() { |
| if (runnable != null && runnable.eIsProxy()) { |
| InternalEObject oldRunnable = (InternalEObject)runnable; |
| runnable = (org.eclipse.app4mc.amalthea.model.Runnable)eResolveProxy(oldRunnable); |
| if (runnable != oldRunnable) { |
| if (eNotificationRequired()) |
| eNotify(new ENotificationImpl(this, Notification.RESOLVE, AmaltheaPackage.RUNNABLE_MEASUREMENT__RUNNABLE, oldRunnable, runnable)); |
| } |
| } |
| return runnable; |
| } |
| |
| /** |
| * <!-- begin-user-doc --> |
| * <!-- end-user-doc --> |
| * @generated |
| */ |
| public org.eclipse.app4mc.amalthea.model.Runnable basicGetRunnable() { |
| return runnable; |
| } |
| |
| /** |
| * <!-- begin-user-doc --> |
| * <!-- end-user-doc --> |
| * @generated |
| */ |
| @Override |
| public void setRunnable(org.eclipse.app4mc.amalthea.model.Runnable newRunnable) { |
| org.eclipse.app4mc.amalthea.model.Runnable oldRunnable = runnable; |
| runnable = newRunnable; |
| if (eNotificationRequired()) |
| eNotify(new ENotificationImpl(this, Notification.SET, AmaltheaPackage.RUNNABLE_MEASUREMENT__RUNNABLE, oldRunnable, runnable)); |
| } |
| |
| /** |
| * <!-- begin-user-doc --> |
| * <!-- end-user-doc --> |
| * @generated |
| */ |
| @Override |
| public EList<MetricMeasurement> getMeasurements() { |
| if (measurements == null) { |
| measurements = new EObjectContainmentEList<MetricMeasurement>(MetricMeasurement.class, this, AmaltheaPackage.RUNNABLE_MEASUREMENT__MEASUREMENTS); |
| } |
| return measurements; |
| } |
| |
| /** |
| * <!-- begin-user-doc --> |
| * <!-- end-user-doc --> |
| * @generated |
| */ |
| @Override |
| public NotificationChain eInverseRemove(InternalEObject otherEnd, int featureID, NotificationChain msgs) { |
| switch (featureID) { |
| case AmaltheaPackage.RUNNABLE_MEASUREMENT__MEASUREMENTS: |
| return ((InternalEList<?>)getMeasurements()).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.RUNNABLE_MEASUREMENT__RUNNABLE: |
| if (resolve) return getRunnable(); |
| return basicGetRunnable(); |
| case AmaltheaPackage.RUNNABLE_MEASUREMENT__MEASUREMENTS: |
| return getMeasurements(); |
| } |
| 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.RUNNABLE_MEASUREMENT__RUNNABLE: |
| setRunnable((org.eclipse.app4mc.amalthea.model.Runnable)newValue); |
| return; |
| case AmaltheaPackage.RUNNABLE_MEASUREMENT__MEASUREMENTS: |
| getMeasurements().clear(); |
| getMeasurements().addAll((Collection<? extends MetricMeasurement>)newValue); |
| return; |
| } |
| super.eSet(featureID, newValue); |
| } |
| |
| /** |
| * <!-- begin-user-doc --> |
| * <!-- end-user-doc --> |
| * @generated |
| */ |
| @Override |
| public void eUnset(int featureID) { |
| switch (featureID) { |
| case AmaltheaPackage.RUNNABLE_MEASUREMENT__RUNNABLE: |
| setRunnable((org.eclipse.app4mc.amalthea.model.Runnable)null); |
| return; |
| case AmaltheaPackage.RUNNABLE_MEASUREMENT__MEASUREMENTS: |
| getMeasurements().clear(); |
| return; |
| } |
| super.eUnset(featureID); |
| } |
| |
| /** |
| * <!-- begin-user-doc --> |
| * <!-- end-user-doc --> |
| * @generated |
| */ |
| @Override |
| public boolean eIsSet(int featureID) { |
| switch (featureID) { |
| case AmaltheaPackage.RUNNABLE_MEASUREMENT__RUNNABLE: |
| return runnable != null; |
| case AmaltheaPackage.RUNNABLE_MEASUREMENT__MEASUREMENTS: |
| return measurements != null && !measurements.isEmpty(); |
| } |
| return super.eIsSet(featureID); |
| } |
| |
| } //RunnableMeasurementImpl |