Search in sources :

Example 1 with PropertyDefinition

use of org.yakindu.sct.model.sgen.PropertyDefinition in project statecharts by Yakindu.

the class SGenScopeProvider method getElementReferenceScope.

protected IScope getElementReferenceScope(EObject context) {
    GeneratorModel generatorModel = (GeneratorModel) EcoreUtil.getRootContainer(context);
    EList<PropertyDefinition> properties = generatorModel.getProperties();
    List<Property> all = buildInDeclarations.getDeclarations();
    return Scopes.scopeFor(properties, Scopes.scopeFor(all));
}
Also used : GeneratorModel(org.yakindu.sct.model.sgen.GeneratorModel) PropertyDefinition(org.yakindu.sct.model.sgen.PropertyDefinition) Property(org.yakindu.base.types.Property)

Example 2 with PropertyDefinition

use of org.yakindu.sct.model.sgen.PropertyDefinition 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)2 PropertyDefinition (org.yakindu.sct.model.sgen.PropertyDefinition)2 Property (org.yakindu.base.types.Property)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