blob: 14ebe851c5fd5bfb9df6d15d5394cb42f5fa1b00 [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.Counter;
import org.eclipse.app4mc.amalthea.model.EventStimulus;
import org.eclipse.app4mc.amalthea.model.TriggerEvent;
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.EObjectResolvingEList;
/**
* <!-- begin-user-doc -->
* An implementation of the model object '<em><b>Event Stimulus</b></em>'.
* <!-- end-user-doc -->
* <p>
* The following features are implemented:
* </p>
* <ul>
* <li>{@link org.eclipse.app4mc.amalthea.model.impl.EventStimulusImpl#getTriggeringEvents <em>Triggering Events</em>}</li>
* <li>{@link org.eclipse.app4mc.amalthea.model.impl.EventStimulusImpl#getCounter <em>Counter</em>}</li>
* </ul>
*
* @generated
*/
public class EventStimulusImpl extends StimulusImpl implements EventStimulus {
/**
* The cached value of the '{@link #getTriggeringEvents() <em>Triggering Events</em>}' reference list.
* <!-- begin-user-doc -->
* <!-- end-user-doc -->
* @see #getTriggeringEvents()
* @generated
* @ordered
*/
protected EList<TriggerEvent> triggeringEvents;
/**
* 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;
/**
* <!-- begin-user-doc -->
* <!-- end-user-doc -->
* @generated
*/
protected EventStimulusImpl() {
super();
}
/**
* <!-- begin-user-doc -->
* <!-- end-user-doc -->
* @generated
*/
@Override
protected EClass eStaticClass() {
return AmaltheaPackage.eINSTANCE.getEventStimulus();
}
/**
* <!-- begin-user-doc -->
* <!-- end-user-doc -->
* @generated
*/
@Override
public EList<TriggerEvent> getTriggeringEvents() {
if (triggeringEvents == null) {
triggeringEvents = new EObjectResolvingEList<TriggerEvent>(TriggerEvent.class, this, AmaltheaPackage.EVENT_STIMULUS__TRIGGERING_EVENTS);
}
return triggeringEvents;
}
/**
* <!-- 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.EVENT_STIMULUS__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.EVENT_STIMULUS__COUNTER, null, msgs);
if (newCounter != null)
msgs = ((InternalEObject)newCounter).eInverseAdd(this, EOPPOSITE_FEATURE_BASE - AmaltheaPackage.EVENT_STIMULUS__COUNTER, null, msgs);
msgs = basicSetCounter(newCounter, msgs);
if (msgs != null) msgs.dispatch();
}
else if (eNotificationRequired())
eNotify(new ENotificationImpl(this, Notification.SET, AmaltheaPackage.EVENT_STIMULUS__COUNTER, newCounter, newCounter));
}
/**
* <!-- begin-user-doc -->
* <!-- end-user-doc -->
* @generated
*/
@Override
public NotificationChain eInverseRemove(InternalEObject otherEnd, int featureID, NotificationChain msgs) {
switch (featureID) {
case AmaltheaPackage.EVENT_STIMULUS__COUNTER:
return basicSetCounter(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.EVENT_STIMULUS__TRIGGERING_EVENTS:
return getTriggeringEvents();
case AmaltheaPackage.EVENT_STIMULUS__COUNTER:
return getCounter();
}
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.EVENT_STIMULUS__TRIGGERING_EVENTS:
getTriggeringEvents().clear();
getTriggeringEvents().addAll((Collection<? extends TriggerEvent>)newValue);
return;
case AmaltheaPackage.EVENT_STIMULUS__COUNTER:
setCounter((Counter)newValue);
return;
}
super.eSet(featureID, newValue);
}
/**
* <!-- begin-user-doc -->
* <!-- end-user-doc -->
* @generated
*/
@Override
public void eUnset(int featureID) {
switch (featureID) {
case AmaltheaPackage.EVENT_STIMULUS__TRIGGERING_EVENTS:
getTriggeringEvents().clear();
return;
case AmaltheaPackage.EVENT_STIMULUS__COUNTER:
setCounter((Counter)null);
return;
}
super.eUnset(featureID);
}
/**
* <!-- begin-user-doc -->
* <!-- end-user-doc -->
* @generated
*/
@Override
public boolean eIsSet(int featureID) {
switch (featureID) {
case AmaltheaPackage.EVENT_STIMULUS__TRIGGERING_EVENTS:
return triggeringEvents != null && !triggeringEvents.isEmpty();
case AmaltheaPackage.EVENT_STIMULUS__COUNTER:
return counter != null;
}
return super.eIsSet(featureID);
}
} //EventStimulusImpl