Search in sources :

Example 1 with ExecutionContextImpl

use of org.yakindu.sct.model.sruntime.impl.ExecutionContextImpl in project statecharts by Yakindu.

the class FeatureParameterValueImpl method getExecutionContext.

/**
 * <!-- begin-user-doc --> <!-- end-user-doc -->
 *
 * @generated NOT
 */
protected ExecutionContext getExecutionContext() {
    if (!(EcoreUtil.getRootContainer(this) instanceof GeneratorModel)) {
        return new ExecutionContextImpl();
    }
    ExecutionContext context = new ExecutionContextImpl();
    GeneratorModel generatorModel = (GeneratorModel) EcoreUtil.getRootContainer(this);
    EList<PropertyDefinition> properties = generatorModel.getProperties();
    for (PropertyDefinition propertyDefinition : properties) {
        ExecutionVariable variable = SRuntimeFactory.eINSTANCE.createExecutionVariable();
        variable.setName(propertyDefinition.getName());
        variable.setFqName(propertyDefinition.getName());
        variable.setType(propertyDefinition.getType());
        variable.setValue(interpreter.evaluate(propertyDefinition.getInitialValue(), context));
        context.getSlots().add(variable);
    }
    return context;
}
Also used : ExecutionContext(org.yakindu.sct.model.sruntime.ExecutionContext) ExecutionContextImpl(org.yakindu.sct.model.sruntime.impl.ExecutionContextImpl) GeneratorModel(org.yakindu.sct.model.sgen.GeneratorModel) PropertyDefinition(org.yakindu.sct.model.sgen.PropertyDefinition) ExecutionVariable(org.yakindu.sct.model.sruntime.ExecutionVariable)

Aggregations

GeneratorModel (org.yakindu.sct.model.sgen.GeneratorModel)1 PropertyDefinition (org.yakindu.sct.model.sgen.PropertyDefinition)1 ExecutionContext (org.yakindu.sct.model.sruntime.ExecutionContext)1 ExecutionVariable (org.yakindu.sct.model.sruntime.ExecutionVariable)1 ExecutionContextImpl (org.yakindu.sct.model.sruntime.impl.ExecutionContextImpl)1