Search in sources :

Example 6 with ExecutionRegion

use of org.yakindu.sct.model.sexec.ExecutionRegion in project statecharts by Yakindu.

the class StatechartEnterExistActionTest method testSCLocalReaction.

/**
 * The transition sequence must contain all exit actions for parent states
 * that will be left by a transition.
 */
@SuppressWarnings("unused")
@Test
public void testSCLocalReaction() {
    Statechart sc = _createStatechart("sc");
    {
        VariableDefinition v = _createVariableDefinition("v", TYPE_INTEGER, getOrCreateInternalScope(sc));
        LocalReaction entryAction = _createEntryAction(sc);
        ReactionEffect effect = _createReactionEffect(entryAction);
        _createVariableAssignment(v, AssignmentOperator.ADD_ASSIGN, _createValue(1), effect);
        LocalReaction exitAction = _createExitAction(sc);
        effect = _createReactionEffect(exitAction);
        _createVariableAssignment(v, AssignmentOperator.ADD_ASSIGN, _createValue(1), effect);
        Region r = _createRegion("r", sc);
        {
            Entry e = _createEntry(EntryKind.INITIAL, null, r);
            State s1 = _createState("s1", r);
            Transition t = _createTransition(e, s1);
        }
    }
    ExecutionFlow flow = sequencer.transform(sc);
    ExecutionRegion region = flow.getRegions().get(0);
    assertEquals(0, flow.getReactions().size());
    assertedOrder(flow.getEnterSequences().get(0), null, Lists.newArrayList(new StepLeaf(flow.getEntryAction()), new StepLeaf(region.getEnterSequences().get(0))));
    assertedOrder(flow.getExitSequence(), null, Lists.newArrayList(new StepLeaf(region.getExitSequence()), new StepLeaf(flow.getExitAction())));
}
Also used : LocalReaction(org.yakindu.sct.model.stext.stext.LocalReaction) Entry(org.yakindu.sct.model.sgraph.Entry) SGraphTestFactory._createEntry(org.yakindu.sct.model.sgraph.test.util.SGraphTestFactory._createEntry) VariableDefinition(org.yakindu.sct.model.stext.stext.VariableDefinition) StextTestFactory._createVariableDefinition(org.yakindu.sct.model.stext.test.util.StextTestFactory._createVariableDefinition) SGraphTestFactory._createState(org.yakindu.sct.model.sgraph.test.util.SGraphTestFactory._createState) State(org.yakindu.sct.model.sgraph.State) ExecutionRegion(org.yakindu.sct.model.sexec.ExecutionRegion) Transition(org.yakindu.sct.model.sgraph.Transition) SGraphTestFactory._createTransition(org.yakindu.sct.model.sgraph.test.util.SGraphTestFactory._createTransition) ExecutionFlow(org.yakindu.sct.model.sexec.ExecutionFlow) Statechart(org.yakindu.sct.model.sgraph.Statechart) SGraphTestFactory._createStatechart(org.yakindu.sct.model.sgraph.test.util.SGraphTestFactory._createStatechart) Region(org.yakindu.sct.model.sgraph.Region) SGraphTestFactory._createRegion(org.yakindu.sct.model.sgraph.test.util.SGraphTestFactory._createRegion) ExecutionRegion(org.yakindu.sct.model.sexec.ExecutionRegion) ReactionEffect(org.yakindu.sct.model.stext.stext.ReactionEffect) StextTestFactory._createReactionEffect(org.yakindu.sct.model.stext.test.util.StextTestFactory._createReactionEffect) Test(org.junit.Test)

Example 7 with ExecutionRegion

use of org.yakindu.sct.model.sexec.ExecutionRegion in project statecharts by Yakindu.

the class HistoryEntryImpl method setRegion.

/**
 * <!-- begin-user-doc -->
 * <!-- end-user-doc -->
 * @generated
 */
public void setRegion(ExecutionRegion newRegion) {
    ExecutionRegion oldRegion = region;
    region = newRegion;
    if (eNotificationRequired())
        eNotify(new ENotificationImpl(this, Notification.SET, SexecPackage.HISTORY_ENTRY__REGION, oldRegion, region));
}
Also used : ExecutionRegion(org.yakindu.sct.model.sexec.ExecutionRegion) ENotificationImpl(org.eclipse.emf.ecore.impl.ENotificationImpl)

Aggregations

ExecutionRegion (org.yakindu.sct.model.sexec.ExecutionRegion)7 Test (org.junit.Test)4 ExecutionFlow (org.yakindu.sct.model.sexec.ExecutionFlow)4 Entry (org.yakindu.sct.model.sgraph.Entry)4 Region (org.yakindu.sct.model.sgraph.Region)4 State (org.yakindu.sct.model.sgraph.State)4 Statechart (org.yakindu.sct.model.sgraph.Statechart)4 SGraphTestFactory._createEntry (org.yakindu.sct.model.sgraph.test.util.SGraphTestFactory._createEntry)4 SGraphTestFactory._createRegion (org.yakindu.sct.model.sgraph.test.util.SGraphTestFactory._createRegion)4 SGraphTestFactory._createState (org.yakindu.sct.model.sgraph.test.util.SGraphTestFactory._createState)4 SGraphTestFactory._createStatechart (org.yakindu.sct.model.sgraph.test.util.SGraphTestFactory._createStatechart)4 VariableDefinition (org.yakindu.sct.model.stext.stext.VariableDefinition)4 StextTestFactory._createVariableDefinition (org.yakindu.sct.model.stext.test.util.StextTestFactory._createVariableDefinition)4 ENotificationImpl (org.eclipse.emf.ecore.impl.ENotificationImpl)3 ExecutionState (org.yakindu.sct.model.sexec.ExecutionState)3 HistoryEntry (org.yakindu.sct.model.sexec.HistoryEntry)3 InterfaceScope (org.yakindu.sct.model.stext.stext.InterfaceScope)3 StextTestFactory._createInterfaceScope (org.yakindu.sct.model.stext.test.util.StextTestFactory._createInterfaceScope)3 ExecutionEntry (org.yakindu.sct.model.sexec.ExecutionEntry)2 Sequence (org.yakindu.sct.model.sexec.Sequence)2