| /**
|
| * Copyright (c) 2010, 2019 Mia-Software and others.
|
| * All rights reserved. This program and the accompanying materials
|
| * are made available under the terms of the Eclipse Public License v2.0
|
| * which accompanies this distribution, and is available at
|
| * http://www.eclipse.org/legal/epl-v20.html
|
| *
|
| * Contributors:
|
| * Nicolas Payneau (Mia-Software) - initial API and implementation
|
| */ |
| package org.eclipse.modisco.omg.smm.impl;
|
|
|
| import java.util.Collection;
|
|
|
| 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.EObject;
|
| 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;
|
|
|
| import org.eclipse.modisco.omg.smm.Measure;
|
| import org.eclipse.modisco.omg.smm.Measurement;
|
| import org.eclipse.modisco.omg.smm.ObservedMeasure;
|
| import org.eclipse.modisco.omg.smm.SmmElement;
|
| import org.eclipse.modisco.omg.smm.SmmPackage;
|
|
|
| /**
|
| * <!-- begin-user-doc -->
|
| * An implementation of the model object '<em><b>Observed Measure</b></em>'.
|
| * <!-- end-user-doc -->
|
| * <p>
|
| * The following features are implemented:
|
| * <ul>
|
| * <li>{@link org.eclipse.modisco.omg.smm.impl.ObservedMeasureImpl#getMeasure <em>Measure</em>}</li>
|
| * <li>{@link org.eclipse.modisco.omg.smm.impl.ObservedMeasureImpl#getMeasurements <em>Measurements</em>}</li>
|
| * </ul>
|
| * </p>
|
| *
|
| * @generated
|
| */
|
| public class ObservedMeasureImpl extends SmmElementImpl implements ObservedMeasure {
|
| /**
|
| * The cached value of the '{@link #getMeasure() <em>Measure</em>}' reference.
|
| * <!-- begin-user-doc -->
|
| * <!-- end-user-doc -->
|
| * @see #getMeasure()
|
| * @generated
|
| * @ordered
|
| */
|
| protected Measure measure;
|
|
|
| /**
|
| * 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<Measurement> measurements;
|
|
|
| /**
|
| * <!-- begin-user-doc -->
|
| * <!-- end-user-doc -->
|
| * @generated
|
| */
|
| protected ObservedMeasureImpl() {
|
| super();
|
| }
|
|
|
| /**
|
| * <!-- begin-user-doc -->
|
| * <!-- end-user-doc -->
|
| * @generated
|
| */
|
| @Override
|
| protected EClass eStaticClass() {
|
| return SmmPackage.Literals.OBSERVED_MEASURE;
|
| }
|
|
|
| /**
|
| * <!-- begin-user-doc -->
|
| * <!-- end-user-doc -->
|
| * @generated
|
| */
|
| public Measure getMeasure() {
|
| if (measure != null && measure.eIsProxy()) {
|
| InternalEObject oldMeasure = (InternalEObject)measure;
|
| measure = (Measure)eResolveProxy(oldMeasure);
|
| if (measure != oldMeasure) {
|
| if (eNotificationRequired())
|
| eNotify(new ENotificationImpl(this, Notification.RESOLVE, SmmPackage.OBSERVED_MEASURE__MEASURE, oldMeasure, measure));
|
| }
|
| }
|
| return measure;
|
| }
|
|
|
| /**
|
| * <!-- begin-user-doc -->
|
| * <!-- end-user-doc -->
|
| * @generated
|
| */
|
| public Measure basicGetMeasure() {
|
| return measure;
|
| }
|
|
|
| /**
|
| * <!-- begin-user-doc -->
|
| * <!-- end-user-doc -->
|
| * @generated
|
| */
|
| public void setMeasure(Measure newMeasure) {
|
| Measure oldMeasure = measure;
|
| measure = newMeasure;
|
| if (eNotificationRequired())
|
| eNotify(new ENotificationImpl(this, Notification.SET, SmmPackage.OBSERVED_MEASURE__MEASURE, oldMeasure, measure));
|
| }
|
|
|
| /**
|
| * <!-- begin-user-doc -->
|
| * <!-- end-user-doc -->
|
| * @generated
|
| */
|
| public EList<Measurement> getMeasurements() {
|
| if (measurements == null) {
|
| measurements = new EObjectContainmentEList<Measurement>(Measurement.class, this, SmmPackage.OBSERVED_MEASURE__MEASUREMENTS);
|
| }
|
| return measurements;
|
| }
|
|
|
| /**
|
| * <!-- begin-user-doc -->
|
| * <!-- end-user-doc -->
|
| * @generated
|
| */
|
| public EList<EObject> getMeasureRefimentsObservedMeasures() {
|
| // TODO: implement this method
|
| // Ensure that you remove @generated or mark it @generated NOT
|
| throw new UnsupportedOperationException();
|
| }
|
|
|
| /**
|
| * <!-- begin-user-doc -->
|
| * <!-- end-user-doc -->
|
| * @generated
|
| */
|
| public SmmElement getTo() {
|
| // TODO: implement this method
|
| // Ensure that you remove @generated or mark it @generated NOT
|
| throw new UnsupportedOperationException();
|
| }
|
|
|
| /**
|
| * <!-- begin-user-doc -->
|
| * <!-- end-user-doc -->
|
| * @generated
|
| */
|
| public SmmElement getFrom() {
|
| // TODO: implement this method
|
| // Ensure that you remove @generated or mark it @generated NOT
|
| throw new UnsupportedOperationException();
|
| }
|
|
|
| /**
|
| * <!-- begin-user-doc -->
|
| * <!-- end-user-doc -->
|
| * @generated
|
| */
|
| @Override
|
| public NotificationChain eInverseRemove(InternalEObject otherEnd, int featureID, NotificationChain msgs) {
|
| switch (featureID) {
|
| case SmmPackage.OBSERVED_MEASURE__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 SmmPackage.OBSERVED_MEASURE__MEASURE:
|
| if (resolve) return getMeasure();
|
| return basicGetMeasure();
|
| case SmmPackage.OBSERVED_MEASURE__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 SmmPackage.OBSERVED_MEASURE__MEASURE:
|
| setMeasure((Measure)newValue);
|
| return;
|
| case SmmPackage.OBSERVED_MEASURE__MEASUREMENTS:
|
| getMeasurements().clear();
|
| getMeasurements().addAll((Collection<? extends Measurement>)newValue);
|
| return;
|
| }
|
| super.eSet(featureID, newValue);
|
| }
|
|
|
| /**
|
| * <!-- begin-user-doc -->
|
| * <!-- end-user-doc -->
|
| * @generated
|
| */
|
| @Override
|
| public void eUnset(int featureID) {
|
| switch (featureID) {
|
| case SmmPackage.OBSERVED_MEASURE__MEASURE:
|
| setMeasure((Measure)null);
|
| return;
|
| case SmmPackage.OBSERVED_MEASURE__MEASUREMENTS:
|
| getMeasurements().clear();
|
| return;
|
| }
|
| super.eUnset(featureID);
|
| }
|
|
|
| /**
|
| * <!-- begin-user-doc -->
|
| * <!-- end-user-doc -->
|
| * @generated
|
| */
|
| @Override
|
| public boolean eIsSet(int featureID) {
|
| switch (featureID) {
|
| case SmmPackage.OBSERVED_MEASURE__MEASURE:
|
| return measure != null;
|
| case SmmPackage.OBSERVED_MEASURE__MEASUREMENTS:
|
| return measurements != null && !measurements.isEmpty();
|
| }
|
| return super.eIsSet(featureID);
|
| }
|
|
|
| } //ObservedMeasureImpl
|