| /** |
| * ******************************************************************************* |
| * 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.Task; |
| import org.eclipse.app4mc.amalthea.model.TaskMeasurement; |
| |
| 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>Task Measurement</b></em>'. |
| * <!-- end-user-doc --> |
| * <p> |
| * The following features are implemented: |
| * </p> |
| * <ul> |
| * <li>{@link org.eclipse.app4mc.amalthea.model.impl.TaskMeasurementImpl#getTask <em>Task</em>}</li> |
| * <li>{@link org.eclipse.app4mc.amalthea.model.impl.TaskMeasurementImpl#getMeasurements <em>Measurements</em>}</li> |
| * </ul> |
| * |
| * @generated |
| */ |
| public class TaskMeasurementImpl extends EntityMeasurementImpl implements TaskMeasurement { |
| /** |
| * The cached value of the '{@link #getTask() <em>Task</em>}' reference. |
| * <!-- begin-user-doc --> |
| * <!-- end-user-doc --> |
| * @see #getTask() |
| * @generated |
| * @ordered |
| */ |
| protected Task task; |
| |
| /** |
| * 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 TaskMeasurementImpl() { |
| super(); |
| } |
| |
| /** |
| * <!-- begin-user-doc --> |
| * <!-- end-user-doc --> |
| * @generated |
| */ |
| @Override |
| protected EClass eStaticClass() { |
| return AmaltheaPackage.eINSTANCE.getTaskMeasurement(); |
| } |
| |
| /** |
| * <!-- begin-user-doc --> |
| * <!-- end-user-doc --> |
| * @generated |
| */ |
| @Override |
| public Task getTask() { |
| if (task != null && task.eIsProxy()) { |
| InternalEObject oldTask = (InternalEObject)task; |
| task = (Task)eResolveProxy(oldTask); |
| if (task != oldTask) { |
| if (eNotificationRequired()) |
| eNotify(new ENotificationImpl(this, Notification.RESOLVE, AmaltheaPackage.TASK_MEASUREMENT__TASK, oldTask, task)); |
| } |
| } |
| return task; |
| } |
| |
| /** |
| * <!-- begin-user-doc --> |
| * <!-- end-user-doc --> |
| * @generated |
| */ |
| public Task basicGetTask() { |
| return task; |
| } |
| |
| /** |
| * <!-- begin-user-doc --> |
| * <!-- end-user-doc --> |
| * @generated |
| */ |
| @Override |
| public void setTask(Task newTask) { |
| Task oldTask = task; |
| task = newTask; |
| if (eNotificationRequired()) |
| eNotify(new ENotificationImpl(this, Notification.SET, AmaltheaPackage.TASK_MEASUREMENT__TASK, oldTask, task)); |
| } |
| |
| /** |
| * <!-- begin-user-doc --> |
| * <!-- end-user-doc --> |
| * @generated |
| */ |
| @Override |
| public EList<MetricMeasurement> getMeasurements() { |
| if (measurements == null) { |
| measurements = new EObjectContainmentEList<MetricMeasurement>(MetricMeasurement.class, this, AmaltheaPackage.TASK_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.TASK_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.TASK_MEASUREMENT__TASK: |
| if (resolve) return getTask(); |
| return basicGetTask(); |
| case AmaltheaPackage.TASK_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.TASK_MEASUREMENT__TASK: |
| setTask((Task)newValue); |
| return; |
| case AmaltheaPackage.TASK_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.TASK_MEASUREMENT__TASK: |
| setTask((Task)null); |
| return; |
| case AmaltheaPackage.TASK_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.TASK_MEASUREMENT__TASK: |
| return task != null; |
| case AmaltheaPackage.TASK_MEASUREMENT__MEASUREMENTS: |
| return measurements != null && !measurements.isEmpty(); |
| } |
| return super.eIsSet(featureID); |
| } |
| |
| } //TaskMeasurementImpl |