Search in sources :

Example 31 with LocalReaction

use of org.yakindu.sct.model.stext.stext.LocalReaction in project statecharts by Yakindu.

the class FoldOutgoingActionsRefactoring method createExitBlock.

private EList<Expression> createExitBlock(List<Expression> actionsToAdd) {
    EList<Expression> actionsOriginal;
    LocalReaction newLocalReaction = StextFactory.eINSTANCE.createLocalReaction();
    ReactionTrigger newReactionTrigger = StextFactory.eINSTANCE.createReactionTrigger();
    ExitEvent exitEvent = StextFactory.eINSTANCE.createExitEvent();
    ReactionEffect newReactionEffect = StextFactory.eINSTANCE.createReactionEffect();
    newLocalReaction.setTrigger(newReactionTrigger);
    newReactionTrigger.getTriggers().add(exitEvent);
    newReactionEffect.getActions().addAll(actionsToAdd);
    newLocalReaction.setEffect(newReactionEffect);
    Scope scope = getContextObject().getScopes().get(0);
    scope.getReactions().add(newLocalReaction);
    actionsOriginal = newReactionEffect.getActions();
    return actionsOriginal;
}
Also used : LocalReaction(org.yakindu.sct.model.stext.stext.LocalReaction) Scope(org.yakindu.sct.model.sgraph.Scope) Expression(org.yakindu.base.expressions.expressions.Expression) ReactionTrigger(org.yakindu.sct.model.stext.stext.ReactionTrigger) ReactionEffect(org.yakindu.sct.model.stext.stext.ReactionEffect) ExitEvent(org.yakindu.sct.model.stext.stext.ExitEvent)

Aggregations

LocalReaction (org.yakindu.sct.model.stext.stext.LocalReaction)31 Test (org.junit.Test)23 ExecutionFlow (org.yakindu.sct.model.sexec.ExecutionFlow)22 VariableDefinition (org.yakindu.sct.model.stext.stext.VariableDefinition)22 StextTestFactory._createVariableDefinition (org.yakindu.sct.model.stext.test.util.StextTestFactory._createVariableDefinition)22 ExecutionState (org.yakindu.sct.model.sexec.ExecutionState)21 StextTestFactory._createLocalReaction (org.yakindu.sct.model.stext.test.util.StextTestFactory._createLocalReaction)21 Scope (org.yakindu.sct.model.sgraph.Scope)16 State (org.yakindu.sct.model.sgraph.State)16 Region (org.yakindu.sct.model.sgraph.Region)15 Statechart (org.yakindu.sct.model.sgraph.Statechart)15 SGraphTestFactory._createRegion (org.yakindu.sct.model.sgraph.test.util.SGraphTestFactory._createRegion)15 SGraphTestFactory._createState (org.yakindu.sct.model.sgraph.test.util.SGraphTestFactory._createState)15 SGraphTestFactory._createStatechart (org.yakindu.sct.model.sgraph.test.util.SGraphTestFactory._createStatechart)15 Sequence (org.yakindu.sct.model.sexec.Sequence)13 StextTestFactory._createInterfaceScope (org.yakindu.sct.model.stext.test.util.StextTestFactory._createInterfaceScope)13 ReactionEffect (org.yakindu.sct.model.stext.stext.ReactionEffect)12 AssignmentExpression (org.yakindu.base.expressions.expressions.AssignmentExpression)11 ReactionTrigger (org.yakindu.sct.model.stext.stext.ReactionTrigger)11 InterfaceScope (org.yakindu.sct.model.stext.stext.InterfaceScope)10