Sfoglia il codice sorgente

removed bug regarding exit and entry action handling

terfloth@itemis.de 14 anni fa
parent
commit
0800ed5774

+ 24 - 6
plugins/org.yakindu.sct.model.sexec/src/org/yakindu/sct/model/sexec/transformation/ModelSequencer.xtend

@@ -49,6 +49,9 @@ import org.yakindu.sct.model.sgraph.Variable
 import org.yakindu.sct.model.stext.stext.LocalReaction
 import org.yakindu.sct.model.stext.stext.EntryEvent
 import org.yakindu.sct.model.stext.stext.ExitEvent
+import org.eclipse.xtext.common.services.Ecore2XtextTerminalConverters
+import org.eclipse.emf.ecore.util.EcoreUtil$AbstractFilteredSettingsIterator
+import java.util.ArrayList
 
 class ModelSequencer {
 	
@@ -327,7 +330,14 @@ class ModelSequencer {
 	
 	
 	def defineEnterSequence(ExecutionFlow flow, Statechart sc) {
-		val enterSteps = sc.regions.map(r | r.entry.target?.newEnterStateStep).filter(e | e != null)
+		val enterSteps = new ArrayList<Step>()
+		
+		for ( r : sc.regions) {
+			val step = r.entry?.target?.newEnterStateStep
+			if (step != null) enterSteps.add(step);
+		} 
+		
+		// sc.regions.map(r | r.entry?.target?.newEnterStateStep).filter(e | e != null)
 		val enterSequence = sexecFactory.createSequence
 		enterSequence.name = "enter"
 		enterSteps.forEach(e | enterSequence.steps.add(e));
@@ -396,20 +406,28 @@ class ModelSequencer {
 	
 	
 	def target(Entry entry) {
-		entry?.outgoingTransitions?.get(0)?.target as State
+		if ( entry?.outgoingTransitions != null) {
+			if (entry.outgoingTransitions.size > 0) entry.outgoingTransitions.get(0).target as State
+		}
+	}
+
+	/**
+	 * Returns a list of all local reactions defined for a state. This includes also entry and exit actions but excludes 
+	 * local reactions of child states.
+	 */
+	def List<LocalReaction> localReactions(State state)	{
+		state.scopes.get(0).declarations.filter(typeof(LocalReaction)).toList
 	}
 	
 	def List<LocalReaction> entryReactions(State state) {
-		var localReactions = EcoreUtil2::eAllContentsAsList(state).filter(e | e instanceof LocalReaction)
-		localReactions
+		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) {
-			var localReactions = EcoreUtil2::eAllContentsAsList(state).filter(e | e instanceof LocalReaction)
-		localReactions
+		state.localReactions()
 			.filter(r | ((r as LocalReaction).trigger as ReactionTrigger).triggers.exists( t | t instanceof ExitEvent))
 			.map(lr | lr as LocalReaction)
 			.toList	

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

@@ -1,232 +0,0 @@
-package org.yakindu.sct.model.sexec.transformation;
-
-import com.google.inject.Inject;
-import java.util.ArrayList;
-import java.util.HashMap;
-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.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.ExecutionState;
-import org.yakindu.sct.model.sexec.SexecFactory;
-import org.yakindu.sct.model.sexec.Step;
-import org.yakindu.sct.model.sexec.transformation.StatechartExtensions;
-import org.yakindu.sct.model.sgraph.Reaction;
-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.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.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 State 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);
-    }
-    {
-      String _name = state.getName();
-      r.setSimpleName(_name);
-      QualifiedName _fullyQualifiedName = this.qfnProvider.getFullyQualifiedName(state);
-      String _string = _fullyQualifiedName.toString();
-      String _replaceAll = _string.replaceAll(" ", "");
-      r.setName(_replaceAll);
-    }
-    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_6 = 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_6) {
-      if (_createCache_create_6.containsKey(_cacheKey)) {
-        return _createCache_create_6.get(_cacheKey);
-      }
-      SexecFactory _sexecFactory = this.sexecFactory();
-      org.yakindu.sct.model.sexec.Reaction _createReaction = _sexecFactory.createReaction();
-      r = _createReaction;
-      _createCache_create_6.put(_cacheKey, r);
-    }
-    String _id = this.sce.id(tr);
-    r.setName(_id);
-    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 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 - 968
plugins/org.yakindu.sct.model.sexec/xtend-gen/org/yakindu/sct/model/sexec/transformation/ModelSequencer.java

@@ -1,968 +0,0 @@
-package org.yakindu.sct.model.sexec.transformation;
-
-import com.google.inject.Inject;
-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.EcoreUtil2;
-import org.eclipse.xtext.naming.IQualifiedNameProvider;
-import org.eclipse.xtext.xbase.lib.BooleanExtensions;
-import org.eclipse.xtext.xbase.lib.CollectionExtensions;
-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.IterableExtensions;
-import org.eclipse.xtext.xbase.lib.ListExtensions;
-import org.eclipse.xtext.xbase.lib.ObjectExtensions;
-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.Cycle;
-import org.yakindu.sct.model.sexec.EnterState;
-import org.yakindu.sct.model.sexec.Execution;
-import org.yakindu.sct.model.sexec.ExecutionFlow;
-import org.yakindu.sct.model.sexec.ExecutionState;
-import org.yakindu.sct.model.sexec.ExitState;
-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.StateVector;
-import org.yakindu.sct.model.sexec.Step;
-import org.yakindu.sct.model.sexec.transformation.FactoryExtension;
-import org.yakindu.sct.model.sexec.transformation.StatechartExtensions;
-import org.yakindu.sct.model.sgraph.Declaration;
-import org.yakindu.sct.model.sgraph.Effect;
-import org.yakindu.sct.model.sgraph.Entry;
-import org.yakindu.sct.model.sgraph.Event;
-import org.yakindu.sct.model.sgraph.Region;
-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.Statement;
-import org.yakindu.sct.model.sgraph.Transition;
-import org.yakindu.sct.model.sgraph.Trigger;
-import org.yakindu.sct.model.sgraph.Variable;
-import org.yakindu.sct.model.sgraph.Vertex;
-import org.yakindu.sct.model.stext.stext.Assignment;
-import org.yakindu.sct.model.stext.stext.ElementReferenceExpression;
-import org.yakindu.sct.model.stext.stext.EventDefinition;
-import org.yakindu.sct.model.stext.stext.EventSpec;
-import org.yakindu.sct.model.stext.stext.Expression;
-import org.yakindu.sct.model.stext.stext.LocalReaction;
-import org.yakindu.sct.model.stext.stext.LogicalOrExpression;
-import org.yakindu.sct.model.stext.stext.ReactionEffect;
-import org.yakindu.sct.model.stext.stext.ReactionTrigger;
-import org.yakindu.sct.model.stext.stext.RegularEventSpec;
-import org.yakindu.sct.model.stext.stext.StextFactory;
-import org.yakindu.sct.model.stext.stext.VariableDefinition;
-
-@SuppressWarnings("all")
-public class ModelSequencer {
-  
-  @Inject
-  private IQualifiedNameProvider qfnProvider;
-  
-  @Inject
-  private FactoryExtension factory;
-  
-  @Inject
-  private StatechartExtensions sct;
-  
-  public ExecutionFlow transform(final Statechart sc) {
-    {
-      ExecutionFlow _create = this.factory.create(sc);
-      final ExecutionFlow ef = _create;
-      this.mapScopes(sc, ef);
-      this.mapStates(sc, ef);
-      this.mapTransitions(sc, ef);
-      this.defineStateVector(ef, sc);
-      this.defineEnterSequence(ef, sc);
-      this.defineStateCycles(ef, sc);
-      this.retargetDeclRefs(ef);
-      return ef;
-    }
-  }
-  
-  public ExecutionFlow mapScopes(final Statechart sc, final ExecutionFlow flow) {
-    ExecutionFlow _xblockexpression = null;
-    {
-      EList<Scope> _scopes = flow.getScopes();
-      EList<Scope> _scopes_1 = sc.getScopes();
-      final Function1<Scope,Scope> _function = new Function1<Scope,Scope>() {
-          public Scope apply(final Scope scope) {
-            Scope _map = ModelSequencer.this.map(scope);
-            return _map;
-          }
-        };
-      List<Scope> _map_1 = ListExtensions.<Scope, Scope>map(_scopes_1, _function);
-      _scopes.addAll(_map_1);
-      _xblockexpression = (flow);
-    }
-    return _xblockexpression;
-  }
-  
-  public Scope map(final Scope scope) {
-    {
-      Scope _create = this.factory.create(scope);
-      final Scope _scope = _create;
-      EList<Declaration> _declarations = _scope.getDeclarations();
-      EList<Declaration> _declarations_1 = scope.getDeclarations();
-      final Function1<Declaration,Declaration> _function = new Function1<Declaration,Declaration>() {
-          public Declaration apply(final Declaration decl) {
-            Declaration _map = ModelSequencer.this.map(decl);
-            return _map;
-          }
-        };
-      List<Declaration> _map_1 = ListExtensions.<Declaration, Declaration>map(_declarations_1, _function);
-      final Function1<Declaration,Boolean> _function_1 = new Function1<Declaration,Boolean>() {
-          public Boolean apply(final Declaration e) {
-            boolean _operator_notEquals = ObjectExtensions.operator_notEquals(e, null);
-            return ((Boolean)_operator_notEquals);
-          }
-        };
-      Iterable<Declaration> _filter = IterableExtensions.<Declaration>filter(_map_1, _function_1);
-      CollectionExtensions.<Declaration>addAll(_declarations, _filter);
-      return _scope;
-    }
-  }
-  
-  protected Declaration _map(final Declaration decl) {
-    return null;
-  }
-  
-  protected Declaration _map(final EventDefinition e) {
-    {
-      EventDefinition _create = this.factory.create(e);
-      final EventDefinition _e = _create;
-      return _e;
-    }
-  }
-  
-  protected Declaration _map(final VariableDefinition v) {
-    {
-      VariableDefinition _create = this.factory.create(v);
-      final VariableDefinition _v = _create;
-      return _v;
-    }
-  }
-  
-  public ExecutionFlow mapStates(final Statechart statechart, final ExecutionFlow r) {
-    {
-      List<EObject> _eAllContentsAsList = EcoreUtil2.eAllContentsAsList(statechart);
-      List<EObject> content = _eAllContentsAsList;
-      final Function1<EObject,Boolean> _function = new Function1<EObject,Boolean>() {
-          public Boolean apply(final EObject e) {
-            return (e instanceof org.yakindu.sct.model.sgraph.State);
-          }
-        };
-      Iterable<EObject> _filter = IterableExtensions.<EObject>filter(content, _function);
-      final Iterable<EObject> allStates = _filter;
-      EList<ExecutionState> _states = r.getStates();
-      final Function1<EObject,ExecutionState> _function_1 = new Function1<EObject,ExecutionState>() {
-          public ExecutionState apply(final EObject s) {
-            ExecutionState _mapState = ModelSequencer.this.mapState(((State) s));
-            return _mapState;
-          }
-        };
-      Iterable<ExecutionState> _map = IterableExtensions.<EObject, ExecutionState>map(allStates, _function_1);
-      CollectionExtensions.<ExecutionState>addAll(_states, _map);
-      return r;
-    }
-  }
-  
-  public ExecutionState mapState(final State state) {
-    {
-      ExecutionState _create = this.factory.create(state);
-      final ExecutionState _state = _create;
-      boolean _isSimple = state.isSimple();
-      _state.setLeaf(_isSimple);
-      Step _mapEntryAction = this.mapEntryAction(state);
-      _state.setEntryAction(_mapEntryAction);
-      Step _mapExitAction = this.mapExitAction(state);
-      _state.setExitAction(_mapExitAction);
-      return _state;
-    }
-  }
-  
-  public ExecutionFlow mapTransitions(final Statechart statechart, final ExecutionFlow r) {
-    {
-      List<EObject> _eAllContentsAsList = EcoreUtil2.eAllContentsAsList(statechart);
-      List<EObject> content = _eAllContentsAsList;
-      final Function1<EObject,Boolean> _function = new Function1<EObject,Boolean>() {
-          public Boolean apply(final EObject e) {
-            return (e instanceof org.yakindu.sct.model.sgraph.State);
-          }
-        };
-      Iterable<EObject> _filter = IterableExtensions.<EObject>filter(content, _function);
-      final Iterable<EObject> allStates = _filter;
-      final Function1<EObject,ExecutionState> _function_1 = new Function1<EObject,ExecutionState>() {
-          public ExecutionState apply(final EObject s) {
-            ExecutionState _mapStateTransition = ModelSequencer.this.mapStateTransition(((State) s));
-            return _mapStateTransition;
-          }
-        };
-      IterableExtensions.<EObject>forEach(allStates, _function_1);
-      return r;
-    }
-  }
-  
-  public ExecutionState mapStateTransition(final State state) {
-    {
-      ExecutionState _create = this.factory.create(state);
-      final ExecutionState _state = _create;
-      EList<Reaction> _reactions = _state.getReactions();
-      EList<Transition> _outgoingTransitions = state.getOutgoingTransitions();
-      final Function1<Transition,Reaction> _function = new Function1<Transition,Reaction>() {
-          public Reaction apply(final Transition t) {
-            Reaction _mapTransition = ModelSequencer.this.mapTransition(t);
-            return _mapTransition;
-          }
-        };
-      List<Reaction> _map = ListExtensions.<Transition, Reaction>map(_outgoingTransitions, _function);
-      _reactions.addAll(_map);
-      return _state;
-    }
-  }
-  
-  public Reaction mapTransition(final Transition t) {
-    {
-      Reaction _create = this.factory.create(t);
-      final Reaction r = _create;
-      Trigger _trigger = t.getTrigger();
-      boolean _operator_notEquals = ObjectExtensions.operator_notEquals(_trigger, null);
-      if (_operator_notEquals) {
-        Trigger _trigger_1 = t.getTrigger();
-        Check _mapToCheck = this.mapToCheck(_trigger_1);
-        r.setCheck(_mapToCheck);
-      }
-      Sequence _mapToEffect = this.mapToEffect(t);
-      r.setEffect(_mapToEffect);
-      return r;
-    }
-  }
-  
-  public Sequence mapToEffect(final Transition t) {
-    {
-      SexecFactory _sexecFactory = this.sexecFactory();
-      Sequence _createSequence = _sexecFactory.createSequence();
-      final Sequence sequence = _createSequence;
-      boolean _operator_and = false;
-      Vertex _source = t.getSource();
-      if (!(_source instanceof org.yakindu.sct.model.sgraph.State)) {
-        _operator_and = false;
-      } else {
-        Vertex _source_1 = t.getSource();
-        ExecutionState _create = this.factory.create(((State) _source_1));
-        Step _exitAction = _create.getExitAction();
-        boolean _operator_notEquals = ObjectExtensions.operator_notEquals(_exitAction, null);
-        _operator_and = BooleanExtensions.operator_and((_source instanceof org.yakindu.sct.model.sgraph.State), _operator_notEquals);
-      }
-      if (_operator_and) {
-        EList<Step> _steps = sequence.getSteps();
-        Vertex _source_2 = t.getSource();
-        ExecutionState _create_1 = this.factory.create(((State) _source_2));
-        Step _exitAction_1 = _create_1.getExitAction();
-        Call _newCall = this.factory.newCall(_exitAction_1);
-        _steps.add(_newCall);
-      }
-      Vertex _source_3 = t.getSource();
-      boolean _operator_notEquals_1 = ObjectExtensions.operator_notEquals(_source_3, null);
-      if (_operator_notEquals_1) {
-        EList<Step> _steps_1 = sequence.getSteps();
-        Vertex _source_4 = t.getSource();
-        ExitState _newExitStateStep = this.newExitStateStep(((State) _source_4));
-        _steps_1.add(_newExitStateStep);
-      }
-      Effect _effect = t.getEffect();
-      boolean _operator_notEquals_2 = ObjectExtensions.operator_notEquals(_effect, null);
-      if (_operator_notEquals_2) {
-        EList<Step> _steps_2 = sequence.getSteps();
-        Effect _effect_1 = t.getEffect();
-        Sequence _mapEffect = this.mapEffect(_effect_1);
-        _steps_2.add(_mapEffect);
-      }
-      Vertex _target = t.getTarget();
-      boolean _operator_notEquals_3 = ObjectExtensions.operator_notEquals(_target, null);
-      if (_operator_notEquals_3) {
-        EList<Step> _steps_3 = sequence.getSteps();
-        Vertex _target_1 = t.getTarget();
-        EnterState _newEnterStateStep = this.newEnterStateStep(((State) _target_1));
-        _steps_3.add(_newEnterStateStep);
-      }
-      boolean _operator_and_1 = false;
-      Vertex _target_2 = t.getTarget();
-      if (!(_target_2 instanceof org.yakindu.sct.model.sgraph.State)) {
-        _operator_and_1 = false;
-      } else {
-        Vertex _target_3 = t.getTarget();
-        ExecutionState _create_2 = this.factory.create(((State) _target_3));
-        Step _entryAction = _create_2.getEntryAction();
-        boolean _operator_notEquals_4 = ObjectExtensions.operator_notEquals(_entryAction, null);
-        _operator_and_1 = BooleanExtensions.operator_and((_target_2 instanceof org.yakindu.sct.model.sgraph.State), _operator_notEquals_4);
-      }
-      if (_operator_and_1) {
-        EList<Step> _steps_4 = sequence.getSteps();
-        Vertex _target_4 = t.getTarget();
-        ExecutionState _create_3 = this.factory.create(((State) _target_4));
-        Step _entryAction_1 = _create_3.getEntryAction();
-        Call _newCall_1 = this.factory.newCall(_entryAction_1);
-        _steps_4.add(_newCall_1);
-      }
-      return sequence;
-    }
-  }
-  
-  protected Sequence _mapEffect(final Effect effect) {
-    return null;
-  }
-  
-  protected Sequence _mapEffect(final ReactionEffect effect) {
-    Sequence _xifexpression = null;
-    EList<Statement> _actions = effect.getActions();
-    boolean _isEmpty = _actions.isEmpty();
-    boolean _operator_not = BooleanExtensions.operator_not(_isEmpty);
-    if (_operator_not) {
-      {
-        SexecFactory _sexecFactory = this.sexecFactory();
-        Sequence _createSequence = _sexecFactory.createSequence();
-        final Sequence sequence = _createSequence;
-        sequence.setName("reaction_action");
-        EList<Step> _steps = sequence.getSteps();
-        EList<Statement> _actions_1 = effect.getActions();
-        final Function1<Statement,Execution> _function = new Function1<Statement,Execution>() {
-            public Execution apply(final Statement stmnt) {
-              Execution _mapToExecution = ModelSequencer.this.mapToExecution(stmnt);
-              return _mapToExecution;
-            }
-          };
-        List<Execution> _map = ListExtensions.<Statement, Execution>map(_actions_1, _function);
-        _steps.addAll(_map);
-        return sequence;
-      }
-    }
-    return _xifexpression;
-  }
-  
-  public Execution mapToExecution(final Statement stmnt) {
-    Execution _xblockexpression = null;
-    {
-      SexecFactory _sexecFactory = this.sexecFactory();
-      Execution _createExecution = _sexecFactory.createExecution();
-      final Execution exec = _createExecution;
-      Statement _copy = EcoreUtil.<Statement>copy(stmnt);
-      exec.setStatement(_copy);
-      _xblockexpression = (exec);
-    }
-    return _xblockexpression;
-  }
-  
-  public Step mapEntryAction(final State state) {
-    Sequence _xblockexpression = null;
-    {
-      SexecFactory _sexecFactory = this.sexecFactory();
-      Sequence _createSequence = _sexecFactory.createSequence();
-      final Sequence seq = _createSequence;
-      seq.setName("entryAction");
-      List<LocalReaction> _entryReactions = this.entryReactions(state);
-      final Function1<LocalReaction,Sequence> _function = new Function1<LocalReaction,Sequence>() {
-          public Sequence apply(final LocalReaction lr) {
-            Sequence _xifexpression = null;
-            Effect _effect = lr.getEffect();
-            boolean _operator_notEquals = ObjectExtensions.operator_notEquals(_effect, null);
-            if (_operator_notEquals) {
-              Effect _effect_1 = lr.getEffect();
-              Sequence _mapEffect = ModelSequencer.this.mapEffect(((ReactionEffect) _effect_1));
-              _xifexpression = _mapEffect;
-            } else {
-              _xifexpression = null;
-            }
-            return _xifexpression;
-          }
-        };
-      List<Sequence> _map = ListExtensions.<LocalReaction, Sequence>map(_entryReactions, _function);
-      final Function1<Sequence,Boolean> _function_1 = new Function1<Sequence,Boolean>() {
-          public Boolean apply(final Sequence e) {
-            Boolean _xifexpression_1 = null;
-            boolean _operator_notEquals_1 = ObjectExtensions.operator_notEquals(e, null);
-            if (_operator_notEquals_1) {
-              EList<Step> _steps = seq.getSteps();
-              boolean _add = _steps.add(e);
-              _xifexpression_1 = _add;
-            }
-            return _xifexpression_1;
-          }
-        };
-      IterableExtensions.<Sequence>forEach(_map, _function_1);
-      Sequence _xifexpression_2 = null;
-      EList<Step> _steps_1 = seq.getSteps();
-      int _size = _steps_1.size();
-      boolean _operator_greaterThan = ComparableExtensions.<Integer>operator_greaterThan(((Integer)_size), ((Integer)0));
-      if (_operator_greaterThan) {
-        _xifexpression_2 = seq;
-      } else {
-        _xifexpression_2 = null;
-      }
-      _xblockexpression = (_xifexpression_2);
-    }
-    return _xblockexpression;
-  }
-  
-  public Step mapExitAction(final State state) {
-    Sequence _xblockexpression = null;
-    {
-      SexecFactory _sexecFactory = this.sexecFactory();
-      Sequence _createSequence = _sexecFactory.createSequence();
-      final Sequence seq = _createSequence;
-      seq.setName("exitAction");
-      List<LocalReaction> _exitReactions = this.exitReactions(state);
-      final Function1<LocalReaction,Sequence> _function = new Function1<LocalReaction,Sequence>() {
-          public Sequence apply(final LocalReaction lr) {
-            Sequence _xifexpression = null;
-            Effect _effect = lr.getEffect();
-            boolean _operator_notEquals = ObjectExtensions.operator_notEquals(_effect, null);
-            if (_operator_notEquals) {
-              Effect _effect_1 = lr.getEffect();
-              Sequence _mapEffect = ModelSequencer.this.mapEffect(((ReactionEffect) _effect_1));
-              _xifexpression = _mapEffect;
-            } else {
-              _xifexpression = null;
-            }
-            return _xifexpression;
-          }
-        };
-      List<Sequence> _map = ListExtensions.<LocalReaction, Sequence>map(_exitReactions, _function);
-      final Function1<Sequence,Boolean> _function_1 = new Function1<Sequence,Boolean>() {
-          public Boolean apply(final Sequence e) {
-            Boolean _xifexpression_1 = null;
-            boolean _operator_notEquals_1 = ObjectExtensions.operator_notEquals(e, null);
-            if (_operator_notEquals_1) {
-              EList<Step> _steps = seq.getSteps();
-              boolean _add = _steps.add(e);
-              _xifexpression_1 = _add;
-            }
-            return _xifexpression_1;
-          }
-        };
-      IterableExtensions.<Sequence>forEach(_map, _function_1);
-      Sequence _xifexpression_2 = null;
-      EList<Step> _steps_1 = seq.getSteps();
-      int _size = _steps_1.size();
-      boolean _operator_greaterThan = ComparableExtensions.<Integer>operator_greaterThan(((Integer)_size), ((Integer)0));
-      if (_operator_greaterThan) {
-        _xifexpression_2 = seq;
-      } else {
-        _xifexpression_2 = null;
-      }
-      _xblockexpression = (_xifexpression_2);
-    }
-    return _xblockexpression;
-  }
-  
-  public ExecutionFlow defineStateCycles(final ExecutionFlow flow, final Statechart sc) {
-    {
-      EList<ExecutionState> _states = flow.getStates();
-      final Function1<ExecutionState,Boolean> _function = new Function1<ExecutionState,Boolean>() {
-          public Boolean apply(final ExecutionState s) {
-            boolean _isLeaf = s.isLeaf();
-            return ((Boolean)_isLeaf);
-          }
-        };
-      Iterable<ExecutionState> _filter = IterableExtensions.<ExecutionState>filter(_states, _function);
-      final Function1<ExecutionState,Cycle> _function_1 = new Function1<ExecutionState,Cycle>() {
-          public Cycle apply(final ExecutionState s_1) {
-            Cycle _defineCycle = ModelSequencer.this.defineCycle(s_1);
-            return _defineCycle;
-          }
-        };
-      IterableExtensions.<ExecutionState>forEach(_filter, _function_1);
-      return flow;
-    }
-  }
-  
-  public Cycle defineCycle(final ExecutionState state) {
-    {
-      SexecFactory _sexecFactory = this.sexecFactory();
-      Cycle _createCycle = _sexecFactory.createCycle();
-      final Cycle cycle = _createCycle;
-      state.setCycle(cycle);
-      EList<Reaction> _reactions = state.getReactions();
-      Iterable<Reaction> _reverseView = ListExtensions.<Reaction>reverseView(_reactions);
-      final Function2<If,Reaction,If> _function = new Function2<If,Reaction,If>() {
-          public If apply(final If s , final Reaction reaction) {
-            If _xblockexpression = null;
-            {
-              SexecFactory _sexecFactory_1 = ModelSequencer.this.sexecFactory();
-              If _createIf = _sexecFactory_1.createIf();
-              If ifStep = _createIf;
-              Check _check = reaction.getCheck();
-              CheckRef _newRef = ModelSequencer.this.factory.newRef(_check);
-              ifStep.setCheck(_newRef);
-              Step _effect = reaction.getEffect();
-              Call _newCall = ModelSequencer.this.factory.newCall(_effect);
-              ifStep.setThenStep(_newCall);
-              ifStep.setElseStep(s);
-              _xblockexpression = (ifStep);
-            }
-            return _xblockexpression;
-          }
-        };
-      If _fold = IterableExtensions.<Reaction, If>fold(_reverseView, ((If) null), _function);
-      final If step = _fold;
-      boolean _operator_notEquals = ObjectExtensions.operator_notEquals(step, null);
-      if (_operator_notEquals) {
-        EList<Step> _steps = cycle.getSteps();
-        _steps.add(step);
-      }
-      return cycle;
-    }
-  }
-  
-  protected Check _mapToCheck(final Trigger tr) {
-    return null;
-  }
-  
-  protected Check _mapToCheck(final ReactionTrigger tr) {
-    {
-      Check _createCheck = this.factory.createCheck(tr);
-      final Check check = _createCheck;
-      Statement _buildCondition = this.buildCondition(tr);
-      check.setCondition(_buildCondition);
-      return check;
-    }
-  }
-  
-  protected Statement _buildCondition(final Trigger t) {
-    return null;
-  }
-  
-  protected Statement _buildCondition(final ReactionTrigger t) {
-    Expression _xifexpression = null;
-    EList<EventSpec> _triggers = t.getTriggers();
-    boolean _isEmpty = _triggers.isEmpty();
-    boolean _operator_not = BooleanExtensions.operator_not(_isEmpty);
-    if (_operator_not) {
-      EList<EventSpec> _triggers_1 = t.getTriggers();
-      Iterable<EventSpec> _reverseView = ListExtensions.<EventSpec>reverseView(_triggers_1);
-      final Function2<Expression,EventSpec,Expression> _function = new Function2<Expression,EventSpec,Expression>() {
-          public Expression apply(final Expression s , final EventSpec e) {
-            Expression _xifexpression_1 = null;
-            boolean _operator_equals = ObjectExtensions.operator_equals(s, null);
-            if (_operator_equals) {
-              Expression _raised = ModelSequencer.this.raised(e);
-              _xifexpression_1 = _raised;
-            } else {
-              Expression _raised_1 = ModelSequencer.this.raised(e);
-              Expression _or = ModelSequencer.this.or(_raised_1, s);
-              _xifexpression_1 = _or;
-            }
-            return _xifexpression_1;
-          }
-        };
-      Expression _fold = IterableExtensions.<EventSpec, Expression>fold(_reverseView, ((Expression) null), _function);
-      _xifexpression = _fold;
-    }
-    return _xifexpression;
-  }
-  
-  public Expression or(final Expression left, final Expression right) {
-    LogicalOrExpression _xblockexpression = null;
-    {
-      StextFactory _stextFactory = this.stextFactory();
-      LogicalOrExpression _createLogicalOrExpression = _stextFactory.createLogicalOrExpression();
-      final LogicalOrExpression or = _createLogicalOrExpression;
-      or.setLeftOperand(left);
-      or.setRightOperand(right);
-      _xblockexpression = (or);
-    }
-    return _xblockexpression;
-  }
-  
-  protected Expression _raised(final EventSpec e) {
-    return null;
-  }
-  
-  protected Expression _raised(final RegularEventSpec e) {
-    {
-      StextFactory _stextFactory = this.stextFactory();
-      ElementReferenceExpression _createElementReferenceExpression = _stextFactory.createElementReferenceExpression();
-      final ElementReferenceExpression r = _createElementReferenceExpression;
-      Event _event = e.getEvent();
-      EventDefinition _create = this.factory.create(((EventDefinition) _event));
-      r.setValue(_create);
-      return r;
-    }
-  }
-  
-  public void defineStateVector(final ExecutionFlow flow, final Statechart sc) {
-    {
-      SexecFactory _sexecFactory = this.sexecFactory();
-      StateVector _createStateVector = _sexecFactory.createStateVector();
-      flow.setStateVector(_createStateVector);
-      StateVector _stateVector = flow.getStateVector();
-      _stateVector.setOffset(0);
-      StateVector _stateVector_1 = flow.getStateVector();
-      int _maxOrthogonality = this.sct.maxOrthogonality(sc);
-      _stateVector_1.setSize(_maxOrthogonality);
-    }
-  }
-  
-  public Sequence defineEnterSequence(final ExecutionFlow flow, final Statechart sc) {
-    {
-      EList<Region> _regions = sc.getRegions();
-      final Function1<Region,EnterState> _function = new Function1<Region,EnterState>() {
-          public EnterState apply(final Region r) {
-            Entry _entry = ModelSequencer.this.entry(r);
-            State _target = ModelSequencer.this.target(_entry);
-            EnterState _newEnterStateStep = ModelSequencer.this==null?(EnterState)null:ModelSequencer.this.newEnterStateStep(_target);
-            return _newEnterStateStep;
-          }
-        };
-      List<EnterState> _map = ListExtensions.<Region, EnterState>map(_regions, _function);
-      final Function1<EnterState,Boolean> _function_1 = new Function1<EnterState,Boolean>() {
-          public Boolean apply(final EnterState e) {
-            boolean _operator_notEquals = ObjectExtensions.operator_notEquals(e, null);
-            return ((Boolean)_operator_notEquals);
-          }
-        };
-      Iterable<EnterState> _filter = IterableExtensions.<EnterState>filter(_map, _function_1);
-      final Iterable<EnterState> enterSteps = _filter;
-      SexecFactory _sexecFactory = this.sexecFactory();
-      Sequence _createSequence = _sexecFactory.createSequence();
-      final Sequence enterSequence = _createSequence;
-      enterSequence.setName("enter");
-      final Function1<EnterState,Boolean> _function_2 = new Function1<EnterState,Boolean>() {
-          public Boolean apply(final EnterState e_1) {
-            EList<Step> _steps = enterSequence.getSteps();
-            boolean _add = _steps.add(e_1);
-            return ((Boolean)_add);
-          }
-        };
-      IterableExtensions.<EnterState>forEach(enterSteps, _function_2);
-      flow.setEnterSequence(enterSequence);
-      return enterSequence;
-    }
-  }
-  
-  public EnterState newEnterStateStep(final State s) {
-    {
-      EnterState ess = ((EnterState) null);
-      boolean _operator_notEquals = ObjectExtensions.operator_notEquals(s, null);
-      if (_operator_notEquals) {
-        {
-          SexecFactory _sexecFactory = this.sexecFactory();
-          EnterState _createEnterState = _sexecFactory.createEnterState();
-          ess = _createEnterState;
-          ExecutionState _create = this.factory.create(s);
-          ess.setState(_create);
-        }
-      }
-      return ess;
-    }
-  }
-  
-  public ExitState newExitStateStep(final State s) {
-    {
-      ExitState ess = ((ExitState) null);
-      boolean _operator_notEquals = ObjectExtensions.operator_notEquals(s, null);
-      if (_operator_notEquals) {
-        {
-          SexecFactory _sexecFactory = this.sexecFactory();
-          ExitState _createExitState = _sexecFactory.createExitState();
-          ess = _createExitState;
-          ExecutionState _create = this.factory.create(s);
-          ess.setState(_create);
-        }
-      }
-      return ess;
-    }
-  }
-  
-  public void retargetDeclRefs(final ExecutionFlow flow) {
-    {
-      List<EObject> _eAllContentsAsList = EcoreUtil2.eAllContentsAsList(flow);
-      final List<EObject> allContent = _eAllContentsAsList;
-      final Function1<EObject,Boolean> _function = new Function1<EObject,Boolean>() {
-          public Boolean apply(final EObject e) {
-            boolean _operator_or = false;
-            if ((e instanceof org.yakindu.sct.model.stext.stext.EventDefinition)) {
-              _operator_or = true;
-            } else {
-              _operator_or = BooleanExtensions.operator_or((e instanceof org.yakindu.sct.model.stext.stext.EventDefinition), (e instanceof org.yakindu.sct.model.stext.stext.VariableDefinition));
-            }
-            return ((Boolean)_operator_or);
-          }
-        };
-      Iterable<EObject> _filter = IterableExtensions.<EObject>filter(allContent, _function);
-      List<EObject> _list = IterableExtensions.<EObject>toList(_filter);
-      final List<EObject> declared = _list;
-      final Function1<EObject,Boolean> _function_1 = new Function1<EObject,Boolean>() {
-          public Boolean apply(final EObject e_1) {
-            return (e_1 instanceof org.yakindu.sct.model.stext.stext.ElementReferenceExpression);
-          }
-        };
-      Iterable<EObject> _filter_1 = IterableExtensions.<EObject>filter(allContent, _function_1);
-      final Function1<EObject,ElementReferenceExpression> _function_2 = new Function1<EObject,ElementReferenceExpression>() {
-          public ElementReferenceExpression apply(final EObject s) {
-            return ((ElementReferenceExpression) s);
-          }
-        };
-      Iterable<ElementReferenceExpression> _map = IterableExtensions.<EObject, ElementReferenceExpression>map(_filter_1, _function_2);
-      final Function1<ElementReferenceExpression,Object> _function_3 = new Function1<ElementReferenceExpression,Object>() {
-          public Object apply(final ElementReferenceExpression ere) {
-            Object _retarget = ModelSequencer.this.retarget(ere, declared);
-            return _retarget;
-          }
-        };
-      IterableExtensions.<ElementReferenceExpression>forEach(_map, _function_3);
-      final Function1<EObject,Boolean> _function_4 = new Function1<EObject,Boolean>() {
-          public Boolean apply(final EObject e_2) {
-            return (e_2 instanceof org.yakindu.sct.model.stext.stext.Assignment);
-          }
-        };
-      Iterable<EObject> _filter_2 = IterableExtensions.<EObject>filter(allContent, _function_4);
-      final Function1<EObject,Assignment> _function_5 = new Function1<EObject,Assignment>() {
-          public Assignment apply(final EObject s_1) {
-            return ((Assignment) s_1);
-          }
-        };
-      Iterable<Assignment> _map_1 = IterableExtensions.<EObject, Assignment>map(_filter_2, _function_5);
-      final Function1<Assignment,Object> _function_6 = new Function1<Assignment,Object>() {
-          public Object apply(final Assignment ere_1) {
-            Object _retarget_1 = ModelSequencer.this.retarget(ere_1, declared);
-            return _retarget_1;
-          }
-        };
-      IterableExtensions.<Assignment>forEach(_map_1, _function_6);
-    }
-  }
-  
-  public Object retarget(final ElementReferenceExpression ere, final List<EObject> declared) {
-    Object _xifexpression = null;
-    Declaration _value = ere.getValue();
-    boolean _contains = declared.contains(_value);
-    boolean _operator_not = BooleanExtensions.operator_not(_contains);
-    if (_operator_not) {
-      Declaration _value_1 = ere.getValue();
-      Declaration _replaced = this.replaced(_value_1);
-      ere.setValue(_replaced);
-    }
-    return _xifexpression;
-  }
-  
-  public Object retarget(final Assignment assign, final List<EObject> declared) {
-    Object _xifexpression = null;
-    Variable _varRef = assign.getVarRef();
-    boolean _contains = declared.contains(_varRef);
-    boolean _operator_not = BooleanExtensions.operator_not(_contains);
-    if (_operator_not) {
-      Variable _varRef_1 = assign.getVarRef();
-      Declaration _replaced = this.replaced(((VariableDefinition) _varRef_1));
-      assign.setVarRef(((Variable) _replaced));
-    }
-    return _xifexpression;
-  }
-  
-  protected Declaration _replaced(final VariableDefinition vd) {
-    VariableDefinition _create = this.factory.create(vd);
-    return _create;
-  }
-  
-  protected Declaration _replaced(final EventDefinition ed) {
-    EventDefinition _create = this.factory.create(ed);
-    return _create;
-  }
-  
-  public SexecFactory sexecFactory() {
-    return SexecFactory.eINSTANCE;
-  }
-  
-  public StextFactory stextFactory() {
-    return StextFactory.eINSTANCE;
-  }
-  
-  public Entry entry(final Region r) {
-    EList<Vertex> _vertices = r.getVertices();
-    final Function1<Vertex,Boolean> _function = new Function1<Vertex,Boolean>() {
-        public Boolean apply(final Vertex v) {
-          boolean _operator_and = false;
-          if (!(v instanceof org.yakindu.sct.model.sgraph.Entry)) {
-            _operator_and = false;
-          } else {
-            boolean _operator_or = false;
-            boolean _operator_or_1 = false;
-            String _name = v.getName();
-            boolean _operator_equals = ObjectExtensions.operator_equals(_name, null);
-            if (_operator_equals) {
-              _operator_or_1 = true;
-            } else {
-              String _name_1 = v.getName();
-              boolean _equals = "".equals(_name_1);
-              _operator_or_1 = BooleanExtensions.operator_or(_operator_equals, _equals);
-            }
-            if (_operator_or_1) {
-              _operator_or = true;
-            } else {
-              String _name_2 = v.getName();
-              boolean _operator_equals_1 = ObjectExtensions.operator_equals(_name_2, "default");
-              _operator_or = BooleanExtensions.operator_or(_operator_or_1, _operator_equals_1);
-            }
-            _operator_and = BooleanExtensions.operator_and((v instanceof org.yakindu.sct.model.sgraph.Entry), _operator_or);
-          }
-          return ((Boolean)_operator_and);
-        }
-      };
-    Vertex _findFirst = IterableExtensions.<Vertex>findFirst(_vertices, _function);
-    return ((Entry) _findFirst);
-  }
-  
-  public State target(final Entry entry) {
-    EList<Transition> _outgoingTransitions = entry==null?(EList<Transition>)null:entry.getOutgoingTransitions();
-    Transition _get = _outgoingTransitions==null?(Transition)null:_outgoingTransitions.get(0);
-    Vertex _target = _get==null?(Vertex)null:_get.getTarget();
-    return ((State) _target);
-  }
-  
-  public List<LocalReaction> entryReactions(final State state) {
-    List<LocalReaction> _xblockexpression = null;
-    {
-      List<EObject> _eAllContentsAsList = EcoreUtil2.eAllContentsAsList(state);
-      final Function1<EObject,Boolean> _function = new Function1<EObject,Boolean>() {
-          public Boolean apply(final EObject e) {
-            return (e instanceof org.yakindu.sct.model.stext.stext.LocalReaction);
-          }
-        };
-      Iterable<EObject> _filter = IterableExtensions.<EObject>filter(_eAllContentsAsList, _function);
-      Iterable<EObject> localReactions = _filter;
-      final Function1<EObject,Boolean> _function_1 = new Function1<EObject,Boolean>() {
-          public Boolean apply(final EObject r) {
-            Trigger _trigger = ((LocalReaction) r).getTrigger();
-            EList<EventSpec> _triggers = ((ReactionTrigger) _trigger).getTriggers();
-            final Function1<EventSpec,Boolean> _function_2 = new Function1<EventSpec,Boolean>() {
-                public Boolean apply(final EventSpec t) {
-                  return (t instanceof org.yakindu.sct.model.stext.stext.EntryEvent);
-                }
-              };
-            boolean _exists = IterableExtensions.<EventSpec>exists(_triggers, _function_2);
-            return ((Boolean)_exists);
-          }
-        };
-      Iterable<EObject> _filter_1 = IterableExtensions.<EObject>filter(localReactions, _function_1);
-      final Function1<EObject,LocalReaction> _function_3 = new Function1<EObject,LocalReaction>() {
-          public LocalReaction apply(final EObject lr) {
-            return ((LocalReaction) lr);
-          }
-        };
-      Iterable<LocalReaction> _map = IterableExtensions.<EObject, LocalReaction>map(_filter_1, _function_3);
-      List<LocalReaction> _list = IterableExtensions.<LocalReaction>toList(_map);
-      _xblockexpression = (_list);
-    }
-    return _xblockexpression;
-  }
-  
-  public List<LocalReaction> exitReactions(final State state) {
-    List<LocalReaction> _xblockexpression = null;
-    {
-      List<EObject> _eAllContentsAsList = EcoreUtil2.eAllContentsAsList(state);
-      final Function1<EObject,Boolean> _function = new Function1<EObject,Boolean>() {
-          public Boolean apply(final EObject e) {
-            return (e instanceof org.yakindu.sct.model.stext.stext.LocalReaction);
-          }
-        };
-      Iterable<EObject> _filter = IterableExtensions.<EObject>filter(_eAllContentsAsList, _function);
-      Iterable<EObject> localReactions = _filter;
-      final Function1<EObject,Boolean> _function_1 = new Function1<EObject,Boolean>() {
-          public Boolean apply(final EObject r) {
-            Trigger _trigger = ((LocalReaction) r).getTrigger();
-            EList<EventSpec> _triggers = ((ReactionTrigger) _trigger).getTriggers();
-            final Function1<EventSpec,Boolean> _function_2 = new Function1<EventSpec,Boolean>() {
-                public Boolean apply(final EventSpec t) {
-                  return (t instanceof org.yakindu.sct.model.stext.stext.ExitEvent);
-                }
-              };
-            boolean _exists = IterableExtensions.<EventSpec>exists(_triggers, _function_2);
-            return ((Boolean)_exists);
-          }
-        };
-      Iterable<EObject> _filter_1 = IterableExtensions.<EObject>filter(localReactions, _function_1);
-      final Function1<EObject,LocalReaction> _function_3 = new Function1<EObject,LocalReaction>() {
-          public LocalReaction apply(final EObject lr) {
-            return ((LocalReaction) lr);
-          }
-        };
-      Iterable<LocalReaction> _map = IterableExtensions.<EObject, LocalReaction>map(_filter_1, _function_3);
-      List<LocalReaction> _list = IterableExtensions.<LocalReaction>toList(_map);
-      _xblockexpression = (_list);
-    }
-    return _xblockexpression;
-  }
-  
-  public Declaration map(final Declaration e) {
-    if ((e instanceof EventDefinition)) {
-      return _map((EventDefinition)e);
-    } else if ((e instanceof VariableDefinition)) {
-      return _map((VariableDefinition)e);
-    } else if ((e instanceof Declaration)) {
-      return _map((Declaration)e);
-    } else {
-      throw new IllegalArgumentException("Unhandled parameter types: " +
-        java.util.Arrays.<Object>asList(e).toString());
-    }
-  }
-  
-  public Sequence mapEffect(final Effect effect) {
-    if ((effect instanceof ReactionEffect)) {
-      return _mapEffect((ReactionEffect)effect);
-    } else if ((effect instanceof Effect)) {
-      return _mapEffect((Effect)effect);
-    } else {
-      throw new IllegalArgumentException("Unhandled parameter types: " +
-        java.util.Arrays.<Object>asList(effect).toString());
-    }
-  }
-  
-  public Check mapToCheck(final Trigger tr) {
-    if ((tr instanceof ReactionTrigger)) {
-      return _mapToCheck((ReactionTrigger)tr);
-    } else if ((tr instanceof Trigger)) {
-      return _mapToCheck((Trigger)tr);
-    } else {
-      throw new IllegalArgumentException("Unhandled parameter types: " +
-        java.util.Arrays.<Object>asList(tr).toString());
-    }
-  }
-  
-  public Statement buildCondition(final Trigger t) {
-    if ((t instanceof ReactionTrigger)) {
-      return _buildCondition((ReactionTrigger)t);
-    } else if ((t instanceof Trigger)) {
-      return _buildCondition((Trigger)t);
-    } else {
-      throw new IllegalArgumentException("Unhandled parameter types: " +
-        java.util.Arrays.<Object>asList(t).toString());
-    }
-  }
-  
-  public Expression raised(final EventSpec e) {
-    if ((e instanceof RegularEventSpec)) {
-      return _raised((RegularEventSpec)e);
-    } else if ((e instanceof EventSpec)) {
-      return _raised((EventSpec)e);
-    } else {
-      throw new IllegalArgumentException("Unhandled parameter types: " +
-        java.util.Arrays.<Object>asList(e).toString());
-    }
-  }
-  
-  public Declaration replaced(final Declaration ed) {
-    if ((ed instanceof EventDefinition)) {
-      return _replaced((EventDefinition)ed);
-    } else if ((ed instanceof VariableDefinition)) {
-      return _replaced((VariableDefinition)ed);
-    } else {
-      throw new IllegalArgumentException("Unhandled parameter types: " +
-        java.util.Arrays.<Object>asList(ed).toString());
-    }
-  }
-}

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

@@ -1,131 +0,0 @@
-package org.yakindu.sct.model.sexec.transformation;
-
-import org.eclipse.emf.common.util.EList;
-import org.eclipse.emf.ecore.EObject;
-import org.eclipse.xtext.xbase.lib.ComparableExtensions;
-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.Reaction;
-import org.yakindu.sct.model.sgraph.Region;
-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;
-
-@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> _subRegions = s.getSubRegions();
-    int _size = _subRegions.size();
-    boolean _operator_greaterThan = ComparableExtensions.<Integer>operator_greaterThan(((Integer)_size), ((Integer)0));
-    if (_operator_greaterThan) {
-      EList<Region> _subRegions_1 = s.getSubRegions();
-      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(_subRegions_1, ((Integer)0), _function);
-      _xifexpression = _fold;
-    } else {
-      _xifexpression = 1;
-    }
-    return _xifexpression;
-  }
-  
-  public Reaction reaction(final Trigger tr) {
-    EObject _eContainer = tr.eContainer();
-    return ((Reaction) _eContainer);
-  }
-  
-  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;
-  }
-  
-  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 String id(final Object t) {
-    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());
-    }
-  }
-}

+ 33 - 0
test-plugins/org.yakindu.sct.model.sexec.test/src/org/yakindu/sct/model/sexec/transformation/test/ModelSequencerTest.java

@@ -209,6 +209,39 @@ public class ModelSequencerTest {
 		assertNotNull(_s2.getEntryAction());
 		assertNull(_s1.getEntryAction());
 	}
+
+	
+	/**
+	 * entry actions of a substate must not be included in a states entry action list
+	 */
+	@Test public void testSubStateEntryAction() {
+		Statechart sc = _createStatechart("test");
+		Scope scope = _createInterfaceScope("interface", sc);
+		VariableDefinition v1 = _createVariableDefinition("v1", Type.INTEGER, scope);
+		Region r = _createRegion("main", sc);
+//		Entry e = _createEntry(EntryKind.INITIAL, null, r);
+		State s2 = _createState("s2", r);
+		
+		Region s2_r = _createRegion("sub", s2);
+		State s2_1 = _createState("s2_1", s2_r);
+		LocalReaction entryAction = _createEntryAction(s2_1);
+		Assignment assign1 = _createVariableAssignment(v1, AssignmentOperator.ASSIGN, _createValue("42"), (ReactionEffect) entryAction.getEffect());
+		LocalReaction exitAction = _createExitAction(s2_1);
+		Assignment assign2 = _createVariableAssignment(v1, AssignmentOperator.ASSIGN, _createValue("43"), (ReactionEffect) exitAction.getEffect());
+		
+		ExecutionFlow flow = sequencer.transform(sc);
+		
+		ExecutionState _s2 = flow.getStates().get(0);
+		ExecutionState _s2_1 = flow.getStates().get(1);
+		assertEquals(s2.getName(), _s2.getSimpleName());
+		assertEquals(s2_1.getName(), _s2_1.getSimpleName());
+		
+		assertNull(_s2.getEntryAction());
+		assertNotNull(_s2_1.getEntryAction());
+
+		assertNull(_s2.getExitAction());
+		assertNotNull(_s2_1.getExitAction());
+}
 	
 	
 	/**