Bladeren bron

exit actions are no longer called multiple times in the case of orthogonal states ( YAKHMI-458 )

terfloth@itemis.de 14 jaren geleden
bovenliggende
commit
60d365a854

+ 21 - 22
plugins/org.yakindu.sct.model.sexec/src/org/yakindu/sct/model/sexec/transformation/ModelSequencer.xtend

@@ -376,10 +376,11 @@ class ModelSequencer {
 		}
 
 		t.exitStates().fold(sequence, [seq, state | {
-			if (state != t.source) { // since we call the exit sequence of the source state we have to exclude it's exit action here
-	
-				if ( state.create.exitAction != null) seq.steps.add(state.create.exitAction.newCall)
-				if ( _addTraceSteps ) seq.steps += newTraceStateExited(state.create)
+			if (state != t.source && state != topExitState) { // since we call the exit sequence of the source state we have to exclude it's exit action here
+				if (t.source.stateVector.last == state.create.stateVector.last) {
+					if ( state.create.exitAction != null) seq.steps.add(state.create.exitAction.newCall)
+					if ( _addTraceSteps ) seq.steps += newTraceStateExited(state.create)				
+				}
 			}
 			
 			seq
@@ -402,6 +403,13 @@ class ModelSequencer {
 			}
 		}
 		
+		// forth exit the top exit state
+		// TODO refactor: the algorithm shoud not depend on these special cases...
+		if ( topExitState != t.source ) {
+			if (topExitState.create.exitAction != null) sequence.steps.add(topExitState.create.exitAction.newCall)
+			if ( _addTraceSteps ) sequence.steps += topExitState.create.newTraceStateExited
+		}
+		
 		
 		// map transition actions
 		if (t.effect != null) sequence.steps.add(t.effect.mapEffect)	
@@ -708,6 +716,8 @@ class ModelSequencer {
 	def Step mapExitAction(State state) {
 		val seq = sexecFactory.createSequence
 		seq.name = "exitAction"
+		seq.comment = "Exit action for state '" + state.name + "'."
+		
 		
 		for (tes : state.timeEventSpecs ) {
 			val timeEvent = tes.createDerivedEvent
@@ -1154,6 +1164,7 @@ class ModelSequencer {
 
 			val caseSeq = sexecFactory.createSequence
 			caseSeq.steps += s.create.exitSequence.newCall
+			val es = s.create
 
 
 			val exitStates = s.parentStates
@@ -1162,9 +1173,11 @@ class ModelSequencer {
 			
 			// include exitAction calls up to the direct child level.
 			exitStates.fold(caseSeq , [ cs, exitState | {
-				 if (exitState.create.exitAction != null) cs.steps.add(exitState.create.exitAction.newCall)
-				 if ( _addTraceSteps ) cs.steps.add(exitState.create.newTraceStateExited)
-				 cs
+				if (es.stateVector.last == exitState.create.stateVector.last) {
+					if (exitState.create.exitAction != null) cs.steps.add(exitState.create.exitAction.newCall)
+					if ( _addTraceSteps ) cs.steps.add(exitState.create.newTraceStateExited)				
+				}
+				cs
 			}]) 
 			
 			if (s.create.exitSequence != null) sSwitch.cases.add(s.create.newCase(caseSeq))
@@ -1315,19 +1328,5 @@ class ModelSequencer {
 			}
 		}
 	}
-	 
-	def List<LocalReaction> entryReactions(State state) {
-		state.localReactions
-			.filter(r | ((r as LocalReaction).trigger as ReactionTrigger).triggers.exists( t | t instanceof EntryEvent))
-			.map(lr | lr as LocalReaction)
-			.toList	
-	} 
-	
-	def List<LocalReaction> exitReactions(State state) {
-		state.localReactions
-			.filter(r | ((r as LocalReaction).trigger as ReactionTrigger).triggers.exists( t | t instanceof ExitEvent))
-			.map(lr | lr as LocalReaction)
-			.toList	
-	} 
-	
+	 	
 }

+ 17 - 0
plugins/org.yakindu.sct.model.sexec/src/org/yakindu/sct/model/sexec/transformation/StatechartExtensions.xtend

@@ -16,6 +16,9 @@ import org.yakindu.sct.model.sgraph.ReactiveElement
 import org.yakindu.sct.model.sgraph.Scope
 import org.yakindu.sct.model.sgraph.RegularState
 import org.yakindu.sct.model.sgraph.Choice
+import org.yakindu.sct.model.stext.stext.EntryEvent
+import org.yakindu.sct.model.stext.stext.ExitEvent
+import org.yakindu.sct.model.stext.stext.ReactionTrigger
 
 class StatechartExtensions {
 	
@@ -129,6 +132,20 @@ class StatechartExtensions {
 	}
 	
 	
+	def List<LocalReaction> entryReactions(State state) {
+		state.localReactions
+			.filter(r | ((r as LocalReaction).trigger as ReactionTrigger).triggers.exists( t | t instanceof EntryEvent))
+			.map(lr | lr as LocalReaction)
+			.toList	
+	} 
+	
+	def List<LocalReaction> exitReactions(State state) {
+		state.localReactions
+			.filter(r | ((r as LocalReaction).trigger as ReactionTrigger).triggers.exists( t | t instanceof ExitEvent))
+			.map(lr | lr as LocalReaction)
+			.toList	
+	} 
+	
 	
 	//=================================================================
 	// naming util extensions

+ 0 - 373
plugins/org.yakindu.sct.model.sexec/xtend-gen/org/yakindu/sct/model/sexec/transformation/FactoryExtension.java

@@ -1,373 +0,0 @@
-package org.yakindu.sct.model.sexec.transformation;
-
-import com.google.inject.Inject;
-import java.util.ArrayList;
-import java.util.HashMap;
-import java.util.List;
-import org.eclipse.emf.common.util.EList;
-import org.eclipse.emf.ecore.util.EcoreUtil;
-import org.eclipse.xtext.naming.IQualifiedNameProvider;
-import org.eclipse.xtext.naming.QualifiedName;
-import org.eclipse.xtext.xbase.lib.CollectionLiterals;
-import org.eclipse.xtext.xbase.lib.IterableExtensions;
-import org.eclipse.xtext.xbase.lib.ObjectExtensions;
-import org.eclipse.xtext.xbase.lib.StringExtensions;
-import org.yakindu.sct.model.sexec.Call;
-import org.yakindu.sct.model.sexec.Check;
-import org.yakindu.sct.model.sexec.CheckRef;
-import org.yakindu.sct.model.sexec.ExecutionChoice;
-import org.yakindu.sct.model.sexec.ExecutionFlow;
-import org.yakindu.sct.model.sexec.ExecutionRegion;
-import org.yakindu.sct.model.sexec.ExecutionState;
-import org.yakindu.sct.model.sexec.ScheduleTimeEvent;
-import org.yakindu.sct.model.sexec.Sequence;
-import org.yakindu.sct.model.sexec.SexecFactory;
-import org.yakindu.sct.model.sexec.Step;
-import org.yakindu.sct.model.sexec.TimeEvent;
-import org.yakindu.sct.model.sexec.UnscheduleTimeEvent;
-import org.yakindu.sct.model.sexec.transformation.StatechartExtensions;
-import org.yakindu.sct.model.sgraph.Choice;
-import org.yakindu.sct.model.sgraph.Reaction;
-import org.yakindu.sct.model.sgraph.Region;
-import org.yakindu.sct.model.sgraph.RegularState;
-import org.yakindu.sct.model.sgraph.Scope;
-import org.yakindu.sct.model.sgraph.Statechart;
-import org.yakindu.sct.model.sgraph.Statement;
-import org.yakindu.sct.model.sgraph.Transition;
-import org.yakindu.sct.model.sgraph.Vertex;
-import org.yakindu.sct.model.stext.stext.EventDefinition;
-import org.yakindu.sct.model.stext.stext.InterfaceScope;
-import org.yakindu.sct.model.stext.stext.InternalScope;
-import org.yakindu.sct.model.stext.stext.LocalReaction;
-import org.yakindu.sct.model.stext.stext.ReactionTrigger;
-import org.yakindu.sct.model.stext.stext.StextFactory;
-import org.yakindu.sct.model.stext.stext.VariableDefinition;
-
-@SuppressWarnings("all")
-public class FactoryExtension {
-  
-  @Inject
-  private IQualifiedNameProvider qfnProvider;
-  
-  @Inject
-  private StatechartExtensions sce;
-  
-  private final HashMap<ArrayList<?>,ExecutionFlow> _createCache_create = new HashMap<ArrayList<?>,ExecutionFlow>();
-  
-  public ExecutionFlow create(final Statechart statechart) {
-    final ArrayList<?>_cacheKey = CollectionLiterals.newArrayList(statechart);
-    ExecutionFlow r;
-    synchronized (_createCache_create) {
-      if (_createCache_create.containsKey(_cacheKey)) {
-        return _createCache_create.get(_cacheKey);
-      }
-      SexecFactory _sexecFactory = this.sexecFactory();
-      ExecutionFlow _createExecutionFlow = _sexecFactory.createExecutionFlow();
-      r = _createExecutionFlow;
-      _createCache_create.put(_cacheKey, r);
-    }
-    String _name = statechart.getName();
-    r.setName(_name);
-    return r;
-  }
-  
-  private final HashMap<ArrayList<?>,InterfaceScope> _createCache_create_1 = new HashMap<ArrayList<?>,InterfaceScope>();
-  
-  protected Scope _create(final InterfaceScope scope) {
-    final ArrayList<?>_cacheKey = CollectionLiterals.newArrayList(scope);
-    InterfaceScope r;
-    synchronized (_createCache_create_1) {
-      if (_createCache_create_1.containsKey(_cacheKey)) {
-        return _createCache_create_1.get(_cacheKey);
-      }
-      StextFactory _stextFactory = this.stextFactory();
-      InterfaceScope _createInterfaceScope = _stextFactory.createInterfaceScope();
-      r = _createInterfaceScope;
-      _createCache_create_1.put(_cacheKey, r);
-    }
-    String _name = scope.getName();
-    r.setName(_name);
-    return r;
-  }
-  
-  private final HashMap<ArrayList<?>,InternalScope> _createCache_create_2 = new HashMap<ArrayList<?>,InternalScope>();
-  
-  protected Scope _create(final InternalScope scope) {
-    final ArrayList<?>_cacheKey = CollectionLiterals.newArrayList(scope);
-    InternalScope r;
-    synchronized (_createCache_create_2) {
-      if (_createCache_create_2.containsKey(_cacheKey)) {
-        return _createCache_create_2.get(_cacheKey);
-      }
-      StextFactory _stextFactory = this.stextFactory();
-      InternalScope _createInternalScope = _stextFactory.createInternalScope();
-      r = _createInternalScope;
-      _createCache_create_2.put(_cacheKey, r);
-    }
-    return r;
-  }
-  
-  private final HashMap<ArrayList<?>,EventDefinition> _createCache_create_3 = new HashMap<ArrayList<?>,EventDefinition>();
-  
-  public EventDefinition create(final EventDefinition event) {
-    final ArrayList<?>_cacheKey = CollectionLiterals.newArrayList(event);
-    EventDefinition r;
-    synchronized (_createCache_create_3) {
-      if (_createCache_create_3.containsKey(_cacheKey)) {
-        return _createCache_create_3.get(_cacheKey);
-      }
-      EventDefinition _copy = EcoreUtil.<EventDefinition>copy(event);
-      r = _copy;
-      _createCache_create_3.put(_cacheKey, r);
-    }
-    return r;
-  }
-  
-  private final HashMap<ArrayList<?>,VariableDefinition> _createCache_create_4 = new HashMap<ArrayList<?>,VariableDefinition>();
-  
-  public VariableDefinition create(final VariableDefinition v) {
-    final ArrayList<?>_cacheKey = CollectionLiterals.newArrayList(v);
-    VariableDefinition r;
-    synchronized (_createCache_create_4) {
-      if (_createCache_create_4.containsKey(_cacheKey)) {
-        return _createCache_create_4.get(_cacheKey);
-      }
-      VariableDefinition _copy = EcoreUtil.<VariableDefinition>copy(v);
-      r = _copy;
-      _createCache_create_4.put(_cacheKey, r);
-    }
-    return r;
-  }
-  
-  private final HashMap<ArrayList<?>,ExecutionState> _createCache_create_5 = new HashMap<ArrayList<?>,ExecutionState>();
-  
-  public ExecutionState create(final RegularState state) {
-    final ArrayList<?>_cacheKey = CollectionLiterals.newArrayList(state);
-    ExecutionState r;
-    synchronized (_createCache_create_5) {
-      if (_createCache_create_5.containsKey(_cacheKey)) {
-        return _createCache_create_5.get(_cacheKey);
-      }
-      SexecFactory _sexecFactory = this.sexecFactory();
-      ExecutionState _createExecutionState = _sexecFactory.createExecutionState();
-      r = _createExecutionState;
-      _createCache_create_5.put(_cacheKey, r);
-    }
-    boolean _operator_notEquals = ObjectExtensions.operator_notEquals(state, null);
-    if (_operator_notEquals) {
-      {
-        String _xifexpression = null;
-        if ((state instanceof org.yakindu.sct.model.sgraph.FinalState)) {
-          _xifexpression = "_final_";
-        } else {
-          String _name = state.getName();
-          _xifexpression = _name;
-        }
-        r.setSimpleName(_xifexpression);
-        QualifiedName _fullyQualifiedName = this.qfnProvider.getFullyQualifiedName(state);
-        String _string = _fullyQualifiedName.toString();
-        String _replaceAll = _string.replaceAll(" ", "");
-        r.setName(_replaceAll);
-        r.setSourceElement(state);
-      }
-    }
-    return r;
-  }
-  
-  private final HashMap<ArrayList<?>,ExecutionChoice> _createCache_create_6 = new HashMap<ArrayList<?>,ExecutionChoice>();
-  
-  public ExecutionChoice create(final Choice choice) {
-    final ArrayList<?>_cacheKey = CollectionLiterals.newArrayList(choice);
-    ExecutionChoice r;
-    synchronized (_createCache_create_6) {
-      if (_createCache_create_6.containsKey(_cacheKey)) {
-        return _createCache_create_6.get(_cacheKey);
-      }
-      SexecFactory _sexecFactory = this.sexecFactory();
-      ExecutionChoice _createExecutionChoice = _sexecFactory.createExecutionChoice();
-      r = _createExecutionChoice;
-      _createCache_create_6.put(_cacheKey, r);
-    }
-    boolean _operator_notEquals = ObjectExtensions.operator_notEquals(choice, null);
-    if (_operator_notEquals) {
-      {
-        Region _parentRegion = choice.getParentRegion();
-        EList<Vertex> _vertices = _parentRegion.getVertices();
-        Iterable<Choice> _filter = IterableExtensions.<Choice>filter(_vertices, org.yakindu.sct.model.sgraph.Choice.class);
-        List<Choice> _list = IterableExtensions.<Choice>toList(_filter);
-        int _indexOf = _list.indexOf(choice);
-        final int n = _indexOf;
-        String _operator_plus = StringExtensions.operator_plus("_choice", ((Integer)n));
-        String _operator_plus_1 = StringExtensions.operator_plus(_operator_plus, "_");
-        r.setSimpleName(_operator_plus_1);
-        QualifiedName _fullyQualifiedName = this.qfnProvider.getFullyQualifiedName(choice);
-        String _string = _fullyQualifiedName.toString();
-        String _replaceAll = _string.replaceAll(" ", "");
-        r.setName(_replaceAll);
-        r.setSourceElement(choice);
-        SexecFactory _sexecFactory_1 = this.sexecFactory();
-        Sequence _createSequence = _sexecFactory_1.createSequence();
-        r.setReactSequence(_createSequence);
-      }
-    }
-    return r;
-  }
-  
-  private final HashMap<ArrayList<?>,ExecutionRegion> _createCache_create_7 = new HashMap<ArrayList<?>,ExecutionRegion>();
-  
-  public ExecutionRegion create(final Region region) {
-    final ArrayList<?>_cacheKey = CollectionLiterals.newArrayList(region);
-    ExecutionRegion r;
-    synchronized (_createCache_create_7) {
-      if (_createCache_create_7.containsKey(_cacheKey)) {
-        return _createCache_create_7.get(_cacheKey);
-      }
-      SexecFactory _sexecFactory = this.sexecFactory();
-      ExecutionRegion _createExecutionRegion = _sexecFactory.createExecutionRegion();
-      r = _createExecutionRegion;
-      _createCache_create_7.put(_cacheKey, r);
-    }
-    boolean _operator_notEquals = ObjectExtensions.operator_notEquals(region, null);
-    if (_operator_notEquals) {
-      {
-        String _name = region.getName();
-        r.setName(_name);
-        r.setSourceElement(region);
-      }
-    }
-    return r;
-  }
-  
-  private final HashMap<ArrayList<?>,Check> _createCache_createCheck = new HashMap<ArrayList<?>,Check>();
-  
-  public Check createCheck(final ReactionTrigger tr) {
-    final ArrayList<?>_cacheKey = CollectionLiterals.newArrayList(tr);
-    Check r;
-    synchronized (_createCache_createCheck) {
-      if (_createCache_createCheck.containsKey(_cacheKey)) {
-        return _createCache_createCheck.get(_cacheKey);
-      }
-      SexecFactory _sexecFactory = this.sexecFactory();
-      Check _createCheck = _sexecFactory.createCheck();
-      r = _createCheck;
-      _createCache_createCheck.put(_cacheKey, r);
-    }
-    Reaction _reaction = this.sce.reaction(tr);
-    String _id = this.sce.id(_reaction);
-    r.setName(_id);
-    return r;
-  }
-  
-  private final HashMap<ArrayList<?>,org.yakindu.sct.model.sexec.Reaction> _createCache_create_8 = new HashMap<ArrayList<?>,org.yakindu.sct.model.sexec.Reaction>();
-  
-  public org.yakindu.sct.model.sexec.Reaction create(final Transition tr) {
-    final ArrayList<?>_cacheKey = CollectionLiterals.newArrayList(tr);
-    org.yakindu.sct.model.sexec.Reaction r;
-    synchronized (_createCache_create_8) {
-      if (_createCache_create_8.containsKey(_cacheKey)) {
-        return _createCache_create_8.get(_cacheKey);
-      }
-      SexecFactory _sexecFactory = this.sexecFactory();
-      org.yakindu.sct.model.sexec.Reaction _createReaction = _sexecFactory.createReaction();
-      r = _createReaction;
-      _createCache_create_8.put(_cacheKey, r);
-    }
-    {
-      String _id = this.sce.id(tr);
-      r.setName(_id);
-      r.setTransition(true);
-      r.setSourceElement(tr);
-    }
-    return r;
-  }
-  
-  private final HashMap<ArrayList<?>,org.yakindu.sct.model.sexec.Reaction> _createCache_create_9 = new HashMap<ArrayList<?>,org.yakindu.sct.model.sexec.Reaction>();
-  
-  public org.yakindu.sct.model.sexec.Reaction create(final LocalReaction lr) {
-    final ArrayList<?>_cacheKey = CollectionLiterals.newArrayList(lr);
-    org.yakindu.sct.model.sexec.Reaction r;
-    synchronized (_createCache_create_9) {
-      if (_createCache_create_9.containsKey(_cacheKey)) {
-        return _createCache_create_9.get(_cacheKey);
-      }
-      SexecFactory _sexecFactory = this.sexecFactory();
-      org.yakindu.sct.model.sexec.Reaction _createReaction = _sexecFactory.createReaction();
-      r = _createReaction;
-      _createCache_create_9.put(_cacheKey, r);
-    }
-    {
-      String _id = this.sce.id(lr);
-      r.setName(_id);
-      r.setTransition(false);
-    }
-    return r;
-  }
-  
-  public CheckRef newRef(final Check check) {
-    CheckRef _xblockexpression = null;
-    {
-      SexecFactory _sexecFactory = this.sexecFactory();
-      CheckRef _createCheckRef = _sexecFactory.createCheckRef();
-      final CheckRef r = _createCheckRef;
-      r.setCheck(check);
-      _xblockexpression = (r);
-    }
-    return _xblockexpression;
-  }
-  
-  public Call newCall(final Step step) {
-    Call _xblockexpression = null;
-    {
-      SexecFactory _sexecFactory = this.sexecFactory();
-      Call _createCall = _sexecFactory.createCall();
-      final Call r = _createCall;
-      r.setStep(step);
-      _xblockexpression = (r);
-    }
-    return _xblockexpression;
-  }
-  
-  public ScheduleTimeEvent newScheduleTimeEvent(final TimeEvent te, final Statement timeValue) {
-    ScheduleTimeEvent _xblockexpression = null;
-    {
-      SexecFactory _sexecFactory = this.sexecFactory();
-      ScheduleTimeEvent _createScheduleTimeEvent = _sexecFactory.createScheduleTimeEvent();
-      final ScheduleTimeEvent r = _createScheduleTimeEvent;
-      r.setTimeEvent(te);
-      r.setTimeValue(timeValue);
-      _xblockexpression = (r);
-    }
-    return _xblockexpression;
-  }
-  
-  public UnscheduleTimeEvent newUnscheduleTimeEvent(final TimeEvent te) {
-    UnscheduleTimeEvent _xblockexpression = null;
-    {
-      SexecFactory _sexecFactory = this.sexecFactory();
-      UnscheduleTimeEvent _createUnscheduleTimeEvent = _sexecFactory.createUnscheduleTimeEvent();
-      final UnscheduleTimeEvent r = _createUnscheduleTimeEvent;
-      r.setTimeEvent(te);
-      _xblockexpression = (r);
-    }
-    return _xblockexpression;
-  }
-  
-  public SexecFactory sexecFactory() {
-    return SexecFactory.eINSTANCE;
-  }
-  
-  public StextFactory stextFactory() {
-    return StextFactory.eINSTANCE;
-  }
-  
-  public Scope create(final Scope scope) {
-    if ((scope instanceof InterfaceScope)) {
-      return _create((InterfaceScope)scope);
-    } else if ((scope instanceof InternalScope)) {
-      return _create((InternalScope)scope);
-    } else {
-      throw new IllegalArgumentException("Unhandled parameter types: " +
-        java.util.Arrays.<Object>asList(scope).toString());
-    }
-  }
-}

+ 0 - 602
plugins/org.yakindu.sct.model.sexec/xtend-gen/org/yakindu/sct/model/sexec/transformation/FlowOptimizer.java

@@ -1,602 +0,0 @@
-package org.yakindu.sct.model.sexec.transformation;
-
-import com.google.inject.Inject;
-import java.util.ArrayList;
-import java.util.List;
-import org.eclipse.emf.common.util.EList;
-import org.eclipse.emf.ecore.EObject;
-import org.eclipse.emf.ecore.util.EcoreUtil;
-import org.eclipse.xtext.naming.IQualifiedNameProvider;
-import org.eclipse.xtext.xbase.lib.Functions.Function1;
-import org.eclipse.xtext.xbase.lib.IterableExtensions;
-import org.eclipse.xtext.xbase.lib.ListExtensions;
-import org.eclipse.xtext.xbase.lib.ObjectExtensions;
-import org.eclipse.xtext.xbase.lib.StringExtensions;
-import org.yakindu.sct.model.sexec.Call;
-import org.yakindu.sct.model.sexec.Check;
-import org.yakindu.sct.model.sexec.CheckRef;
-import org.yakindu.sct.model.sexec.ExecutionFlow;
-import org.yakindu.sct.model.sexec.ExecutionNode;
-import org.yakindu.sct.model.sexec.ExecutionState;
-import org.yakindu.sct.model.sexec.If;
-import org.yakindu.sct.model.sexec.Reaction;
-import org.yakindu.sct.model.sexec.Sequence;
-import org.yakindu.sct.model.sexec.SexecFactory;
-import org.yakindu.sct.model.sexec.StateCase;
-import org.yakindu.sct.model.sexec.StateSwitch;
-import org.yakindu.sct.model.sexec.Step;
-import org.yakindu.sct.model.sexec.transformation.FactoryExtension;
-import org.yakindu.sct.model.sgraph.SGraphFactory;
-import org.yakindu.sct.model.stext.stext.StextFactory;
-
-@SuppressWarnings("all")
-public class FlowOptimizer {
-  
-  @Inject
-  private IQualifiedNameProvider qfnProvider;
-  
-  @Inject
-  private FactoryExtension factory;
-  
-  private boolean _inlineReactions;
-  
-  public boolean inlineReactions(final boolean b) {
-    boolean __inlineReactions = this._inlineReactions = b;
-    return __inlineReactions;
-  }
-  
-  private boolean _inlineEntryActions;
-  
-  public boolean inlineEntryActions(final boolean b) {
-    boolean __inlineEntryActions = this._inlineEntryActions = b;
-    return __inlineEntryActions;
-  }
-  
-  private boolean _inlineExitActions;
-  
-  public boolean inlineExitActions(final boolean b) {
-    boolean __inlineExitActions = this._inlineExitActions = b;
-    return __inlineExitActions;
-  }
-  
-  private boolean _inlineEnterSequences;
-  
-  public boolean inlineEnterSequences(final boolean b) {
-    boolean __inlineEnterSequences = this._inlineEnterSequences = b;
-    return __inlineEnterSequences;
-  }
-  
-  private boolean _inlineExitSequences;
-  
-  public boolean inlineExitSequences(final boolean b) {
-    boolean __inlineExitSequences = this._inlineExitSequences = b;
-    return __inlineExitSequences;
-  }
-  
-  private boolean _inlineChoices;
-  
-  public boolean inlineChoices(final boolean b) {
-    boolean __inlineChoices = this._inlineChoices = b;
-    return __inlineChoices;
-  }
-  
-  public ExecutionFlow transform(final ExecutionFlow flow) {
-    ExecutionFlow _xblockexpression = null;
-    {
-      if (this._inlineReactions) {
-        {
-          this.inlineReactionChecks(flow);
-          this.inlineReactionEffects(flow);
-        }
-      }
-      if (this._inlineEntryActions) {
-        EList<ExecutionState> _states = flow.getStates();
-        final Function1<ExecutionState,Step> _function = new Function1<ExecutionState,Step>() {
-            public Step apply(final ExecutionState state) {
-              Step _entryAction = state.getEntryAction();
-              Step _inline = FlowOptimizer.this.inline(_entryAction);
-              return _inline;
-            }
-          };
-        IterableExtensions.<ExecutionState>forEach(_states, _function);
-      }
-      if (this._inlineExitActions) {
-        EList<ExecutionState> _states_1 = flow.getStates();
-        final Function1<ExecutionState,Step> _function_1 = new Function1<ExecutionState,Step>() {
-            public Step apply(final ExecutionState state_1) {
-              Step _exitAction = state_1.getExitAction();
-              Step _inline_1 = FlowOptimizer.this.inline(_exitAction);
-              return _inline_1;
-            }
-          };
-        IterableExtensions.<ExecutionState>forEach(_states_1, _function_1);
-      }
-      if (this._inlineEnterSequences) {
-        EList<ExecutionState> _states_2 = flow.getStates();
-        final Function1<ExecutionState,Step> _function_2 = new Function1<ExecutionState,Step>() {
-            public Step apply(final ExecutionState state_2) {
-              Sequence _enterSequence = state_2.getEnterSequence();
-              Step _inline_2 = FlowOptimizer.this.inline(_enterSequence);
-              return _inline_2;
-            }
-          };
-        IterableExtensions.<ExecutionState>forEach(_states_2, _function_2);
-      }
-      if (this._inlineExitSequences) {
-        EList<ExecutionState> _states_3 = flow.getStates();
-        final Function1<ExecutionState,Step> _function_3 = new Function1<ExecutionState,Step>() {
-            public Step apply(final ExecutionState state_3) {
-              Sequence _exitSequence = state_3.getExitSequence();
-              Step _inline_3 = FlowOptimizer.this.inline(_exitSequence);
-              return _inline_3;
-            }
-          };
-        IterableExtensions.<ExecutionState>forEach(_states_3, _function_3);
-      }
-      if (this._inlineChoices) {
-        {
-          EList<ExecutionNode> _nodes = flow.getNodes();
-          final Function1<ExecutionNode,ExecutionNode> _function_4 = new Function1<ExecutionNode,ExecutionNode>() {
-              public ExecutionNode apply(final ExecutionNode node) {
-                ExecutionNode _xblockexpression_1 = null;
-                {
-                  EList<Reaction> _reactions = node.getReactions();
-                  final Function1<Reaction,Step> _function_5 = new Function1<Reaction,Step>() {
-                      public Step apply(final Reaction r) {
-                        Step _xblockexpression_2 = null;
-                        {
-                          Check _check = r.getCheck();
-                          FlowOptimizer.this.inline(_check);
-                          Step _effect = r.getEffect();
-                          Step _inline_4 = FlowOptimizer.this.inline(_effect);
-                          _xblockexpression_2 = (_inline_4);
-                        }
-                        return _xblockexpression_2;
-                      }
-                    };
-                  IterableExtensions.<Reaction>forEach(_reactions, _function_5);
-                  _xblockexpression_1 = (node);
-                }
-                return _xblockexpression_1;
-              }
-            };
-          IterableExtensions.<ExecutionNode>forEach(_nodes, _function_4);
-          EList<ExecutionNode> _nodes_1 = flow.getNodes();
-          final Function1<ExecutionNode,Step> _function_6 = new Function1<ExecutionNode,Step>() {
-              public Step apply(final ExecutionNode node_1) {
-                Sequence _reactSequence = node_1.getReactSequence();
-                Step _inline_5 = FlowOptimizer.this.inline(_reactSequence);
-                return _inline_5;
-              }
-            };
-          IterableExtensions.<ExecutionNode>forEach(_nodes_1, _function_6);
-        }
-      }
-      _xblockexpression = (flow);
-    }
-    return _xblockexpression;
-  }
-  
-  public void inlineReactionChecks(final ExecutionFlow flow) {
-    EList<ExecutionState> _states = flow.getStates();
-    final Function1<ExecutionState,ExecutionState> _function = new Function1<ExecutionState,ExecutionState>() {
-        public ExecutionState apply(final ExecutionState state) {
-          ExecutionState _inlineReactionChecks = FlowOptimizer.this.inlineReactionChecks(state);
-          return _inlineReactionChecks;
-        }
-      };
-    IterableExtensions.<ExecutionState>forEach(_states, _function);
-  }
-  
-  public ExecutionState inlineReactionChecks(final ExecutionState state) {
-    ExecutionState _xblockexpression = null;
-    {
-      EList<Reaction> _reactions = state.getReactions();
-      final Function1<Reaction,Check> _function = new Function1<Reaction,Check>() {
-          public Check apply(final Reaction r) {
-            Check _check = r.getCheck();
-            return _check;
-          }
-        };
-      List<Check> _map = ListExtensions.<Reaction, Check>map(_reactions, _function);
-      List<Check> _list = IterableExtensions.<Check>toList(_map);
-      final List<Check> checks = _list;
-      final Function1<Check,Check> _function_1 = new Function1<Check,Check>() {
-          public Check apply(final Check c) {
-            Check _inline = FlowOptimizer.this.inline(c);
-            return _inline;
-          }
-        };
-      IterableExtensions.<Check>forEach(checks, _function_1);
-      _xblockexpression = (state);
-    }
-    return _xblockexpression;
-  }
-  
-  public Check inline(final Check c) {
-    Check _xblockexpression = null;
-    {
-      boolean _operator_notEquals = ObjectExtensions.operator_notEquals(c, null);
-      if (_operator_notEquals) {
-        {
-          ArrayList<CheckRef> _arrayList = new ArrayList<CheckRef>();
-          final List<CheckRef> cRefs = _arrayList;
-          EList<CheckRef> _refs = c.getRefs();
-          cRefs.addAll(_refs);
-          for (CheckRef ref : cRefs) {
-            {
-              Check _copy = EcoreUtil.<Check>copy(c);
-              final Check clone = _copy;
-              EObject _eContainer = ref.eContainer();
-              this.substitute(_eContainer, ref, clone);
-              ref.setCheck(null);
-            }
-          }
-        }
-      }
-      _xblockexpression = (c);
-    }
-    return _xblockexpression;
-  }
-  
-  protected Object _substitute(final EObject owner, final Check pre, final Check post) {
-    return null;
-  }
-  
-  protected Object _substitute(final If owner, final Check pre, final Check post) {
-    Object _xifexpression = null;
-    Check _check = owner.getCheck();
-    boolean _operator_equals = ObjectExtensions.operator_equals(_check, pre);
-    if (_operator_equals) {
-      owner.setCheck(post);
-    }
-    return _xifexpression;
-  }
-  
-  public void inlineReactionEffects(final ExecutionFlow flow) {
-    EList<ExecutionState> _states = flow.getStates();
-    final Function1<ExecutionState,ExecutionState> _function = new Function1<ExecutionState,ExecutionState>() {
-        public ExecutionState apply(final ExecutionState state) {
-          ExecutionState _inlineReactionEffects = FlowOptimizer.this.inlineReactionEffects(state);
-          return _inlineReactionEffects;
-        }
-      };
-    IterableExtensions.<ExecutionState>forEach(_states, _function);
-  }
-  
-  public ExecutionState inlineReactionEffects(final ExecutionState state) {
-    ExecutionState _xblockexpression = null;
-    {
-      EList<Reaction> _reactions = state.getReactions();
-      final Function1<Reaction,Step> _function = new Function1<Reaction,Step>() {
-          public Step apply(final Reaction r) {
-            Step _effect = r.getEffect();
-            return _effect;
-          }
-        };
-      List<Step> _map = ListExtensions.<Reaction, Step>map(_reactions, _function);
-      List<Step> _list = IterableExtensions.<Step>toList(_map);
-      final List<Step> effects = _list;
-      final Function1<Step,Step> _function_1 = new Function1<Step,Step>() {
-          public Step apply(final Step e) {
-            Step _inline = FlowOptimizer.this.inline(e);
-            return _inline;
-          }
-        };
-      IterableExtensions.<Step>forEach(effects, _function_1);
-      _xblockexpression = (state);
-    }
-    return _xblockexpression;
-  }
-  
-  public void inlineEntryAndExitActions(final ExecutionFlow flow) {
-    {
-      EList<ExecutionState> _states = flow.getStates();
-      final Function1<ExecutionState,Step> _function = new Function1<ExecutionState,Step>() {
-          public Step apply(final ExecutionState state) {
-            Step _entryAction = state.getEntryAction();
-            Step _inline = FlowOptimizer.this.inline(_entryAction);
-            return _inline;
-          }
-        };
-      IterableExtensions.<ExecutionState>forEach(_states, _function);
-      EList<ExecutionState> _states_1 = flow.getStates();
-      final Function1<ExecutionState,Step> _function_1 = new Function1<ExecutionState,Step>() {
-          public Step apply(final ExecutionState state_1) {
-            Step _exitAction = state_1.getExitAction();
-            Step _inline_1 = FlowOptimizer.this.inline(_exitAction);
-            return _inline_1;
-          }
-        };
-      IterableExtensions.<ExecutionState>forEach(_states_1, _function_1);
-    }
-  }
-  
-  public Step inline(final Step step) {
-    Step _xblockexpression = null;
-    {
-      boolean _operator_notEquals = ObjectExtensions.operator_notEquals(step, null);
-      if (_operator_notEquals) {
-        {
-          ArrayList<Call> _arrayList = new ArrayList<Call>();
-          final List<Call> calls = _arrayList;
-          EList<Call> _caller = step.getCaller();
-          calls.addAll(_caller);
-          for (Call caller : calls) {
-            {
-              Step _stepCopy = this.stepCopy(step);
-              final Step clone = _stepCopy;
-              EObject _eContainer = caller.eContainer();
-              boolean _substituteCall = this.substituteCall(_eContainer, caller, clone);
-              if (_substituteCall) {
-                caller.setStep(null);
-              } else {
-                String _operator_plus = StringExtensions.operator_plus("Did not substitute \'", step);
-                String _operator_plus_1 = StringExtensions.operator_plus(_operator_plus, "\'.");
-                System.out.println(_operator_plus_1);
-              }
-            }
-          }
-        }
-      }
-      _xblockexpression = (step);
-    }
-    return _xblockexpression;
-  }
-  
-  protected boolean _substituteCall(final EObject owner, final Call pre, final Step post) {
-    return false;
-  }
-  
-  protected boolean _substituteCall(final Sequence owner, final Call call, final Step step) {
-    {
-      EList<Step> _steps = owner.getSteps();
-      boolean _contains = _steps.contains(call);
-      if (_contains) {
-        {
-          EList<Step> _steps_1 = owner.getSteps();
-          EList<Step> _steps_2 = owner.getSteps();
-          int _indexOf = _steps_2.indexOf(call);
-          _steps_1.set(_indexOf, step);
-          return true;
-        }
-      }
-      return false;
-    }
-  }
-  
-  protected boolean _substituteCall(final If owner, final Call call, final Step step) {
-    {
-      Step _thenStep = owner.getThenStep();
-      boolean _operator_equals = ObjectExtensions.operator_equals(_thenStep, call);
-      if (_operator_equals) {
-        {
-          owner.setThenStep(step);
-          return true;
-        }
-      } else {
-        Step _elseStep = owner.getElseStep();
-        boolean _operator_equals_1 = ObjectExtensions.operator_equals(_elseStep, call);
-        if (_operator_equals_1) {
-          {
-            owner.setElseStep(step);
-            return true;
-          }
-        }
-      }
-      return false;
-    }
-  }
-  
-  protected Step _stepCopy(final Step step) {
-    Step _copy = EcoreUtil.<Step>copy(step);
-    return _copy;
-  }
-  
-  protected Step _stepCopy(final Sequence seq) {
-    Sequence _xblockexpression = null;
-    {
-      SexecFactory _sexecFactory = this.sexecFactory();
-      Sequence _createSequence = _sexecFactory.createSequence();
-      final Sequence _copy = _createSequence;
-      String _name = seq.getName();
-      _copy.setName(_name);
-      String _comment = seq.getComment();
-      _copy.setComment(_comment);
-      EList<Step> _steps = _copy.getSteps();
-      EList<Step> _steps_1 = seq.getSteps();
-      final Function1<Step,Step> _function = new Function1<Step,Step>() {
-          public Step apply(final Step s) {
-            Step _stepCopy = FlowOptimizer.this.stepCopy(s);
-            return _stepCopy;
-          }
-        };
-      List<Step> _map = ListExtensions.<Step, Step>map(_steps_1, _function);
-      _steps.addAll(_map);
-      _xblockexpression = (_copy);
-    }
-    return _xblockexpression;
-  }
-  
-  protected Step _stepCopy(final If _if) {
-    If _xblockexpression = null;
-    {
-      SexecFactory _sexecFactory = this.sexecFactory();
-      If _createIf = _sexecFactory.createIf();
-      final If _copy = _createIf;
-      String _name = _if.getName();
-      _copy.setName(_name);
-      String _comment = _if.getComment();
-      _copy.setComment(_comment);
-      Check _check = _if.getCheck();
-      Step _stepCopy = this.stepCopy(_check);
-      _copy.setCheck(((Check) _stepCopy));
-      Step _xifexpression = null;
-      Step _thenStep = _if.getThenStep();
-      boolean _operator_notEquals = ObjectExtensions.operator_notEquals(_thenStep, null);
-      if (_operator_notEquals) {
-        Step _thenStep_1 = _if.getThenStep();
-        Step _stepCopy_1 = this.stepCopy(_thenStep_1);
-        _xifexpression = _stepCopy_1;
-      } else {
-        _xifexpression = null;
-      }
-      _copy.setThenStep(_xifexpression);
-      Step _xifexpression_1 = null;
-      Step _elseStep = _if.getElseStep();
-      boolean _operator_notEquals_1 = ObjectExtensions.operator_notEquals(_elseStep, null);
-      if (_operator_notEquals_1) {
-        Step _elseStep_1 = _if.getElseStep();
-        Step _stepCopy_2 = this.stepCopy(_elseStep_1);
-        _xifexpression_1 = _stepCopy_2;
-      } else {
-        _xifexpression_1 = null;
-      }
-      _copy.setElseStep(_xifexpression_1);
-      _xblockexpression = (_copy);
-    }
-    return _xblockexpression;
-  }
-  
-  protected Step _stepCopy(final Call call) {
-    Call _xblockexpression = null;
-    {
-      SexecFactory _sexecFactory = this.sexecFactory();
-      Call _createCall = _sexecFactory.createCall();
-      final Call _copy = _createCall;
-      String _name = call.getName();
-      _copy.setName(_name);
-      String _comment = call.getComment();
-      _copy.setComment(_comment);
-      Step _step = call.getStep();
-      _copy.setStep(_step);
-      _xblockexpression = (_copy);
-    }
-    return _xblockexpression;
-  }
-  
-  protected Step _stepCopy(final CheckRef cref) {
-    CheckRef _xblockexpression = null;
-    {
-      SexecFactory _sexecFactory = this.sexecFactory();
-      CheckRef _createCheckRef = _sexecFactory.createCheckRef();
-      final CheckRef _copy = _createCheckRef;
-      String _name = cref.getName();
-      _copy.setName(_name);
-      String _comment = cref.getComment();
-      _copy.setComment(_comment);
-      Check _check = cref.getCheck();
-      _copy.setCheck(_check);
-      _xblockexpression = (_copy);
-    }
-    return _xblockexpression;
-  }
-  
-  protected Step _stepCopy(final StateSwitch _switch) {
-    StateSwitch _xblockexpression = null;
-    {
-      SexecFactory _sexecFactory = this.sexecFactory();
-      StateSwitch _createStateSwitch = _sexecFactory.createStateSwitch();
-      final StateSwitch _copy = _createStateSwitch;
-      String _name = _switch.getName();
-      _copy.setName(_name);
-      String _comment = _switch.getComment();
-      _copy.setComment(_comment);
-      int _stateConfigurationIdx = _switch.getStateConfigurationIdx();
-      _copy.setStateConfigurationIdx(_stateConfigurationIdx);
-      EList<StateCase> _cases = _copy.getCases();
-      EList<StateCase> _cases_1 = _switch.getCases();
-      final Function1<StateCase,StateCase> _function = new Function1<StateCase,StateCase>() {
-          public StateCase apply(final StateCase c) {
-            StateCase _stepCopy = FlowOptimizer.this.stepCopy(c);
-            return _stepCopy;
-          }
-        };
-      List<StateCase> _map = ListExtensions.<StateCase, StateCase>map(_cases_1, _function);
-      _cases.addAll(_map);
-      _xblockexpression = (_copy);
-    }
-    return _xblockexpression;
-  }
-  
-  public StateCase stepCopy(final StateCase _case) {
-    StateCase _xblockexpression = null;
-    {
-      SexecFactory _sexecFactory = this.sexecFactory();
-      StateCase _createStateCase = _sexecFactory.createStateCase();
-      final StateCase _copy = _createStateCase;
-      ExecutionState _state = _case.getState();
-      _copy.setState(_state);
-      Step _step = _case.getStep();
-      Step _stepCopy = this.stepCopy(_step);
-      _copy.setStep(_stepCopy);
-      _xblockexpression = (_copy);
-    }
-    return _xblockexpression;
-  }
-  
-  public SexecFactory sexecFactory() {
-    return SexecFactory.eINSTANCE;
-  }
-  
-  public SGraphFactory sgraphFactory() {
-    return SGraphFactory.eINSTANCE;
-  }
-  
-  public StextFactory stextFactory() {
-    return StextFactory.eINSTANCE;
-  }
-  
-  public Object substitute(final EObject owner, final Check pre, final Check post) {
-    if ((owner instanceof If)
-         && (pre instanceof Check)
-         && (post instanceof Check)) {
-      return _substitute((If)owner, (Check)pre, (Check)post);
-    } else if ((owner instanceof EObject)
-         && (pre instanceof Check)
-         && (post instanceof Check)) {
-      return _substitute((EObject)owner, (Check)pre, (Check)post);
-    } else {
-      throw new IllegalArgumentException("Unhandled parameter types: " +
-        java.util.Arrays.<Object>asList(owner, pre, post).toString());
-    }
-  }
-  
-  public boolean substituteCall(final EObject owner, final Call call, final Step step) {
-    if ((owner instanceof If)
-         && (call instanceof Call)
-         && (step instanceof Step)) {
-      return _substituteCall((If)owner, (Call)call, (Step)step);
-    } else if ((owner instanceof Sequence)
-         && (call instanceof Call)
-         && (step instanceof Step)) {
-      return _substituteCall((Sequence)owner, (Call)call, (Step)step);
-    } else if ((owner instanceof EObject)
-         && (call instanceof Call)
-         && (step instanceof Step)) {
-      return _substituteCall((EObject)owner, (Call)call, (Step)step);
-    } else {
-      throw new IllegalArgumentException("Unhandled parameter types: " +
-        java.util.Arrays.<Object>asList(owner, call, step).toString());
-    }
-  }
-  
-  public Step stepCopy(final Step cref) {
-    if ((cref instanceof CheckRef)) {
-      return _stepCopy((CheckRef)cref);
-    } else if ((cref instanceof Call)) {
-      return _stepCopy((Call)cref);
-    } else if ((cref instanceof If)) {
-      return _stepCopy((If)cref);
-    } else if ((cref instanceof Sequence)) {
-      return _stepCopy((Sequence)cref);
-    } else if ((cref instanceof StateSwitch)) {
-      return _stepCopy((StateSwitch)cref);
-    } else if ((cref instanceof Step)) {
-      return _stepCopy((Step)cref);
-    } else {
-      throw new IllegalArgumentException("Unhandled parameter types: " +
-        java.util.Arrays.<Object>asList(cref).toString());
-    }
-  }
-}

File diff suppressed because it is too large
+ 0 - 2689
plugins/org.yakindu.sct.model.sexec/xtend-gen/org/yakindu/sct/model/sexec/transformation/ModelSequencer.java


+ 0 - 308
plugins/org.yakindu.sct.model.sexec/xtend-gen/org/yakindu/sct/model/sexec/transformation/StatechartExtensions.java

@@ -1,308 +0,0 @@
-package org.yakindu.sct.model.sexec.transformation;
-
-import java.util.ArrayList;
-import java.util.List;
-import org.eclipse.emf.common.util.EList;
-import org.eclipse.emf.ecore.EObject;
-import org.eclipse.xtext.EcoreUtil2;
-import org.eclipse.xtext.xbase.lib.ComparableExtensions;
-import org.eclipse.xtext.xbase.lib.Functions.Function1;
-import org.eclipse.xtext.xbase.lib.Functions.Function2;
-import org.eclipse.xtext.xbase.lib.IntegerExtensions;
-import org.eclipse.xtext.xbase.lib.IterableExtensions;
-import org.eclipse.xtext.xbase.lib.ObjectExtensions;
-import org.eclipse.xtext.xbase.lib.StringExtensions;
-import org.yakindu.sct.model.sgraph.Choice;
-import org.yakindu.sct.model.sgraph.Reaction;
-import org.yakindu.sct.model.sgraph.ReactiveElement;
-import org.yakindu.sct.model.sgraph.Region;
-import org.yakindu.sct.model.sgraph.RegularState;
-import org.yakindu.sct.model.sgraph.Scope;
-import org.yakindu.sct.model.sgraph.State;
-import org.yakindu.sct.model.sgraph.Statechart;
-import org.yakindu.sct.model.sgraph.Transition;
-import org.yakindu.sct.model.sgraph.Trigger;
-import org.yakindu.sct.model.sgraph.Vertex;
-import org.yakindu.sct.model.stext.stext.LocalReaction;
-import org.yakindu.sct.model.stext.stext.TimeEventSpec;
-
-@SuppressWarnings("all")
-public class StatechartExtensions {
-  
-  public int maxOrthogonality(final Statechart sc) {
-    EList<Region> _regions = sc.getRegions();
-    final Function2<Integer,Region,Integer> _function = new Function2<Integer,Region,Integer>() {
-        public Integer apply(final Integer o , final Region r) {
-          int _maxOrthogonality = StatechartExtensions.this.maxOrthogonality(r);
-          int _operator_plus = IntegerExtensions.operator_plus(((Integer)_maxOrthogonality), o);
-          return ((Integer)_operator_plus);
-        }
-      };
-    Integer _fold = IterableExtensions.<Region, Integer>fold(_regions, ((Integer)0), _function);
-    return _fold;
-  }
-  
-  public int maxOrthogonality(final Region r) {
-    EList<Vertex> _vertices = r.getVertices();
-    final Function2<Integer,Vertex,Integer> _function = new Function2<Integer,Vertex,Integer>() {
-        public Integer apply(final Integer s , final Vertex v) {
-          int _xblockexpression = (int) 0;
-          {
-            int _maxOrthogonality = StatechartExtensions.this.maxOrthogonality(v);
-            final int mo = _maxOrthogonality;
-            int _xifexpression = (int) 0;
-            boolean _operator_greaterThan = ComparableExtensions.<Integer>operator_greaterThan(((Integer)mo), s);
-            if (_operator_greaterThan) {
-              _xifexpression = mo;
-            } else {
-              _xifexpression = s;
-            }
-            _xblockexpression = (_xifexpression);
-          }
-          return ((Integer)_xblockexpression);
-        }
-      };
-    Integer _fold = IterableExtensions.<Vertex, Integer>fold(_vertices, ((Integer)0), _function);
-    return _fold;
-  }
-  
-  protected int _maxOrthogonality(final Vertex v) {
-    return 0;
-  }
-  
-  protected int _maxOrthogonality(final State s) {
-    Integer _xifexpression = null;
-    EList<Region> _regions = s.getRegions();
-    int _size = _regions.size();
-    boolean _operator_greaterThan = ComparableExtensions.<Integer>operator_greaterThan(((Integer)_size), ((Integer)0));
-    if (_operator_greaterThan) {
-      EList<Region> _regions_1 = s.getRegions();
-      final Function2<Integer,Region,Integer> _function = new Function2<Integer,Region,Integer>() {
-          public Integer apply(final Integer o , final Region r) {
-            int _maxOrthogonality = StatechartExtensions.this.maxOrthogonality(r);
-            int _operator_plus = IntegerExtensions.operator_plus(((Integer)_maxOrthogonality), o);
-            return ((Integer)_operator_plus);
-          }
-        };
-      Integer _fold = IterableExtensions.<Region, Integer>fold(_regions_1, ((Integer)0), _function);
-      _xifexpression = _fold;
-    } else {
-      _xifexpression = 1;
-    }
-    return _xifexpression;
-  }
-  
-  public Reaction reaction(final Trigger tr) {
-    EObject _eContainer = tr.eContainer();
-    return ((Reaction) _eContainer);
-  }
-  
-  public Statechart statechart(final State state) {
-    Region _parentRegion = state.getParentRegion();
-    Statechart _statechart = this.statechart(_parentRegion);
-    return _statechart;
-  }
-  
-  public Statechart statechart(final Region region) {
-    Statechart _xifexpression = null;
-    EObject _eContainer = region.eContainer();
-    if ((_eContainer instanceof org.yakindu.sct.model.sgraph.Statechart)) {
-      EObject _eContainer_1 = region.eContainer();
-      _xifexpression = ((Statechart) _eContainer_1);
-    } else {
-      EObject _eContainer_2 = region.eContainer();
-      Statechart _statechart = this.statechart(((State) _eContainer_2));
-      _xifexpression = _statechart;
-    }
-    return _xifexpression;
-  }
-  
-  public List<TimeEventSpec> timeEventSpecs(final State state) {
-    {
-      ArrayList<TimeEventSpec> _arrayList = new ArrayList<TimeEventSpec>();
-      ArrayList<TimeEventSpec> tesList = _arrayList;
-      EList<Transition> _outgoingTransitions = state.getOutgoingTransitions();
-      final Function2<ArrayList<TimeEventSpec>,Transition,ArrayList<TimeEventSpec>> _function = new Function2<ArrayList<TimeEventSpec>,Transition,ArrayList<TimeEventSpec>>() {
-          public ArrayList<TimeEventSpec> apply(final ArrayList<TimeEventSpec> s , final Transition r) {
-            ArrayList<TimeEventSpec> _xblockexpression = null;
-            {
-              List<EObject> _eAllContentsAsList = EcoreUtil2.eAllContentsAsList(r);
-              Iterable<TimeEventSpec> _filter = IterableExtensions.<TimeEventSpec>filter(_eAllContentsAsList, org.yakindu.sct.model.stext.stext.TimeEventSpec.class);
-              final Function1<TimeEventSpec,Boolean> _function_1 = new Function1<TimeEventSpec,Boolean>() {
-                  public Boolean apply(final TimeEventSpec tes) {
-                    boolean _add = s.add(tes);
-                    return ((Boolean)_add);
-                  }
-                };
-              IterableExtensions.<TimeEventSpec>forEach(_filter, _function_1);
-              _xblockexpression = (s);
-            }
-            return _xblockexpression;
-          }
-        };
-      IterableExtensions.<Transition, ArrayList<TimeEventSpec>>fold(_outgoingTransitions, tesList, _function);
-      EList<Reaction> _localReactions = state.getLocalReactions();
-      final Function2<ArrayList<TimeEventSpec>,Reaction,ArrayList<TimeEventSpec>> _function_2 = new Function2<ArrayList<TimeEventSpec>,Reaction,ArrayList<TimeEventSpec>>() {
-          public ArrayList<TimeEventSpec> apply(final ArrayList<TimeEventSpec> s_1 , final Reaction r_1) {
-            ArrayList<TimeEventSpec> _xblockexpression_1 = null;
-            {
-              List<EObject> _eAllContentsAsList_1 = EcoreUtil2.eAllContentsAsList(r_1);
-              Iterable<TimeEventSpec> _filter_1 = IterableExtensions.<TimeEventSpec>filter(_eAllContentsAsList_1, org.yakindu.sct.model.stext.stext.TimeEventSpec.class);
-              final Function1<TimeEventSpec,Boolean> _function_3 = new Function1<TimeEventSpec,Boolean>() {
-                  public Boolean apply(final TimeEventSpec tes_1) {
-                    boolean _add_1 = s_1.add(tes_1);
-                    return ((Boolean)_add_1);
-                  }
-                };
-              IterableExtensions.<TimeEventSpec>forEach(_filter_1, _function_3);
-              _xblockexpression_1 = (s_1);
-            }
-            return _xblockexpression_1;
-          }
-        };
-      IterableExtensions.<Reaction, ArrayList<TimeEventSpec>>fold(_localReactions, tesList, _function_2);
-      return tesList;
-    }
-  }
-  
-  protected ReactiveElement _reactiveElement(final Reaction r) {
-    Scope _scope = this.scope(r);
-    ReactiveElement _reactiveElement = this.reactiveElement(_scope);
-    return _reactiveElement;
-  }
-  
-  protected ReactiveElement _reactiveElement(final Transition tr) {
-    State _xifexpression = null;
-    Vertex _source = tr.getSource();
-    if ((_source instanceof org.yakindu.sct.model.sgraph.State)) {
-      _xifexpression = ((State) tr);
-    } else {
-      _xifexpression = null;
-    }
-    return _xifexpression;
-  }
-  
-  public Scope scope(final Reaction r) {
-    Scope _xifexpression = null;
-    EObject _eContainer = r.eContainer();
-    if ((_eContainer instanceof org.yakindu.sct.model.sgraph.Scope)) {
-      EObject _eContainer_1 = r.eContainer();
-      _xifexpression = ((Scope) _eContainer_1);
-    }
-    return _xifexpression;
-  }
-  
-  public ReactiveElement reactiveElement(final Scope s) {
-    ReactiveElement _xifexpression = null;
-    EObject _eContainer = s.eContainer();
-    if ((_eContainer instanceof org.yakindu.sct.model.sgraph.ReactiveElement)) {
-      EObject _eContainer_1 = s.eContainer();
-      _xifexpression = ((ReactiveElement) _eContainer_1);
-    }
-    return _xifexpression;
-  }
-  
-  public List<RegularState> allRegularStates(final Statechart sc) {
-    {
-      List<EObject> _eAllContentsAsList = EcoreUtil2.eAllContentsAsList(sc);
-      List<EObject> content = _eAllContentsAsList;
-      Iterable<RegularState> _filter = IterableExtensions.<RegularState>filter(content, org.yakindu.sct.model.sgraph.RegularState.class);
-      final Iterable<RegularState> allStates = _filter;
-      List<RegularState> _list = IterableExtensions.<RegularState>toList(allStates);
-      return _list;
-    }
-  }
-  
-  public List<Region> allRegions(final Statechart sc) {
-    {
-      List<EObject> _eAllContentsAsList = EcoreUtil2.eAllContentsAsList(sc);
-      List<EObject> content = _eAllContentsAsList;
-      Iterable<Region> _filter = IterableExtensions.<Region>filter(content, org.yakindu.sct.model.sgraph.Region.class);
-      final Iterable<Region> allRegions = _filter;
-      List<Region> _list = IterableExtensions.<Region>toList(allRegions);
-      return _list;
-    }
-  }
-  
-  public List<Choice> allChoices(final Statechart sc) {
-    {
-      List<EObject> _eAllContentsAsList = EcoreUtil2.eAllContentsAsList(sc);
-      List<EObject> content = _eAllContentsAsList;
-      Iterable<Choice> _filter = IterableExtensions.<Choice>filter(content, org.yakindu.sct.model.sgraph.Choice.class);
-      final Iterable<Choice> allChoices = _filter;
-      List<Choice> _list = IterableExtensions.<Choice>toList(allChoices);
-      return _list;
-    }
-  }
-  
-  protected String _id(final Object obj) {
-    return null;
-  }
-  
-  protected String _id(final Transition t) {
-    Comparable<? extends Object> _xifexpression = null;
-    Vertex _source = t.getSource();
-    boolean _operator_notEquals = ObjectExtensions.operator_notEquals(_source, null);
-    if (_operator_notEquals) {
-      Vertex _source_1 = t.getSource();
-      EList<Transition> _outgoingTransitions = _source_1.getOutgoingTransitions();
-      int _indexOf = _outgoingTransitions.indexOf(t);
-      _xifexpression = _indexOf;
-    } else {
-      _xifexpression = "";
-    }
-    String _operator_plus = StringExtensions.operator_plus("tr", _xifexpression);
-    return _operator_plus;
-  }
-  
-  protected String _id(final LocalReaction t) {
-    Comparable<? extends Object> _xifexpression = null;
-    ReactiveElement _reactiveElement = this.reactiveElement(t);
-    boolean _operator_notEquals = ObjectExtensions.operator_notEquals(_reactiveElement, null);
-    if (_operator_notEquals) {
-      ReactiveElement _reactiveElement_1 = this.reactiveElement(t);
-      EList<Reaction> _localReactions = _reactiveElement_1.getLocalReactions();
-      int _indexOf = _localReactions.indexOf(t);
-      _xifexpression = _indexOf;
-    } else {
-      _xifexpression = "";
-    }
-    String _operator_plus = StringExtensions.operator_plus("lr", _xifexpression);
-    return _operator_plus;
-  }
-  
-  public int maxOrthogonality(final Vertex s) {
-    if ((s instanceof State)) {
-      return _maxOrthogonality((State)s);
-    } else if ((s instanceof Vertex)) {
-      return _maxOrthogonality((Vertex)s);
-    } else {
-      throw new IllegalArgumentException("Unhandled parameter types: " +
-        java.util.Arrays.<Object>asList(s).toString());
-    }
-  }
-  
-  public ReactiveElement reactiveElement(final Reaction tr) {
-    if ((tr instanceof Transition)) {
-      return _reactiveElement((Transition)tr);
-    } else if ((tr instanceof Reaction)) {
-      return _reactiveElement((Reaction)tr);
-    } else {
-      throw new IllegalArgumentException("Unhandled parameter types: " +
-        java.util.Arrays.<Object>asList(tr).toString());
-    }
-  }
-  
-  public String id(final Object t) {
-    if ((t instanceof LocalReaction)) {
-      return _id((LocalReaction)t);
-    } else if ((t instanceof Transition)) {
-      return _id((Transition)t);
-    } else if ((t instanceof Object)) {
-      return _id((Object)t);
-    } else {
-      throw new IllegalArgumentException("Unhandled parameter types: " +
-        java.util.Arrays.<Object>asList(t).toString());
-    }
-  }
-}

+ 46 - 0
test-plugins/org.yakindu.sct.model.sexec.test/src/org/yakindu/sct/model/sexec/transformation/test/Assert.java

@@ -11,6 +11,7 @@ import java.util.Arrays;
 import java.util.List;
 
 import org.yakindu.sct.model.sexec.Call;
+import org.yakindu.sct.model.sexec.ExecutionFlow;
 import org.yakindu.sct.model.sexec.ExecutionState;
 import org.yakindu.sct.model.sexec.Sequence;
 import org.yakindu.sct.model.sexec.StateCase;
@@ -58,7 +59,33 @@ public class Assert {
 	}
 
 
+	public static StateSwitch assertedSwitch(Step step) {
 
+		assertNotNull("Step is null", step);
+		assertTrue("Step is no StateSwitch (was " + step.getClass().getName() +") '" + stepAsString(step) + "'", step instanceof StateSwitch);
+
+		return (StateSwitch) step;
+	}
+
+
+	public static ExecutionState assertedState(ExecutionFlow flow, int idx, String id) {
+
+		assertTrue("Execution flow does not contain an state #" + idx + "!" , flow.getStates().size() > idx);
+		ExecutionState es = flow.getStates().get(idx);
+		assertEquals("wrong state id !", id, es.getName());
+
+		return es;
+	}
+
+
+
+	public static void assertSequenceSize(int size, Step seq) {
+		assertNotNull("Sequence is null", seq);
+		assertTrue("Step is no Sequence (was " + seq.getClass().getName() +")", seq instanceof Sequence);
+		assertEquals("Sequence has wrong number of steps: " + stepListAsString((Sequence)seq), size, ((Sequence)seq).getSteps().size());
+
+	}
+	
 	public static void assertStateSwitch(Step step, ExecutionState ... states ) {
 		
 		assertNotNull("Step is null", step);
@@ -75,5 +102,24 @@ public class Assert {
 	}
 
 
+	public static String stepListAsString(Sequence seq) {
+		String r = "";
+		
+		for ( Step s : seq.getSteps() ) {
+//			if (s instanceof Call) r += "call to : " + ((Call)s).getStep().getComment(); 
+//			else if (s instanceof StateSwitch) r += "switch on " + ((StateSwitch)s).getStateConfigurationIdx(); 
+//			else  r += s; 
+//			
+			r += stepAsString(s) + "; ";
+		}
+		
+		return r;
+	}
 
+	public static String stepAsString(Step step) {
+		if (step instanceof Call) return "call to : " + ((Call)step).getStep().getComment(); 
+		else if (step instanceof StateSwitch) return "switch on " + ((StateSwitch)step).getStateConfigurationIdx(); 
+		
+		return step.toString(); 
+	}
 }

+ 1 - 1
test-plugins/org.yakindu.sct.model.sexec.test/src/org/yakindu/sct/model/sexec/transformation/test/ModelSequencerHierarchyTest.java

@@ -416,7 +416,7 @@ public class ModelSequencerHierarchyTest extends ModelSequencerTest {
 		assertTrue(_t.isTransition());
 		
 		Sequence _effect = (Sequence) _t.getEffect();
-		assertEquals(2, _effect.getSteps().size());
+		assertSequenceSize(2, _effect);
 		
 		assertCall(_effect, 0, _s4.getExitSequence());
 		

+ 579 - 12
test-plugins/org.yakindu.sct.model.sexec.test/src/org/yakindu/sct/model/sexec/transformation/test/ModelSequencerOrthogonalityTest.java

@@ -122,7 +122,7 @@ public class ModelSequencerOrthogonalityTest extends ModelSequencerTest {
 		assertTrue(_t.isTransition());
 		
 		Sequence _effect = (Sequence) _t.getEffect();
-		assertEquals("wrong sequence: " + stepList(_effect), 4, _effect.getSteps().size());
+		assertEquals("wrong sequence: " + stepListAsString(_effect), 4, _effect.getSteps().size());
 		
 		assertCall(_effect, 0, _s5.getExitSequence());
 		assertCall(_effect, 1, _s2.getEnterSequence());
@@ -209,7 +209,7 @@ public class ModelSequencerOrthogonalityTest extends ModelSequencerTest {
 		assertTrue(_t.isTransition());
 		
 		Sequence _effect = (Sequence) _t.getEffect();
-		assertEquals("wrong sequence: " + stepList(_effect), 7, _effect.getSteps().size());
+		assertEquals("wrong sequence: " + stepListAsString(_effect), 7, _effect.getSteps().size());
 		
 		assertCall(_effect, 0, _s5.getExitSequence());
 		assertCall(_effect, 1, _s2.getEnterSequence());
@@ -394,7 +394,7 @@ public class ModelSequencerOrthogonalityTest extends ModelSequencerTest {
 		assertTrue(_t.isTransition());
 		
 		Sequence _effect = (Sequence) _t.getEffect();
-		assertEquals("wrong sequence: " + stepList(_effect),  5, _effect.getSteps().size());
+		assertEquals("wrong sequence: " + stepListAsString(_effect),  5, _effect.getSteps().size());
 		
 		assertCall(_effect, 0, _s3z.getExitSequence());
 		assertCall(_effect, 1, _s3.getEntryAction());
@@ -676,7 +676,7 @@ public class ModelSequencerOrthogonalityTest extends ModelSequencerTest {
 		assertTrue(_t.isTransition());
 		
 		Sequence _effect = (Sequence) _t.getEffect();
-		assertEquals("wrong steps: " + stepList(_effect), 4, _effect.getSteps().size());
+		assertEquals("wrong steps: " + stepListAsString(_effect), 4, _effect.getSteps().size());
 		
 		Step _switch =  _effect.getSteps().get(0);
 		assertStateSwitch(_switch, _s3a);
@@ -692,18 +692,585 @@ public class ModelSequencerOrthogonalityTest extends ModelSequencerTest {
 
 	}
 	
-	protected String stepList(Sequence seq) {
-		String r = "";
+	
+	/**
+	 * When exiting an orthogonal state exits must be performed in a well defined order bottom up with highest priority/order states first.
+	 */
+	@Test public void testBottomUpExitSequence_TwoLevels() {
 		
-		for ( Step s : seq.getSteps() ) {
-			if (s instanceof Call) r += "call to : " + ((Call)s).getStep().getComment(); 
-			else if (s instanceof StateSwitch) r += "switch on " + ((StateSwitch)s).getStateConfigurationIdx(); 
-			else  r += s; 
+		Statechart sc = _createStatechart("sc"); {  
 			
-			r += "; ";
+			InterfaceScope s_scope = _createInterfaceScope("Interface", sc);
+			VariableDefinition v1 = _createVariableDefinition("v1", TYPE_INTEGER, s_scope);
+
+			Region r = _createRegion("r", sc); {
+				State s = _createState("s", r); {
+					_createExitAssignment(v1, s, 42);
+
+
+					Region r2 = _createRegion("r2", s); {
+						State s2 = _createState("s2", r2); {
+							_createExitAssignment(v1, s2, 42);
+							Region r2a = _createRegion("r2a", s2); {
+								_createState("s2a1", r2a);
+								_createState("s2a2", r2a);
+							}
+							Region r2b = _createRegion("r2b", s2); {
+								_createState("s2b1", r2b);
+								_createState("s2b2", r2b);
+							}
+							Region r2c = _createRegion("r2c", s2); {
+								_createState("s2c1", r2c);
+								_createState("s2c2", r2c);
+							}
+						}
+					}
+							
+					Region r3 = _createRegion("r3", s); {
+						State s3 = _createState("s3", r3); {
+							_createExitAssignment(v1, s3, 42);
+							Region r3a = _createRegion("r3a", s3); {
+								_createState("s3a1", r3a);
+								_createState("s3a2", r3a);
+							}
+							Region r3b = _createRegion("r3b", s3); {
+								_createState("s3b1", r3b);
+								_createState("s3b2", r3b);
+							}
+						}
+					}
+
+					Region r4 = _createRegion("r4", s); {
+						State s4 = _createState("s4", r4); {
+							_createExitAssignment(v1, s4, 42);
+
+							Region r4a = _createRegion("r4a", s4); {
+								_createState("s4a1", r4a);
+								_createState("s4a2", r4a);
+							}
+							Region r4b = _createRegion("r4b", s4); {
+								_createState("s4b1", r4b);
+								_createState("s4b2", r4b);
+							}
+						}
+					}
+				}		
+			}
 		}
+			
+		ExecutionFlow flow = sequencer.transform(sc);
+		
+		ExecutionState _s = assertedState(flow, 0, "sc.r.s");		
+
+		ExecutionState _s2 = assertedState(flow, 1, "sc.r.s.r2.s2");
+		ExecutionState _s2a1 = assertedState(flow, 2, "sc.r.s.r2.s2.r2a.s2a1");
+		ExecutionState _s2a2 = assertedState(flow, 3, "sc.r.s.r2.s2.r2a.s2a2");
+		ExecutionState _s2b1 = assertedState(flow, 4, "sc.r.s.r2.s2.r2b.s2b1");
+		ExecutionState _s2b2 = assertedState(flow, 5, "sc.r.s.r2.s2.r2b.s2b2");
+		ExecutionState _s2c1 = assertedState(flow, 6, "sc.r.s.r2.s2.r2c.s2c1");
+		ExecutionState _s2c2 = assertedState(flow, 7, "sc.r.s.r2.s2.r2c.s2c2");
+		
+		ExecutionState _s3 = assertedState(flow, 8, "sc.r.s.r3.s3");
+		ExecutionState _s3a1 = assertedState(flow, 9, "sc.r.s.r3.s3.r3a.s3a1");
+		ExecutionState _s3a2 = assertedState(flow, 10, "sc.r.s.r3.s3.r3a.s3a2");
+		ExecutionState _s3b1 = assertedState(flow, 11, "sc.r.s.r3.s3.r3b.s3b1");
+		ExecutionState _s3b2 = assertedState(flow, 12, "sc.r.s.r3.s3.r3b.s3b2");
+		
+		ExecutionState _s4 = assertedState(flow, 13, "sc.r.s.r4.s4");
+		ExecutionState _s4a1 = assertedState(flow, 14, "sc.r.s.r4.s4.r4a.s4a1");
+		ExecutionState _s4a2 = assertedState(flow, 15, "sc.r.s.r4.s4.r4a.s4a2");
+		ExecutionState _s4b1 = assertedState(flow, 16, "sc.r.s.r4.s4.r4b.s4b1");
+		ExecutionState _s4b2 = assertedState(flow, 17, "sc.r.s.r4.s4.r4b.s4b2");
+		
+
+		// check the exit sequence of _s
+		Sequence _exit = _s.getExitSequence();
+		assertEquals("wrong steps: " + stepListAsString(_exit), 8, _exit.getSteps().size());
+		
+		StateSwitch _switch0 =  assertedSwitch(_exit.getSteps().get(0));
+		assertStateSwitch(_switch0, _s2a1, _s2a2);
+		assertSequenceSize(1, assertedStateCase(_switch0, _s2a1).getStep());
+		assertCall( assertedSequence(assertedStateCase(_switch0, _s2a1).getStep()), 0, _s2a1.getExitSequence());
+		assertSequenceSize(1, assertedStateCase(_switch0, _s2a2).getStep());
+		assertCall( assertedSequence(assertedStateCase(_switch0, _s2a2).getStep()), 0, _s2a2.getExitSequence());
+
+		StateSwitch _switch1 =  assertedSwitch(_exit.getSteps().get(1));
+		assertStateSwitch(_switch1, _s2b1, _s2b2);
+		assertSequenceSize(1, assertedStateCase(_switch1, _s2b1).getStep());
+		assertCall( assertedSequence(assertedStateCase(_switch1, _s2b1).getStep()), 0, _s2b1.getExitSequence());
+		assertSequenceSize(1, assertedStateCase(_switch1, _s2b2).getStep());
+		assertCall( assertedSequence(assertedStateCase(_switch1, _s2b2).getStep()), 0, _s2b2.getExitSequence());
+
+		StateSwitch _switch2 =  assertedSwitch(_exit.getSteps().get(2));
+		assertStateSwitch(_switch2, _s2c1, _s2c2);
+		assertSequenceSize(2, assertedStateCase(_switch2, _s2c1).getStep());
+		assertCall( assertedSequence(assertedStateCase(_switch2, _s2c1).getStep()), 0, _s2c1.getExitSequence());
+		assertCall( assertedSequence(assertedStateCase(_switch2, _s2c1).getStep()), 1, _s2.getExitAction());
+		assertSequenceSize(2, assertedStateCase(_switch2, _s2c2).getStep());
+		assertCall( assertedSequence(assertedStateCase(_switch2, _s2c2).getStep()), 0, _s2c2.getExitSequence());
+		assertCall( assertedSequence(assertedStateCase(_switch2, _s2c2).getStep()), 1, _s2.getExitAction());
+
+		StateSwitch _switch3 =  assertedSwitch(_exit.getSteps().get(3));
+		assertStateSwitch(_switch3, _s3a1, _s3a2);
+		assertSequenceSize(1, assertedStateCase(_switch3, _s3a1).getStep());
+		assertCall( assertedSequence(assertedStateCase(_switch3, _s3a1).getStep()), 0, _s3a1.getExitSequence());
+		assertSequenceSize(1, assertedStateCase(_switch3, _s3a2).getStep());
+		assertCall( assertedSequence(assertedStateCase(_switch3, _s3a2).getStep()), 0, _s3a2.getExitSequence());
+
+		StateSwitch _switch4 =  assertedSwitch(_exit.getSteps().get(4));
+		assertStateSwitch(_switch4, _s3b1, _s3b2);
+		assertSequenceSize(2, assertedStateCase(_switch4, _s3b1).getStep());
+		assertCall( assertedSequence(assertedStateCase(_switch4, _s3b1).getStep()), 0, _s3b1.getExitSequence());
+		assertCall( assertedSequence(assertedStateCase(_switch4, _s3b1).getStep()), 1, _s3.getExitAction());
+		assertSequenceSize(2, assertedStateCase(_switch4, _s3b2).getStep());
+		assertCall( assertedSequence(assertedStateCase(_switch4, _s3b2).getStep()), 0, _s3b2.getExitSequence());
+		assertCall( assertedSequence(assertedStateCase(_switch4, _s3b2).getStep()), 1, _s3.getExitAction());
+
+		StateSwitch _switch5 =  assertedSwitch(_exit.getSteps().get(5));
+		assertStateSwitch(_switch5, _s4a1, _s4a2);
+		assertSequenceSize(1, assertedStateCase(_switch5, _s4a1).getStep());
+		assertCall( assertedSequence(assertedStateCase(_switch5, _s4a1).getStep()), 0, _s4a1.getExitSequence());
+		assertSequenceSize(1, assertedStateCase(_switch5, _s4a2).getStep());
+		assertCall( assertedSequence(assertedStateCase(_switch5, _s4a2).getStep()), 0, _s4a2.getExitSequence());
+
+		StateSwitch _switch6 =  assertedSwitch(_exit.getSteps().get(6));
+		assertStateSwitch(_switch6, _s4b1, _s4b2);
+		assertSequenceSize(2, assertedStateCase(_switch6, _s4b1).getStep());
+		assertCall( assertedSequence(assertedStateCase(_switch6, _s4b1).getStep()), 0, _s4b1.getExitSequence());
+		assertCall( assertedSequence(assertedStateCase(_switch6, _s4b1).getStep()), 1, _s4.getExitAction());
+		assertSequenceSize(2, assertedStateCase(_switch6, _s4b1).getStep());
+		assertCall( assertedSequence(assertedStateCase(_switch6, _s4b2).getStep()), 0, _s4b2.getExitSequence());
+		assertCall( assertedSequence(assertedStateCase(_switch6, _s4b2).getStep()), 1, _s4.getExitAction());
+
+		assertCall(_exit, 7, _s.getExitAction());
+		
+	}
+	
+	
+	/**
+	 * When exiting an orthogonal state exits must be performed in a well defined order bottom up with highest priority/order states first.
+	 */
+	@Test public void testBottomUpExitSequence_ThreeLevels() {
+		
+		Statechart sc = setUpDeepExitSC();
+			
+		ExecutionFlow flow = sequencer.transform(sc);
+		
+		ExecutionState _s = assertedState(flow, 0, "sc.r.s");		
+
+		ExecutionState _s1a = assertedState(flow, 1, "sc.r.s._1.a");
+		ExecutionState _s1a1a = assertedState(flow, 2, "sc.r.s._1.a._1.a");
+		ExecutionState _s1a1a1a = assertedState(flow, 3, "sc.r.s._1.a._1.a._1.a");
+		ExecutionState _s1a1a2a = assertedState(flow, 4, "sc.r.s._1.a._1.a._2.a");
+		ExecutionState _s1a2a = assertedState(flow, 5, "sc.r.s._1.a._2.a");
+		ExecutionState _s1a2a1a = assertedState(flow, 6, "sc.r.s._1.a._2.a._1.a");
+		ExecutionState _s1a2a2a = assertedState(flow, 7, "sc.r.s._1.a._2.a._2.a");
+		
+		ExecutionState _s2a = assertedState(flow, 8, "sc.r.s._2.a");
+		ExecutionState _s2a1a = assertedState(flow, 9, "sc.r.s._2.a._1.a");
+		ExecutionState _s2a1a1a = assertedState(flow, 10, "sc.r.s._2.a._1.a._1.a");
+		ExecutionState _s2a1a2a = assertedState(flow, 11, "sc.r.s._2.a._1.a._2.a");
+		ExecutionState _s2a2a = assertedState(flow, 12, "sc.r.s._2.a._2.a");
+		ExecutionState _s2a2a1a = assertedState(flow, 13, "sc.r.s._2.a._2.a._1.a");
+		ExecutionState _s2a2a2a = assertedState(flow, 14, "sc.r.s._2.a._2.a._2.a");
+		
+		ExecutionState _b = assertedState(flow, 15, "sc.r.b");
+
+		// check the exit sequence of _s
+		Sequence _exit = _s.getExitSequence();
+		assertEquals("wrong steps: " + stepListAsString(_exit), 9, _exit.getSteps().size());
+		
+		StateSwitch _switch0 =  assertedSwitch(_exit.getSteps().get(0));
+		assertStateSwitch(_switch0, _s1a1a1a);
+		assertSequenceSize(1, assertedStateCase(_switch0, _s1a1a1a).getStep());
+		assertCall( assertedSequence(assertedStateCase(_switch0, _s1a1a1a).getStep()), 0, _s1a1a1a.getExitSequence());
+
+		StateSwitch _switch1 =  assertedSwitch(_exit.getSteps().get(1));
+		assertStateSwitch(_switch1, _s1a1a2a);
+		assertSequenceSize(2, assertedStateCase(_switch1, _s1a1a2a).getStep());
+		assertCall( assertedSequence(assertedStateCase(_switch1, _s1a1a2a).getStep()), 0, _s1a1a2a.getExitSequence());
+		assertCall( assertedSequence(assertedStateCase(_switch1, _s1a1a2a).getStep()), 1, _s1a1a.getExitAction());
+
+		StateSwitch _switch2 =  assertedSwitch(_exit.getSteps().get(2));
+		assertStateSwitch(_switch2, _s1a2a1a);
+		assertSequenceSize(1, assertedStateCase(_switch2, _s1a2a1a).getStep());
+		assertCall( assertedSequence(assertedStateCase(_switch2, _s1a2a1a).getStep()), 0, _s1a2a1a.getExitSequence());
+
+		StateSwitch _switch3 =  assertedSwitch(_exit.getSteps().get(3));
+		assertStateSwitch(_switch3, _s1a2a2a);
+		assertSequenceSize(3, assertedStateCase(_switch3, _s1a2a2a).getStep());
+		assertCall( assertedSequence(assertedStateCase(_switch3, _s1a2a2a).getStep()), 0, _s1a2a2a.getExitSequence());
+		assertCall( assertedSequence(assertedStateCase(_switch3, _s1a2a2a).getStep()), 1, _s1a2a.getExitAction());
+		assertCall( assertedSequence(assertedStateCase(_switch3, _s1a2a2a).getStep()), 2, _s1a.getExitAction());
+
+		StateSwitch _switch4 =  assertedSwitch(_exit.getSteps().get(4));
+		assertStateSwitch(_switch4, _s2a1a1a);
+		assertSequenceSize(1, assertedStateCase(_switch4, _s2a1a1a).getStep());
+		assertCall( assertedSequence(assertedStateCase(_switch4, _s2a1a1a).getStep()), 0, _s2a1a1a.getExitSequence());
+
+		StateSwitch _switch5 =  assertedSwitch(_exit.getSteps().get(5));
+		assertStateSwitch(_switch5, _s2a1a2a);
+		assertSequenceSize(2, assertedStateCase(_switch5, _s2a1a2a).getStep());
+		assertCall( assertedSequence(assertedStateCase(_switch5, _s2a1a2a).getStep()), 0, _s2a1a2a.getExitSequence());
+		assertCall( assertedSequence(assertedStateCase(_switch5, _s2a1a2a).getStep()), 1, _s2a1a.getExitAction());
+
+		StateSwitch _switch6 =  assertedSwitch(_exit.getSteps().get(6));
+		assertStateSwitch(_switch6, _s2a2a1a);
+		assertSequenceSize(1, assertedStateCase(_switch6, _s2a2a1a).getStep());
+		assertCall( assertedSequence(assertedStateCase(_switch6, _s2a2a1a).getStep()), 0, _s2a2a1a.getExitSequence());
+
+		StateSwitch _switch7 =  assertedSwitch(_exit.getSteps().get(7));
+		assertStateSwitch(_switch7, _s2a2a2a);
+		assertSequenceSize(3, assertedStateCase(_switch7, _s2a2a2a).getStep());
+		assertCall( assertedSequence(assertedStateCase(_switch7, _s2a2a2a).getStep()), 0, _s2a2a2a.getExitSequence());
+		assertCall( assertedSequence(assertedStateCase(_switch7, _s2a2a2a).getStep()), 1, _s2a2a.getExitAction());
+		assertCall( assertedSequence(assertedStateCase(_switch7, _s2a2a2a).getStep()), 2, _s2a.getExitAction());
+
+		assertCall(_exit, 8, _s.getExitAction());
+		
+	}
+
+	/**
+	 * A transition that exits from a deep orthogonal state structure should not contain multiple calls to exit actions
+	 */
+	@Test public void testBottomUpTransitionExitSequence_A() {
+		
+		Statechart sc = setUpDeepExitSC();
+			
+		_createTransition(findStateFullyQualified(sc, "sc.r.s.1.a.1.a.2.a"), findStateFullyQualified(sc, "sc.r.b"));
+		ExecutionFlow flow = sequencer.transform(sc);
+		
+		ExecutionState _s = assertedState(flow, 0, "sc.r.s");		
+
+		ExecutionState _s1a = assertedState(flow, 1, "sc.r.s._1.a");
+		ExecutionState _s1a1a = assertedState(flow, 2, "sc.r.s._1.a._1.a");
+		ExecutionState _s1a1a1a = assertedState(flow, 3, "sc.r.s._1.a._1.a._1.a");
+		ExecutionState _s1a1a2a = assertedState(flow, 4, "sc.r.s._1.a._1.a._2.a");
+		ExecutionState _s1a2a = assertedState(flow, 5, "sc.r.s._1.a._2.a");
+		ExecutionState _s1a2a1a = assertedState(flow, 6, "sc.r.s._1.a._2.a._1.a");
+		ExecutionState _s1a2a2a = assertedState(flow, 7, "sc.r.s._1.a._2.a._2.a");
+		
+		ExecutionState _s2a = assertedState(flow, 8, "sc.r.s._2.a");
+		ExecutionState _s2a1a = assertedState(flow, 9, "sc.r.s._2.a._1.a");
+		ExecutionState _s2a1a1a = assertedState(flow, 10, "sc.r.s._2.a._1.a._1.a");
+		ExecutionState _s2a1a2a = assertedState(flow, 11, "sc.r.s._2.a._1.a._2.a");
+		ExecutionState _s2a2a = assertedState(flow, 12, "sc.r.s._2.a._2.a");
+		ExecutionState _s2a2a1a = assertedState(flow, 13, "sc.r.s._2.a._2.a._1.a");
+		ExecutionState _s2a2a2a = assertedState(flow, 14, "sc.r.s._2.a._2.a._2.a");
+		
+		ExecutionState _b = assertedState(flow, 15, "sc.r.b");
+
+		// check the transition reaction ...
+		Reaction _t = _s1a1a2a.getReactions().get(0);
+		assertTrue(_t.isTransition());
+
+		// check the exit sequence of _s
+		Sequence _exit = assertedSequence(_t.getEffect());
+		assertEquals("wrong steps: " + stepListAsString(_exit), 11, _exit.getSteps().size());
+		
+		StateSwitch _switch0 =  assertedSwitch(_exit.getSteps().get(0));
+		assertStateSwitch(_switch0, _s1a1a1a);
+		assertSequenceSize(1, assertedStateCase(_switch0, _s1a1a1a).getStep());
+		assertCall( assertedSequence(assertedStateCase(_switch0, _s1a1a1a).getStep()), 0, _s1a1a1a.getExitSequence());
+
+		assertCall(_exit, 1, _s1a1a2a.getExitSequence());
+		assertCall(_exit, 2, _s1a1a.getExitAction());
+
+		StateSwitch _switch2 =  assertedSwitch(_exit.getSteps().get(3));
+		assertStateSwitch(_switch2, _s1a2a1a);
+		assertSequenceSize(1, assertedStateCase(_switch2, _s1a2a1a).getStep());
+		assertCall( assertedSequence(assertedStateCase(_switch2, _s1a2a1a).getStep()), 0, _s1a2a1a.getExitSequence());
+
+		StateSwitch _switch3 =  assertedSwitch(_exit.getSteps().get(4));
+		assertStateSwitch(_switch3, _s1a2a2a);
+		assertSequenceSize(3, assertedStateCase(_switch3, _s1a2a2a).getStep());
+		assertCall( assertedSequence(assertedStateCase(_switch3, _s1a2a2a).getStep()), 0, _s1a2a2a.getExitSequence());
+		assertCall( assertedSequence(assertedStateCase(_switch3, _s1a2a2a).getStep()), 1, _s1a2a.getExitAction());
+		assertCall( assertedSequence(assertedStateCase(_switch3, _s1a2a2a).getStep()), 2, _s1a.getExitAction());
+
+		StateSwitch _switch4 =  assertedSwitch(_exit.getSteps().get(5));
+		assertStateSwitch(_switch4, _s2a1a1a);
+		assertSequenceSize(1, assertedStateCase(_switch4, _s2a1a1a).getStep());
+		assertCall( assertedSequence(assertedStateCase(_switch4, _s2a1a1a).getStep()), 0, _s2a1a1a.getExitSequence());
+
+		StateSwitch _switch5 =  assertedSwitch(_exit.getSteps().get(6));
+		assertStateSwitch(_switch5, _s2a1a2a);
+		assertSequenceSize(2, assertedStateCase(_switch5, _s2a1a2a).getStep());
+		assertCall( assertedSequence(assertedStateCase(_switch5, _s2a1a2a).getStep()), 0, _s2a1a2a.getExitSequence());
+		assertCall( assertedSequence(assertedStateCase(_switch5, _s2a1a2a).getStep()), 1, _s2a1a.getExitAction());
+
+		StateSwitch _switch6 =  assertedSwitch(_exit.getSteps().get(7));
+		assertStateSwitch(_switch6, _s2a2a1a);
+		assertSequenceSize(1, assertedStateCase(_switch6, _s2a2a1a).getStep());
+		assertCall( assertedSequence(assertedStateCase(_switch6, _s2a2a1a).getStep()), 0, _s2a2a1a.getExitSequence());
+
+		StateSwitch _switch7 =  assertedSwitch(_exit.getSteps().get(8));
+		assertStateSwitch(_switch7, _s2a2a2a);
+		assertSequenceSize(3, assertedStateCase(_switch7, _s2a2a2a).getStep());
+		assertCall( assertedSequence(assertedStateCase(_switch7, _s2a2a2a).getStep()), 0, _s2a2a2a.getExitSequence());
+		assertCall( assertedSequence(assertedStateCase(_switch7, _s2a2a2a).getStep()), 1, _s2a2a.getExitAction());
+		assertCall( assertedSequence(assertedStateCase(_switch7, _s2a2a2a).getStep()), 2, _s2a.getExitAction());
+
+		assertCall(_exit, 9, _s.getExitAction());
+		assertCall(_exit, 10, _b.getEnterSequence());
 		
-		return r;
 	}
 
+
+	/**
+	 * A transition that exits from a deep orthogonal state structure should not contain multiple calls to exit actions
+	 */
+	@Test public void testBottomUpTransitionExitSequence_B() {
+		
+		Statechart sc = setUpDeepExitSC();
+			
+		_createTransition(findStateFullyQualified(sc, "sc.r.s.2.a.2.a.2.a"), findStateFullyQualified(sc, "sc.r.b"));
+		ExecutionFlow flow = sequencer.transform(sc);
+		
+		ExecutionState _s = assertedState(flow, 0, "sc.r.s");		
+
+		ExecutionState _s1a = assertedState(flow, 1, "sc.r.s._1.a");
+		ExecutionState _s1a1a = assertedState(flow, 2, "sc.r.s._1.a._1.a");
+		ExecutionState _s1a1a1a = assertedState(flow, 3, "sc.r.s._1.a._1.a._1.a");
+		ExecutionState _s1a1a2a = assertedState(flow, 4, "sc.r.s._1.a._1.a._2.a");
+		ExecutionState _s1a2a = assertedState(flow, 5, "sc.r.s._1.a._2.a");
+		ExecutionState _s1a2a1a = assertedState(flow, 6, "sc.r.s._1.a._2.a._1.a");
+		ExecutionState _s1a2a2a = assertedState(flow, 7, "sc.r.s._1.a._2.a._2.a");
+		
+		ExecutionState _s2a = assertedState(flow, 8, "sc.r.s._2.a");
+		ExecutionState _s2a1a = assertedState(flow, 9, "sc.r.s._2.a._1.a");
+		ExecutionState _s2a1a1a = assertedState(flow, 10, "sc.r.s._2.a._1.a._1.a");
+		ExecutionState _s2a1a2a = assertedState(flow, 11, "sc.r.s._2.a._1.a._2.a");
+		ExecutionState _s2a2a = assertedState(flow, 12, "sc.r.s._2.a._2.a");
+		ExecutionState _s2a2a1a = assertedState(flow, 13, "sc.r.s._2.a._2.a._1.a");
+		ExecutionState _s2a2a2a = assertedState(flow, 14, "sc.r.s._2.a._2.a._2.a");
+		
+		ExecutionState _b = assertedState(flow, 15, "sc.r.b");
+
+		// check the transition reaction ...
+		Reaction _t = _s2a2a2a.getReactions().get(0);
+		assertTrue(_t.isTransition());
+
+		// check the exit sequence of _s
+		Sequence _exit = assertedSequence(_t.getEffect());
+		assertEquals("wrong steps: " + stepListAsString(_exit), 12, _exit.getSteps().size());
+		
+		StateSwitch _switch0 =  assertedSwitch(_exit.getSteps().get(0));
+		assertStateSwitch(_switch0, _s1a1a1a);
+		assertSequenceSize(1, assertedStateCase(_switch0, _s1a1a1a).getStep());
+		assertCall( assertedSequence(assertedStateCase(_switch0, _s1a1a1a).getStep()), 0, _s1a1a1a.getExitSequence());
+
+		StateSwitch _switch1 =  assertedSwitch(_exit.getSteps().get(1));
+		assertStateSwitch(_switch1, _s1a1a2a);
+		assertSequenceSize(2, assertedStateCase(_switch1, _s1a1a2a).getStep());
+		assertCall( assertedSequence(assertedStateCase(_switch1, _s1a1a2a).getStep()), 0, _s1a1a2a.getExitSequence());
+		assertCall( assertedSequence(assertedStateCase(_switch1, _s1a1a2a).getStep()), 1, _s1a1a.getExitAction());
+
+		StateSwitch _switch2 =  assertedSwitch(_exit.getSteps().get(2));
+		assertStateSwitch(_switch2, _s1a2a1a);
+		assertSequenceSize(1, assertedStateCase(_switch2, _s1a2a1a).getStep());
+		assertCall( assertedSequence(assertedStateCase(_switch2, _s1a2a1a).getStep()), 0, _s1a2a1a.getExitSequence());
+
+		StateSwitch _switch3 =  assertedSwitch(_exit.getSteps().get(3));
+		assertStateSwitch(_switch3, _s1a2a2a);
+		assertSequenceSize(3, assertedStateCase(_switch3, _s1a2a2a).getStep());
+		assertCall( assertedSequence(assertedStateCase(_switch3, _s1a2a2a).getStep()), 0, _s1a2a2a.getExitSequence());
+		assertCall( assertedSequence(assertedStateCase(_switch3, _s1a2a2a).getStep()), 1, _s1a2a.getExitAction());
+		assertCall( assertedSequence(assertedStateCase(_switch3, _s1a2a2a).getStep()), 2, _s1a.getExitAction());
+
+		StateSwitch _switch4 =  assertedSwitch(_exit.getSteps().get(4));
+		assertStateSwitch(_switch4, _s2a1a1a);
+		assertSequenceSize(1, assertedStateCase(_switch4, _s2a1a1a).getStep());
+		assertCall( assertedSequence(assertedStateCase(_switch4, _s2a1a1a).getStep()), 0, _s2a1a1a.getExitSequence());
+
+		StateSwitch _switch5 =  assertedSwitch(_exit.getSteps().get(5));
+		assertStateSwitch(_switch5, _s2a1a2a);
+		assertSequenceSize(2, assertedStateCase(_switch5, _s2a1a2a).getStep());
+		assertCall( assertedSequence(assertedStateCase(_switch5, _s2a1a2a).getStep()), 0, _s2a1a2a.getExitSequence());
+		assertCall( assertedSequence(assertedStateCase(_switch5, _s2a1a2a).getStep()), 1, _s2a1a.getExitAction());
+
+		StateSwitch _switch6 =  assertedSwitch(_exit.getSteps().get(6));
+		assertStateSwitch(_switch6, _s2a2a1a);
+		assertSequenceSize(1, assertedStateCase(_switch6, _s2a2a1a).getStep());
+		assertCall( assertedSequence(assertedStateCase(_switch6, _s2a2a1a).getStep()), 0, _s2a2a1a.getExitSequence());
+
+		assertCall(_exit, 7, _s2a2a2a.getExitSequence());
+		assertCall(_exit, 8, _s2a2a.getExitAction());
+		assertCall(_exit, 9, _s2a.getExitAction());
+		assertCall(_exit, 10, _s.getExitAction());
+
+		assertCall(_exit, 11, _b.getEnterSequence());
+		
+	}
+
+
+	/**
+	 * A transition that exits from a deep orthogonal state structure should not contain multiple calls to exit actions
+	 */
+	@Test public void testBottomUpTransitionExitSequence_C() {
+		
+		Statechart sc = setUpDeepExitSC();
+			
+		_createTransition(findStateFullyQualified(sc, "sc.r.s.1.a.2.a"), findStateFullyQualified(sc, "sc.r.b"));
+		ExecutionFlow flow = sequencer.transform(sc);
+		
+		ExecutionState _s = assertedState(flow, 0, "sc.r.s");		
+
+		ExecutionState _s1a = assertedState(flow, 1, "sc.r.s._1.a");
+		ExecutionState _s1a1a = assertedState(flow, 2, "sc.r.s._1.a._1.a");
+		ExecutionState _s1a1a1a = assertedState(flow, 3, "sc.r.s._1.a._1.a._1.a");
+		ExecutionState _s1a1a2a = assertedState(flow, 4, "sc.r.s._1.a._1.a._2.a");
+		ExecutionState _s1a2a = assertedState(flow, 5, "sc.r.s._1.a._2.a");
+		ExecutionState _s1a2a1a = assertedState(flow, 6, "sc.r.s._1.a._2.a._1.a");
+		ExecutionState _s1a2a2a = assertedState(flow, 7, "sc.r.s._1.a._2.a._2.a");
+		
+		ExecutionState _s2a = assertedState(flow, 8, "sc.r.s._2.a");
+		ExecutionState _s2a1a = assertedState(flow, 9, "sc.r.s._2.a._1.a");
+		ExecutionState _s2a1a1a = assertedState(flow, 10, "sc.r.s._2.a._1.a._1.a");
+		ExecutionState _s2a1a2a = assertedState(flow, 11, "sc.r.s._2.a._1.a._2.a");
+		ExecutionState _s2a2a = assertedState(flow, 12, "sc.r.s._2.a._2.a");
+		ExecutionState _s2a2a1a = assertedState(flow, 13, "sc.r.s._2.a._2.a._1.a");
+		ExecutionState _s2a2a2a = assertedState(flow, 14, "sc.r.s._2.a._2.a._2.a");
+		
+		ExecutionState _b = assertedState(flow, 15, "sc.r.b");
+
+		// check the transition reaction ...
+		Reaction _t = _s1a2a.getReactions().get(0);
+		assertTrue(_t.isTransition());
+
+		// check the exit sequence of _s
+		Sequence _exit = assertedSequence(_t.getEffect());
+		assertEquals("wrong steps: " + stepListAsString(_exit), 10, _exit.getSteps().size());
+		
+		StateSwitch _switch0 =  assertedSwitch(_exit.getSteps().get(0));
+		assertStateSwitch(_switch0, _s1a1a1a);
+		assertSequenceSize(1, assertedStateCase(_switch0, _s1a1a1a).getStep());
+		assertCall( assertedSequence(assertedStateCase(_switch0, _s1a1a1a).getStep()), 0, _s1a1a1a.getExitSequence());
+
+		StateSwitch _switch1 =  assertedSwitch(_exit.getSteps().get(1));
+		assertStateSwitch(_switch1, _s1a1a2a);
+		assertSequenceSize(2, assertedStateCase(_switch1, _s1a1a2a).getStep());
+		assertCall( assertedSequence(assertedStateCase(_switch1, _s1a1a2a).getStep()), 0, _s1a1a2a.getExitSequence());
+		assertCall( assertedSequence(assertedStateCase(_switch1, _s1a1a2a).getStep()), 1, _s1a1a.getExitAction());
+
+		assertCall(_exit, 2, _s1a2a.getExitSequence());
+		assertCall(_exit, 3, _s1a.getExitAction());
+
+//		StateSwitch _switch2 =  assertedSwitch(_exit.getSteps().get(2));
+//		assertStateSwitch(_switch2, _s1a2a1a);
+//		assertSequenceSize(1, assertedStateCase(_switch2, _s1a2a1a).getStep());
+//		assertCall( assertedSequence(assertedStateCase(_switch2, _s1a2a1a).getStep()), 0, _s1a2a1a.getExitSequence());
+//
+//		StateSwitch _switch3 =  assertedSwitch(_exit.getSteps().get(3));
+//		assertStateSwitch(_switch3, _s1a2a2a);
+//		assertSequenceSize(3, assertedStateCase(_switch3, _s1a2a2a).getStep());
+//		assertCall( assertedSequence(assertedStateCase(_switch3, _s1a2a2a).getStep()), 0, _s1a2a2a.getExitSequence());
+//		assertCall( assertedSequence(assertedStateCase(_switch3, _s1a2a2a).getStep()), 1, _s1a2a.getExitAction());
+//		assertCall( assertedSequence(assertedStateCase(_switch3, _s1a2a2a).getStep()), 2, _s1a.getExitAction());
+
+		StateSwitch _switch4 =  assertedSwitch(_exit.getSteps().get(4));
+		assertStateSwitch(_switch4, _s2a1a1a);
+		assertSequenceSize(1, assertedStateCase(_switch4, _s2a1a1a).getStep());
+		assertCall( assertedSequence(assertedStateCase(_switch4, _s2a1a1a).getStep()), 0, _s2a1a1a.getExitSequence());
+
+		StateSwitch _switch5 =  assertedSwitch(_exit.getSteps().get(5));
+		assertStateSwitch(_switch5, _s2a1a2a);
+		assertSequenceSize(2, assertedStateCase(_switch5, _s2a1a2a).getStep());
+		assertCall( assertedSequence(assertedStateCase(_switch5, _s2a1a2a).getStep()), 0, _s2a1a2a.getExitSequence());
+		assertCall( assertedSequence(assertedStateCase(_switch5, _s2a1a2a).getStep()), 1, _s2a1a.getExitAction());
+
+		StateSwitch _switch6 =  assertedSwitch(_exit.getSteps().get(6));
+		assertStateSwitch(_switch6, _s2a2a1a);
+		assertSequenceSize(1, assertedStateCase(_switch6, _s2a2a1a).getStep());
+		assertCall( assertedSequence(assertedStateCase(_switch6, _s2a2a1a).getStep()), 0, _s2a2a1a.getExitSequence());
+
+		StateSwitch _switch7 =  assertedSwitch(_exit.getSteps().get(7));
+		assertStateSwitch(_switch7, _s2a2a2a);
+		assertSequenceSize(3, assertedStateCase(_switch7, _s2a2a2a).getStep());
+		assertCall( assertedSequence(assertedStateCase(_switch7, _s2a2a2a).getStep()), 0, _s2a2a2a.getExitSequence());
+		assertCall( assertedSequence(assertedStateCase(_switch7, _s2a2a2a).getStep()), 1, _s2a2a.getExitAction());
+		assertCall( assertedSequence(assertedStateCase(_switch7, _s2a2a2a).getStep()), 2, _s2a.getExitAction());
+
+		assertCall(_exit, 8, _s.getExitAction());
+		assertCall(_exit, 9, _b.getEnterSequence());
+		
+	}
+
+
+	private Statechart setUpDeepExitSC() {
+		Statechart sc = _createStatechart("sc"); {  
+			
+			InterfaceScope s_scope = _createInterfaceScope("Interface", sc);
+			VariableDefinition v1 = _createVariableDefinition("v1", TYPE_INTEGER, s_scope);
+
+			Region r = _createRegion("r", sc); {
+				State s = _createState("s", r); {
+					_createExitAssignment(v1, s, 42);
+
+
+					Region r1 = _createRegion("1", s); {
+						State a = _createState("a", r1); {
+							_createExitAssignment(v1, a, 42);
+							Region a1 = _createRegion("1", a); {
+								State a1a = _createState("a", a1); {
+									_createExitAssignment(v1, a1a, 42);
+									Region a11 = _createRegion("1", a1a); {
+										_createState("a", a11);
+									}
+									Region a21 = _createRegion("2", a1a); {
+										_createState("a", a21);
+									}
+								}
+							}
+							Region a2 = _createRegion("2", a); {
+								State a2a = _createState("a", a2); {
+									_createExitAssignment(v1, a2a, 42);
+									Region a11 = _createRegion("1", a2a); {
+										_createState("a", a11);
+									}
+									Region a21 = _createRegion("2", a2a); {
+										_createState("a", a21);
+									}
+								}
+							}
+						}
+					}
+							
+					Region r2 = _createRegion("2", s); {
+						State a = _createState("a", r2); {
+							_createExitAssignment(v1, a, 42);
+							Region a1 = _createRegion("1", a); {
+								State a1a = _createState("a", a1); {
+									_createExitAssignment(v1, a1a, 42);
+									Region a11 = _createRegion("1", a1a); {
+										_createState("a", a11);
+									}
+									Region a21 = _createRegion("2", a1a); {
+										_createState("a", a21);
+									}
+								}
+							}
+							Region a2 = _createRegion("2", a); {
+								State a2a = _createState("a", a2); {
+									_createExitAssignment(v1, a2a, 42);
+									Region a11 = _createRegion("1", a2a); {
+										_createState("a", a11);
+									}
+									Region a21 = _createRegion("2", a2a); {
+										_createState("a", a21);
+									}
+								}
+							}
+						}
+					}
+				}		
+				
+				State b = _createState("b", r);
+			}
+		}
+		return sc;
+	}
+		
+	
+
 }

+ 26 - 6
test-plugins/org.yakindu.sct.model.sexec.test/src/org/yakindu/sct/model/sexec/transformation/test/SCTTestUtil.java

@@ -247,12 +247,6 @@ public class SCTTestUtil {
 		return assignment;
 	}
 	
-//	public static PrimitiveValueExpression _createValue(String s) {
-//		PrimitiveValueExpression assignment = StextFactory.eINSTANCE.createPrimitiveValueExpression();
-//		assignment.setValue(s);
-//		return assignment;
-//	}
-//	
 
 	public static PrimitiveValueExpression _createValue(int i) {
 		PrimitiveValueExpression assignment = StextFactory.eINSTANCE.createPrimitiveValueExpression();
@@ -283,6 +277,32 @@ public class SCTTestUtil {
 		return (states.size() > 0) ? (State) states.iterator().next() : null;
 	}
 	
+	public static State findStateFullyQualified(Statechart sc, final String name) {
+
+		Collection<EObject> states = Collections2.filter(EcoreUtil2.eAllContentsAsList(sc), new Predicate<Object>() {
+
+			public boolean apply(Object obj) {
+				// TODO Auto-generated method stub
+				return obj != null && obj instanceof State && name.equals(fqn((State)obj));
+			}
+		});
+		
+		return (states.size() > 0) ? (State) states.iterator().next() : null;
+	}
+	
+	
+	public static final String fqn(State state) {
+		return fqn(state.getParentRegion()) + "." + state.getName();
+	}
+
+	public static final String fqn(Region region) {
+		if (region.getComposite() instanceof State) 
+			return fqn((State)region.getComposite()) + "." + region.getName();
+		
+		return ((Statechart)region.getComposite()).getName() + "." + region.getName();
+
+	}
+
 	
 	public static class MinimalTSC {