blob: cb4e50df9f7cd00f5d279db497e53c399f24f51b [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 org.eclipse.app4mc.amalthea.model.AmaltheaIndex;
import org.eclipse.app4mc.amalthea.model.AmaltheaPackage;
import org.eclipse.app4mc.amalthea.model.ParameterType;
import org.eclipse.app4mc.amalthea.model.SchedulerDefinition;
import org.eclipse.app4mc.amalthea.model.SchedulingParameterDefinition;
import org.eclipse.app4mc.amalthea.model.Value;
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.EReference;
import org.eclipse.emf.ecore.InternalEObject;
import org.eclipse.emf.ecore.impl.ENotificationImpl;
/**
* <!-- begin-user-doc -->
* An implementation of the model object '<em><b>Scheduling Parameter Definition</b></em>'.
* <!-- end-user-doc -->
* <p>
* The following features are implemented:
* </p>
* <ul>
* <li>{@link org.eclipse.app4mc.amalthea.model.impl.SchedulingParameterDefinitionImpl#getType <em>Type</em>}</li>
* <li>{@link org.eclipse.app4mc.amalthea.model.impl.SchedulingParameterDefinitionImpl#isMany <em>Many</em>}</li>
* <li>{@link org.eclipse.app4mc.amalthea.model.impl.SchedulingParameterDefinitionImpl#isMandatory <em>Mandatory</em>}</li>
* <li>{@link org.eclipse.app4mc.amalthea.model.impl.SchedulingParameterDefinitionImpl#getDefaultValue <em>Default Value</em>}</li>
* <li>{@link org.eclipse.app4mc.amalthea.model.impl.SchedulingParameterDefinitionImpl#getSchedulerDefinitions <em>Scheduler Definitions</em>}</li>
* </ul>
*
* @generated
*/
public class SchedulingParameterDefinitionImpl extends OsDefinitionImpl implements SchedulingParameterDefinition {
/**
* The default value of the '{@link #getType() <em>Type</em>}' attribute.
* <!-- begin-user-doc -->
* <!-- end-user-doc -->
* @see #getType()
* @generated
* @ordered
*/
protected static final ParameterType TYPE_EDEFAULT = ParameterType._UNDEFINED_;
/**
* The cached value of the '{@link #getType() <em>Type</em>}' attribute.
* <!-- begin-user-doc -->
* <!-- end-user-doc -->
* @see #getType()
* @generated
* @ordered
*/
protected ParameterType type = TYPE_EDEFAULT;
/**
* The default value of the '{@link #isMany() <em>Many</em>}' attribute.
* <!-- begin-user-doc -->
* <!-- end-user-doc -->
* @see #isMany()
* @generated
* @ordered
*/
protected static final boolean MANY_EDEFAULT = false;
/**
* The cached value of the '{@link #isMany() <em>Many</em>}' attribute.
* <!-- begin-user-doc -->
* <!-- end-user-doc -->
* @see #isMany()
* @generated
* @ordered
*/
protected boolean many = MANY_EDEFAULT;
/**
* The default value of the '{@link #isMandatory() <em>Mandatory</em>}' attribute.
* <!-- begin-user-doc -->
* <!-- end-user-doc -->
* @see #isMandatory()
* @generated
* @ordered
*/
protected static final boolean MANDATORY_EDEFAULT = true;
/**
* The cached value of the '{@link #isMandatory() <em>Mandatory</em>}' attribute.
* <!-- begin-user-doc -->
* <!-- end-user-doc -->
* @see #isMandatory()
* @generated
* @ordered
*/
protected boolean mandatory = MANDATORY_EDEFAULT;
/**
* The cached value of the '{@link #getDefaultValue() <em>Default Value</em>}' containment reference.
* <!-- begin-user-doc -->
* <!-- end-user-doc -->
* @see #getDefaultValue()
* @generated
* @ordered
*/
protected Value defaultValue;
/**
* <!-- begin-user-doc -->
* <!-- end-user-doc -->
* @generated
*/
protected SchedulingParameterDefinitionImpl() {
super();
}
/**
* <!-- begin-user-doc -->
* <!-- end-user-doc -->
* @generated
*/
@Override
protected EClass eStaticClass() {
return AmaltheaPackage.eINSTANCE.getSchedulingParameterDefinition();
}
/**
* <!-- begin-user-doc -->
* <!-- end-user-doc -->
* @generated
*/
@Override
public ParameterType getType() {
return type;
}
/**
* <!-- begin-user-doc -->
* <!-- end-user-doc -->
* @generated
*/
@Override
public void setType(ParameterType newType) {
ParameterType oldType = type;
type = newType == null ? TYPE_EDEFAULT : newType;
if (eNotificationRequired())
eNotify(new ENotificationImpl(this, Notification.SET, AmaltheaPackage.SCHEDULING_PARAMETER_DEFINITION__TYPE, oldType, type));
}
/**
* <!-- begin-user-doc -->
* <!-- end-user-doc -->
* @generated
*/
@Override
public boolean isMany() {
return many;
}
/**
* <!-- begin-user-doc -->
* <!-- end-user-doc -->
* @generated
*/
@Override
public void setMany(boolean newMany) {
boolean oldMany = many;
many = newMany;
if (eNotificationRequired())
eNotify(new ENotificationImpl(this, Notification.SET, AmaltheaPackage.SCHEDULING_PARAMETER_DEFINITION__MANY, oldMany, many));
}
/**
* <!-- begin-user-doc -->
* <!-- end-user-doc -->
* @generated
*/
@Override
public boolean isMandatory() {
return mandatory;
}
/**
* <!-- begin-user-doc -->
* <!-- end-user-doc -->
* @generated
*/
@Override
public void setMandatory(boolean newMandatory) {
boolean oldMandatory = mandatory;
mandatory = newMandatory;
if (eNotificationRequired())
eNotify(new ENotificationImpl(this, Notification.SET, AmaltheaPackage.SCHEDULING_PARAMETER_DEFINITION__MANDATORY, oldMandatory, mandatory));
}
/**
* <!-- begin-user-doc -->
* <!-- end-user-doc -->
* @generated
*/
@Override
public Value getDefaultValue() {
return defaultValue;
}
/**
* <!-- begin-user-doc -->
* <!-- end-user-doc -->
* @generated
*/
public NotificationChain basicSetDefaultValue(Value newDefaultValue, NotificationChain msgs) {
Value oldDefaultValue = defaultValue;
defaultValue = newDefaultValue;
if (eNotificationRequired()) {
ENotificationImpl notification = new ENotificationImpl(this, Notification.SET, AmaltheaPackage.SCHEDULING_PARAMETER_DEFINITION__DEFAULT_VALUE, oldDefaultValue, newDefaultValue);
if (msgs == null) msgs = notification; else msgs.add(notification);
}
return msgs;
}
/**
* <!-- begin-user-doc -->
* <!-- end-user-doc -->
* @generated
*/
@Override
public void setDefaultValue(Value newDefaultValue) {
if (newDefaultValue != defaultValue) {
NotificationChain msgs = null;
if (defaultValue != null)
msgs = ((InternalEObject)defaultValue).eInverseRemove(this, EOPPOSITE_FEATURE_BASE - AmaltheaPackage.SCHEDULING_PARAMETER_DEFINITION__DEFAULT_VALUE, null, msgs);
if (newDefaultValue != null)
msgs = ((InternalEObject)newDefaultValue).eInverseAdd(this, EOPPOSITE_FEATURE_BASE - AmaltheaPackage.SCHEDULING_PARAMETER_DEFINITION__DEFAULT_VALUE, null, msgs);
msgs = basicSetDefaultValue(newDefaultValue, msgs);
if (msgs != null) msgs.dispatch();
}
else if (eNotificationRequired())
eNotify(new ENotificationImpl(this, Notification.SET, AmaltheaPackage.SCHEDULING_PARAMETER_DEFINITION__DEFAULT_VALUE, newDefaultValue, newDefaultValue));
}
/**
* <!-- begin-user-doc -->
* <!-- end-user-doc -->
* @generated
*/
@Override
public EList<SchedulerDefinition> getSchedulerDefinitions() {
EReference _schedulerDefinition_AlgorithmParameters = AmaltheaPackage.eINSTANCE.getSchedulerDefinition_AlgorithmParameters();
EReference _schedulerDefinition_ProcessParameters = AmaltheaPackage.eINSTANCE.getSchedulerDefinition_ProcessParameters();
return AmaltheaIndex.<SchedulerDefinition>getInverseReferences(this, AmaltheaPackage.eINSTANCE.getSchedulingParameterDefinition_SchedulerDefinitions(),
java.util.Collections.<EReference>unmodifiableSet(org.eclipse.xtext.xbase.lib.CollectionLiterals.<EReference>newHashSet(_schedulerDefinition_AlgorithmParameters, _schedulerDefinition_ProcessParameters)));
}
/**
* <!-- begin-user-doc -->
* <!-- end-user-doc -->
* @generated
*/
@Override
public NotificationChain eInverseRemove(InternalEObject otherEnd, int featureID, NotificationChain msgs) {
switch (featureID) {
case AmaltheaPackage.SCHEDULING_PARAMETER_DEFINITION__DEFAULT_VALUE:
return basicSetDefaultValue(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.SCHEDULING_PARAMETER_DEFINITION__TYPE:
return getType();
case AmaltheaPackage.SCHEDULING_PARAMETER_DEFINITION__MANY:
return isMany();
case AmaltheaPackage.SCHEDULING_PARAMETER_DEFINITION__MANDATORY:
return isMandatory();
case AmaltheaPackage.SCHEDULING_PARAMETER_DEFINITION__DEFAULT_VALUE:
return getDefaultValue();
case AmaltheaPackage.SCHEDULING_PARAMETER_DEFINITION__SCHEDULER_DEFINITIONS:
return getSchedulerDefinitions();
}
return super.eGet(featureID, resolve, coreType);
}
/**
* <!-- begin-user-doc -->
* <!-- end-user-doc -->
* @generated
*/
@Override
public void eSet(int featureID, Object newValue) {
switch (featureID) {
case AmaltheaPackage.SCHEDULING_PARAMETER_DEFINITION__TYPE:
setType((ParameterType)newValue);
return;
case AmaltheaPackage.SCHEDULING_PARAMETER_DEFINITION__MANY:
setMany((Boolean)newValue);
return;
case AmaltheaPackage.SCHEDULING_PARAMETER_DEFINITION__MANDATORY:
setMandatory((Boolean)newValue);
return;
case AmaltheaPackage.SCHEDULING_PARAMETER_DEFINITION__DEFAULT_VALUE:
setDefaultValue((Value)newValue);
return;
}
super.eSet(featureID, newValue);
}
/**
* <!-- begin-user-doc -->
* <!-- end-user-doc -->
* @generated
*/
@Override
public void eUnset(int featureID) {
switch (featureID) {
case AmaltheaPackage.SCHEDULING_PARAMETER_DEFINITION__TYPE:
setType(TYPE_EDEFAULT);
return;
case AmaltheaPackage.SCHEDULING_PARAMETER_DEFINITION__MANY:
setMany(MANY_EDEFAULT);
return;
case AmaltheaPackage.SCHEDULING_PARAMETER_DEFINITION__MANDATORY:
setMandatory(MANDATORY_EDEFAULT);
return;
case AmaltheaPackage.SCHEDULING_PARAMETER_DEFINITION__DEFAULT_VALUE:
setDefaultValue((Value)null);
return;
}
super.eUnset(featureID);
}
/**
* <!-- begin-user-doc -->
* <!-- end-user-doc -->
* @generated
*/
@Override
public boolean eIsSet(int featureID) {
switch (featureID) {
case AmaltheaPackage.SCHEDULING_PARAMETER_DEFINITION__TYPE:
return type != TYPE_EDEFAULT;
case AmaltheaPackage.SCHEDULING_PARAMETER_DEFINITION__MANY:
return many != MANY_EDEFAULT;
case AmaltheaPackage.SCHEDULING_PARAMETER_DEFINITION__MANDATORY:
return mandatory != MANDATORY_EDEFAULT;
case AmaltheaPackage.SCHEDULING_PARAMETER_DEFINITION__DEFAULT_VALUE:
return defaultValue != null;
case AmaltheaPackage.SCHEDULING_PARAMETER_DEFINITION__SCHEDULER_DEFINITIONS:
return !getSchedulerDefinitions().isEmpty();
}
return super.eIsSet(featureID);
}
/**
* <!-- begin-user-doc -->
* <!-- end-user-doc -->
* @generated
*/
@Override
public String toString() {
if (eIsProxy()) return super.toString();
StringBuilder result = new StringBuilder(super.toString());
result.append(" (type: ");
result.append(type);
result.append(", many: ");
result.append(many);
result.append(", mandatory: ");
result.append(mandatory);
result.append(')');
return result.toString();
}
} //SchedulingParameterDefinitionImpl