blob: 2c085c93ce1da6382b36d8deaa6fc698e9e0f48a [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.BaseObject;
import org.eclipse.app4mc.amalthea.model.RunnableConstraint;
import org.eclipse.app4mc.amalthea.model.RunnableConstraintTarget;
import org.eclipse.app4mc.amalthea.model.RunnableGroup;
import org.eclipse.app4mc.amalthea.model.RunnableSeparationConstraint;
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 Separation Constraint</b></em>'.
* <!-- end-user-doc -->
* <p>
* The following features are implemented:
* </p>
* <ul>
* <li>{@link org.eclipse.app4mc.amalthea.model.impl.RunnableSeparationConstraintImpl#getTarget <em>Target</em>}</li>
* <li>{@link org.eclipse.app4mc.amalthea.model.impl.RunnableSeparationConstraintImpl#getGroups <em>Groups</em>}</li>
* </ul>
*
* @generated
*/
public class RunnableSeparationConstraintImpl extends SeparationConstraintImpl implements RunnableSeparationConstraint {
/**
* The cached value of the '{@link #getTarget() <em>Target</em>}' containment reference.
* <!-- begin-user-doc -->
* <!-- end-user-doc -->
* @see #getTarget()
* @generated
* @ordered
*/
protected RunnableConstraintTarget target;
/**
* The cached value of the '{@link #getGroups() <em>Groups</em>}' containment reference list.
* <!-- begin-user-doc -->
* <!-- end-user-doc -->
* @see #getGroups()
* @generated
* @ordered
*/
protected EList<RunnableGroup> groups;
/**
* <!-- begin-user-doc -->
* <!-- end-user-doc -->
* @generated
*/
protected RunnableSeparationConstraintImpl() {
super();
}
/**
* <!-- begin-user-doc -->
* <!-- end-user-doc -->
* @generated
*/
@Override
protected EClass eStaticClass() {
return AmaltheaPackage.eINSTANCE.getRunnableSeparationConstraint();
}
/**
* <!-- begin-user-doc -->
* <!-- end-user-doc -->
* @generated
*/
@Override
public RunnableConstraintTarget getTarget() {
return target;
}
/**
* <!-- begin-user-doc -->
* <!-- end-user-doc -->
* @generated
*/
public NotificationChain basicSetTarget(RunnableConstraintTarget newTarget, NotificationChain msgs) {
RunnableConstraintTarget oldTarget = target;
target = newTarget;
if (eNotificationRequired()) {
ENotificationImpl notification = new ENotificationImpl(this, Notification.SET, AmaltheaPackage.RUNNABLE_SEPARATION_CONSTRAINT__TARGET, oldTarget, newTarget);
if (msgs == null) msgs = notification; else msgs.add(notification);
}
return msgs;
}
/**
* <!-- begin-user-doc -->
* <!-- end-user-doc -->
* @generated
*/
@Override
public void setTarget(RunnableConstraintTarget newTarget) {
if (newTarget != target) {
NotificationChain msgs = null;
if (target != null)
msgs = ((InternalEObject)target).eInverseRemove(this, EOPPOSITE_FEATURE_BASE - AmaltheaPackage.RUNNABLE_SEPARATION_CONSTRAINT__TARGET, null, msgs);
if (newTarget != null)
msgs = ((InternalEObject)newTarget).eInverseAdd(this, EOPPOSITE_FEATURE_BASE - AmaltheaPackage.RUNNABLE_SEPARATION_CONSTRAINT__TARGET, null, msgs);
msgs = basicSetTarget(newTarget, msgs);
if (msgs != null) msgs.dispatch();
}
else if (eNotificationRequired())
eNotify(new ENotificationImpl(this, Notification.SET, AmaltheaPackage.RUNNABLE_SEPARATION_CONSTRAINT__TARGET, newTarget, newTarget));
}
/**
* <!-- begin-user-doc -->
* <!-- end-user-doc -->
* @generated
*/
@Override
public EList<RunnableGroup> getGroups() {
if (groups == null) {
groups = new EObjectContainmentEList<RunnableGroup>(RunnableGroup.class, this, AmaltheaPackage.RUNNABLE_SEPARATION_CONSTRAINT__GROUPS);
}
return groups;
}
/**
* <!-- begin-user-doc -->
* <!-- end-user-doc -->
* @generated
*/
@Override
public NotificationChain eInverseRemove(InternalEObject otherEnd, int featureID, NotificationChain msgs) {
switch (featureID) {
case AmaltheaPackage.RUNNABLE_SEPARATION_CONSTRAINT__TARGET:
return basicSetTarget(null, msgs);
case AmaltheaPackage.RUNNABLE_SEPARATION_CONSTRAINT__GROUPS:
return ((InternalEList<?>)getGroups()).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_SEPARATION_CONSTRAINT__TARGET:
return getTarget();
case AmaltheaPackage.RUNNABLE_SEPARATION_CONSTRAINT__GROUPS:
return getGroups();
}
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_SEPARATION_CONSTRAINT__TARGET:
setTarget((RunnableConstraintTarget)newValue);
return;
case AmaltheaPackage.RUNNABLE_SEPARATION_CONSTRAINT__GROUPS:
getGroups().clear();
getGroups().addAll((Collection<? extends RunnableGroup>)newValue);
return;
}
super.eSet(featureID, newValue);
}
/**
* <!-- begin-user-doc -->
* <!-- end-user-doc -->
* @generated
*/
@Override
public void eUnset(int featureID) {
switch (featureID) {
case AmaltheaPackage.RUNNABLE_SEPARATION_CONSTRAINT__TARGET:
setTarget((RunnableConstraintTarget)null);
return;
case AmaltheaPackage.RUNNABLE_SEPARATION_CONSTRAINT__GROUPS:
getGroups().clear();
return;
}
super.eUnset(featureID);
}
/**
* <!-- begin-user-doc -->
* <!-- end-user-doc -->
* @generated
*/
@Override
public boolean eIsSet(int featureID) {
switch (featureID) {
case AmaltheaPackage.RUNNABLE_SEPARATION_CONSTRAINT__TARGET:
return target != null;
case AmaltheaPackage.RUNNABLE_SEPARATION_CONSTRAINT__GROUPS:
return groups != null && !groups.isEmpty();
}
return super.eIsSet(featureID);
}
/**
* <!-- begin-user-doc -->
* <!-- end-user-doc -->
* @generated
*/
@Override
public int eBaseStructuralFeatureID(int derivedFeatureID, Class<?> baseClass) {
if (baseClass == RunnableConstraint.class) {
switch (derivedFeatureID) {
case AmaltheaPackage.RUNNABLE_SEPARATION_CONSTRAINT__TARGET: return AmaltheaPackage.RUNNABLE_CONSTRAINT__TARGET;
default: return -1;
}
}
if (baseClass == BaseObject.class) {
switch (derivedFeatureID) {
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 == RunnableConstraint.class) {
switch (baseFeatureID) {
case AmaltheaPackage.RUNNABLE_CONSTRAINT__TARGET: return AmaltheaPackage.RUNNABLE_SEPARATION_CONSTRAINT__TARGET;
default: return -1;
}
}
if (baseClass == BaseObject.class) {
switch (baseFeatureID) {
default: return -1;
}
}
return super.eDerivedStructuralFeatureID(baseFeatureID, baseClass);
}
} //RunnableSeparationConstraintImpl