Search in sources :

Example 1 with ExecutionVariableImpl

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

the class STextInterpreterTest method initContext.

private void initContext() {
    // "event abc operation foo() var intVar : integer var boolVar : boolean
    // var realVar : real
    ExecutionVariable intVar = new ExecutionVariableImpl();
    intVar.setName("intVar");
    intVar.setFqName("intVar");
    intVar.setType(typeSystem.getType(GenericTypeSystem.INTEGER));
    intVar.setValue(0);
    context.getSlots().add(intVar);
    ExecutionVariable boolVar = new ExecutionVariableImpl();
    boolVar.setName("boolVar");
    boolVar.setFqName("boolVar");
    boolVar.setType(typeSystem.getType(GenericTypeSystem.BOOLEAN));
    boolVar.setValue(false);
    context.getSlots().add(boolVar);
    ExecutionVariable realVar = new ExecutionVariableImpl();
    realVar.setName("realVar");
    realVar.setFqName("realVar");
    realVar.setType(typeSystem.getType(GenericTypeSystem.REAL));
    realVar.setValue(0.0f);
    context.getSlots().add(realVar);
    ExecutionVariable stringVar = new ExecutionVariableImpl();
    stringVar.setName("stringVar");
    stringVar.setFqName("stringVar");
    stringVar.setType(typeSystem.getType(GenericTypeSystem.STRING));
    stringVar.setValue("");
    context.getSlots().add(stringVar);
    ExecutionEvent event = new ExecutionEventImpl();
    event.setName("abc");
    event.setFqName("abc");
    event.setType(typeSystem.getType(GenericTypeSystem.INTEGER));
    context.getSlots().add(event);
    ExecutionVariable enumVar = new ExecutionVariableImpl();
    enumVar.setName("enumVar");
    enumVar.setFqName("enumVar");
    enumVar.setType(typeSystem.getType(GenericTypeSystem.INTEGER));
    context.getSlots().add(enumVar);
    CompositeSlot cpVar = new CompositeSlotImpl();
    cpVar.setName("cpVar");
    cpVar.setFqName("cpVar");
    ExecutionVariable featureVar = new ExecutionVariableImpl();
    featureVar.setName("x");
    featureVar.setFqName("cpVar.x");
    featureVar.setType(typeSystem.getType(GenericTypeSystem.INTEGER));
    featureVar.setValue(0);
    cpVar.getSlots().add(featureVar);
    context.getSlots().add(cpVar);
}
Also used : ExecutionVariableImpl(org.yakindu.sct.model.sruntime.impl.ExecutionVariableImpl) ExecutionEventImpl(org.yakindu.sct.model.sruntime.impl.ExecutionEventImpl) ExecutionEvent(org.yakindu.sct.model.sruntime.ExecutionEvent) CompositeSlot(org.yakindu.sct.model.sruntime.CompositeSlot) CompositeSlotImpl(org.yakindu.sct.model.sruntime.impl.CompositeSlotImpl) ExecutionVariable(org.yakindu.sct.model.sruntime.ExecutionVariable)

Aggregations

CompositeSlot (org.yakindu.sct.model.sruntime.CompositeSlot)1 ExecutionEvent (org.yakindu.sct.model.sruntime.ExecutionEvent)1 ExecutionVariable (org.yakindu.sct.model.sruntime.ExecutionVariable)1 CompositeSlotImpl (org.yakindu.sct.model.sruntime.impl.CompositeSlotImpl)1 ExecutionEventImpl (org.yakindu.sct.model.sruntime.impl.ExecutionEventImpl)1 ExecutionVariableImpl (org.yakindu.sct.model.sruntime.impl.ExecutionVariableImpl)1