blob: 5035a06be5b44ffced3e0c1c5d6ce124c9a3e4f3 [file] [log] [blame]
/**
* *******************************************************************************
* 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.util.Collection;
import org.eclipse.app4mc.amalthea.model.AmaltheaPackage;
import org.eclipse.app4mc.amalthea.model.CallArgument;
import org.eclipse.app4mc.amalthea.model.Counter;
import org.eclipse.app4mc.amalthea.model.ITaggable;
import org.eclipse.app4mc.amalthea.model.LocalModeLabelAssignment;
import org.eclipse.app4mc.amalthea.model.RunEntityCallStatistic;
import org.eclipse.app4mc.amalthea.model.RunnableCall;
import org.eclipse.app4mc.amalthea.model.Tag;
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.EObjectContainmentWithInverseEList;
import org.eclipse.emf.ecore.util.EObjectResolvingEList;
import org.eclipse.emf.ecore.util.InternalEList;
/**
* <!-- begin-user-doc -->
* An implementation of the model object '<em><b>Runnable Call</b></em>'.
* <!-- end-user-doc -->
* <p>
* The following features are implemented:
* </p>
* <ul>
* <li>{@link org.eclipse.app4mc.amalthea.model.impl.RunnableCallImpl#getTags <em>Tags</em>}</li>
* <li>{@link org.eclipse.app4mc.amalthea.model.impl.RunnableCallImpl#getRunnable <em>Runnable</em>}</li>
* <li>{@link org.eclipse.app4mc.amalthea.model.impl.RunnableCallImpl#getArguments <em>Arguments</em>}</li>
* <li>{@link org.eclipse.app4mc.amalthea.model.impl.RunnableCallImpl#getContext <em>Context</em>}</li>
* <li>{@link org.eclipse.app4mc.amalthea.model.impl.RunnableCallImpl#getCounter <em>Counter</em>}</li>
* <li>{@link org.eclipse.app4mc.amalthea.model.impl.RunnableCallImpl#getStatistic <em>Statistic</em>}</li>
* </ul>
*
* @generated
*/
public class RunnableCallImpl extends ActivityGraphItemImpl implements RunnableCall {
/**
* The cached value of the '{@link #getTags() <em>Tags</em>}' reference list.
* <!-- begin-user-doc -->
* <!-- end-user-doc -->
* @see #getTags()
* @generated
* @ordered
*/
protected EList<Tag> tags;
/**
* 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 #getArguments() <em>Arguments</em>}' containment reference list.
* <!-- begin-user-doc -->
* <!-- end-user-doc -->
* @see #getArguments()
* @generated
* @ordered
*/
protected EList<CallArgument> arguments;
/**
* The cached value of the '{@link #getContext() <em>Context</em>}' containment reference list.
* <!-- begin-user-doc -->
* <!-- end-user-doc -->
* @see #getContext()
* @generated
* @ordered
*/
protected EList<LocalModeLabelAssignment> context;
/**
* The cached value of the '{@link #getCounter() <em>Counter</em>}' containment reference.
* <!-- begin-user-doc -->
* <!-- end-user-doc -->
* @see #getCounter()
* @generated
* @ordered
*/
protected Counter counter;
/**
* The cached value of the '{@link #getStatistic() <em>Statistic</em>}' containment reference.
* <!-- begin-user-doc -->
* <!-- end-user-doc -->
* @see #getStatistic()
* @generated
* @ordered
*/
protected RunEntityCallStatistic statistic;
/**
* <!-- begin-user-doc -->
* <!-- end-user-doc -->
* @generated
*/
protected RunnableCallImpl() {
super();
}
/**
* <!-- begin-user-doc -->
* <!-- end-user-doc -->
* @generated
*/
@Override
protected EClass eStaticClass() {
return AmaltheaPackage.eINSTANCE.getRunnableCall();
}
/**
* <!-- begin-user-doc -->
* <!-- end-user-doc -->
* @generated
*/
@Override
public EList<Tag> getTags() {
if (tags == null) {
tags = new EObjectResolvingEList<Tag>(Tag.class, this, AmaltheaPackage.RUNNABLE_CALL__TAGS);
}
return tags;
}
/**
* <!-- 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_CALL__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_CALL__RUNNABLE, oldRunnable, runnable));
}
/**
* <!-- begin-user-doc -->
* <!-- end-user-doc -->
* @generated
*/
@Override
public EList<CallArgument> getArguments() {
if (arguments == null) {
arguments = new EObjectContainmentWithInverseEList<CallArgument>(CallArgument.class, this, AmaltheaPackage.RUNNABLE_CALL__ARGUMENTS, AmaltheaPackage.CALL_ARGUMENT__CONTAINING_CALL);
}
return arguments;
}
/**
* <!-- begin-user-doc -->
* <!-- end-user-doc -->
* @generated
*/
@Override
public EList<LocalModeLabelAssignment> getContext() {
if (context == null) {
context = new EObjectContainmentEList<LocalModeLabelAssignment>(LocalModeLabelAssignment.class, this, AmaltheaPackage.RUNNABLE_CALL__CONTEXT);
}
return context;
}
/**
* <!-- begin-user-doc -->
* <!-- end-user-doc -->
* @generated
*/
@Override
public Counter getCounter() {
return counter;
}
/**
* <!-- begin-user-doc -->
* <!-- end-user-doc -->
* @generated
*/
public NotificationChain basicSetCounter(Counter newCounter, NotificationChain msgs) {
Counter oldCounter = counter;
counter = newCounter;
if (eNotificationRequired()) {
ENotificationImpl notification = new ENotificationImpl(this, Notification.SET, AmaltheaPackage.RUNNABLE_CALL__COUNTER, oldCounter, newCounter);
if (msgs == null) msgs = notification; else msgs.add(notification);
}
return msgs;
}
/**
* <!-- begin-user-doc -->
* <!-- end-user-doc -->
* @generated
*/
@Override
public void setCounter(Counter newCounter) {
if (newCounter != counter) {
NotificationChain msgs = null;
if (counter != null)
msgs = ((InternalEObject)counter).eInverseRemove(this, EOPPOSITE_FEATURE_BASE - AmaltheaPackage.RUNNABLE_CALL__COUNTER, null, msgs);
if (newCounter != null)
msgs = ((InternalEObject)newCounter).eInverseAdd(this, EOPPOSITE_FEATURE_BASE - AmaltheaPackage.RUNNABLE_CALL__COUNTER, null, msgs);
msgs = basicSetCounter(newCounter, msgs);
if (msgs != null) msgs.dispatch();
}
else if (eNotificationRequired())
eNotify(new ENotificationImpl(this, Notification.SET, AmaltheaPackage.RUNNABLE_CALL__COUNTER, newCounter, newCounter));
}
/**
* <!-- begin-user-doc -->
* <!-- end-user-doc -->
* @generated
*/
@Override
public RunEntityCallStatistic getStatistic() {
return statistic;
}
/**
* <!-- begin-user-doc -->
* <!-- end-user-doc -->
* @generated
*/
public NotificationChain basicSetStatistic(RunEntityCallStatistic newStatistic, NotificationChain msgs) {
RunEntityCallStatistic oldStatistic = statistic;
statistic = newStatistic;
if (eNotificationRequired()) {
ENotificationImpl notification = new ENotificationImpl(this, Notification.SET, AmaltheaPackage.RUNNABLE_CALL__STATISTIC, oldStatistic, newStatistic);
if (msgs == null) msgs = notification; else msgs.add(notification);
}
return msgs;
}
/**
* <!-- begin-user-doc -->
* <!-- end-user-doc -->
* @generated
*/
@Override
public void setStatistic(RunEntityCallStatistic newStatistic) {
if (newStatistic != statistic) {
NotificationChain msgs = null;
if (statistic != null)
msgs = ((InternalEObject)statistic).eInverseRemove(this, EOPPOSITE_FEATURE_BASE - AmaltheaPackage.RUNNABLE_CALL__STATISTIC, null, msgs);
if (newStatistic != null)
msgs = ((InternalEObject)newStatistic).eInverseAdd(this, EOPPOSITE_FEATURE_BASE - AmaltheaPackage.RUNNABLE_CALL__STATISTIC, null, msgs);
msgs = basicSetStatistic(newStatistic, msgs);
if (msgs != null) msgs.dispatch();
}
else if (eNotificationRequired())
eNotify(new ENotificationImpl(this, Notification.SET, AmaltheaPackage.RUNNABLE_CALL__STATISTIC, newStatistic, newStatistic));
}
/**
* <!-- begin-user-doc -->
* <!-- end-user-doc -->
* @generated
*/
@SuppressWarnings("unchecked")
@Override
public NotificationChain eInverseAdd(InternalEObject otherEnd, int featureID, NotificationChain msgs) {
switch (featureID) {
case AmaltheaPackage.RUNNABLE_CALL__ARGUMENTS:
return ((InternalEList<InternalEObject>)(InternalEList<?>)getArguments()).basicAdd(otherEnd, msgs);
}
return super.eInverseAdd(otherEnd, featureID, msgs);
}
/**
* <!-- begin-user-doc -->
* <!-- end-user-doc -->
* @generated
*/
@Override
public NotificationChain eInverseRemove(InternalEObject otherEnd, int featureID, NotificationChain msgs) {
switch (featureID) {
case AmaltheaPackage.RUNNABLE_CALL__ARGUMENTS:
return ((InternalEList<?>)getArguments()).basicRemove(otherEnd, msgs);
case AmaltheaPackage.RUNNABLE_CALL__CONTEXT:
return ((InternalEList<?>)getContext()).basicRemove(otherEnd, msgs);
case AmaltheaPackage.RUNNABLE_CALL__COUNTER:
return basicSetCounter(null, msgs);
case AmaltheaPackage.RUNNABLE_CALL__STATISTIC:
return basicSetStatistic(null, 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_CALL__TAGS:
return getTags();
case AmaltheaPackage.RUNNABLE_CALL__RUNNABLE:
if (resolve) return getRunnable();
return basicGetRunnable();
case AmaltheaPackage.RUNNABLE_CALL__ARGUMENTS:
return getArguments();
case AmaltheaPackage.RUNNABLE_CALL__CONTEXT:
return getContext();
case AmaltheaPackage.RUNNABLE_CALL__COUNTER:
return getCounter();
case AmaltheaPackage.RUNNABLE_CALL__STATISTIC:
return getStatistic();
}
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_CALL__TAGS:
getTags().clear();
getTags().addAll((Collection<? extends Tag>)newValue);
return;
case AmaltheaPackage.RUNNABLE_CALL__RUNNABLE:
setRunnable((org.eclipse.app4mc.amalthea.model.Runnable)newValue);
return;
case AmaltheaPackage.RUNNABLE_CALL__ARGUMENTS:
getArguments().clear();
getArguments().addAll((Collection<? extends CallArgument>)newValue);
return;
case AmaltheaPackage.RUNNABLE_CALL__CONTEXT:
getContext().clear();
getContext().addAll((Collection<? extends LocalModeLabelAssignment>)newValue);
return;
case AmaltheaPackage.RUNNABLE_CALL__COUNTER:
setCounter((Counter)newValue);
return;
case AmaltheaPackage.RUNNABLE_CALL__STATISTIC:
setStatistic((RunEntityCallStatistic)newValue);
return;
}
super.eSet(featureID, newValue);
}
/**
* <!-- begin-user-doc -->
* <!-- end-user-doc -->
* @generated
*/
@Override
public void eUnset(int featureID) {
switch (featureID) {
case AmaltheaPackage.RUNNABLE_CALL__TAGS:
getTags().clear();
return;
case AmaltheaPackage.RUNNABLE_CALL__RUNNABLE:
setRunnable((org.eclipse.app4mc.amalthea.model.Runnable)null);
return;
case AmaltheaPackage.RUNNABLE_CALL__ARGUMENTS:
getArguments().clear();
return;
case AmaltheaPackage.RUNNABLE_CALL__CONTEXT:
getContext().clear();
return;
case AmaltheaPackage.RUNNABLE_CALL__COUNTER:
setCounter((Counter)null);
return;
case AmaltheaPackage.RUNNABLE_CALL__STATISTIC:
setStatistic((RunEntityCallStatistic)null);
return;
}
super.eUnset(featureID);
}
/**
* <!-- begin-user-doc -->
* <!-- end-user-doc -->
* @generated
*/
@Override
public boolean eIsSet(int featureID) {
switch (featureID) {
case AmaltheaPackage.RUNNABLE_CALL__TAGS:
return tags != null && !tags.isEmpty();
case AmaltheaPackage.RUNNABLE_CALL__RUNNABLE:
return runnable != null;
case AmaltheaPackage.RUNNABLE_CALL__ARGUMENTS:
return arguments != null && !arguments.isEmpty();
case AmaltheaPackage.RUNNABLE_CALL__CONTEXT:
return context != null && !context.isEmpty();
case AmaltheaPackage.RUNNABLE_CALL__COUNTER:
return counter != null;
case AmaltheaPackage.RUNNABLE_CALL__STATISTIC:
return statistic != null;
}
return super.eIsSet(featureID);
}
/**
* <!-- begin-user-doc -->
* <!-- end-user-doc -->
* @generated
*/
@Override
public int eBaseStructuralFeatureID(int derivedFeatureID, Class<?> baseClass) {
if (baseClass == ITaggable.class) {
switch (derivedFeatureID) {
case AmaltheaPackage.RUNNABLE_CALL__TAGS: return AmaltheaPackage.ITAGGABLE__TAGS;
default: return -1;
}
}
return super.eBaseStructuralFeatureID(derivedFeatureID, baseClass);
}
/**
* <!-- begin-user-doc -->
* <!-- end-user-doc -->
* @generated
*/
@Override
public int eDerivedStructuralFeatureID(int baseFeatureID, Class<?> baseClass) {
if (baseClass == ITaggable.class) {
switch (baseFeatureID) {
case AmaltheaPackage.ITAGGABLE__TAGS: return AmaltheaPackage.RUNNABLE_CALL__TAGS;
default: return -1;
}
}
return super.eDerivedStructuralFeatureID(baseFeatureID, baseClass);
}
} //RunnableCallImpl