Explorar o código

Fixed errors in foreach calls that came up with xtend 2.3

terfloth@itemis.de %!s(int64=13) %!d(string=hai) anos
pai
achega
617f50f674
Modificáronse 18 ficheiros con 5764 adicións e 5755 borrados
  1. 8 0
      plugins/org.yakindu.sct.model.sexec/.settings/org.eclipse.xtend.core.Xtend.prefs
  2. 2 2
      plugins/org.yakindu.sct.model.sexec/src/org/yakindu/sct/model/sexec/transformation/BehaviorMapping.xtend
  3. 2 2
      plugins/org.yakindu.sct.model.sexec/src/org/yakindu/sct/model/sexec/transformation/FlowOptimizer.xtend
  4. 1 1
      plugins/org.yakindu.sct.model.sexec/src/org/yakindu/sct/model/sexec/transformation/SequenceBuilder.xtend
  5. 2 2
      plugins/org.yakindu.sct.model.sexec/src/org/yakindu/sct/model/sexec/transformation/StatechartExtensions.xtend
  6. 961 963
      plugins/org.yakindu.sct.model.sexec/xtend-gen/org/yakindu/sct/model/sexec/transformation/BehaviorMapping.java
  7. 808 810
      plugins/org.yakindu.sct.model.sexec/xtend-gen/org/yakindu/sct/model/sexec/transformation/FlowOptimizer.java
  8. 261 261
      plugins/org.yakindu.sct.model.sexec/xtend-gen/org/yakindu/sct/model/sexec/transformation/ModelSequencer.java
  9. 541 541
      plugins/org.yakindu.sct.model.sexec/xtend-gen/org/yakindu/sct/model/sexec/transformation/ReactionBuilder.java
  10. 875 875
      plugins/org.yakindu.sct.model.sexec/xtend-gen/org/yakindu/sct/model/sexec/transformation/SequenceBuilder.java
  11. 786 786
      plugins/org.yakindu.sct.model.sexec/xtend-gen/org/yakindu/sct/model/sexec/transformation/SexecElementMapping.java
  12. 145 145
      plugins/org.yakindu.sct.model.sexec/xtend-gen/org/yakindu/sct/model/sexec/transformation/SexecExtensions.java
  13. 236 236
      plugins/org.yakindu.sct.model.sexec/xtend-gen/org/yakindu/sct/model/sexec/transformation/SgraphExtensions.java
  14. 239 239
      plugins/org.yakindu.sct.model.sexec/xtend-gen/org/yakindu/sct/model/sexec/transformation/StateVectorBuilder.java
  15. 452 447
      plugins/org.yakindu.sct.model.sexec/xtend-gen/org/yakindu/sct/model/sexec/transformation/StatechartExtensions.java
  16. 37 37
      plugins/org.yakindu.sct.model.sexec/xtend-gen/org/yakindu/sct/model/sexec/transformation/StextExtensions.java
  17. 306 306
      plugins/org.yakindu.sct.model.sexec/xtend-gen/org/yakindu/sct/model/sexec/transformation/StructureMapping.java
  18. 102 102
      plugins/org.yakindu.sct.model.sexec/xtend-gen/org/yakindu/sct/model/sexec/transformation/TraceExtensions.java

+ 8 - 0
plugins/org.yakindu.sct.model.sexec/.settings/org.eclipse.xtend.core.Xtend.prefs

@@ -0,0 +1,8 @@
+autobuilding=true
+eclipse.preferences.version=1
+is_project_specific=true
+outlet.DEFAULT_OUTPUT.cleanDirectory=false
+outlet.DEFAULT_OUTPUT.cleanupDerived=false
+outlet.DEFAULT_OUTPUT.createDirectory=true
+outlet.DEFAULT_OUTPUT.derived=false
+outlet.DEFAULT_OUTPUT.override=true

+ 2 - 2
plugins/org.yakindu.sct.model.sexec/src/org/yakindu/sct/model/sexec/transformation/BehaviorMapping.xtend

@@ -63,7 +63,7 @@ class BehaviorMapping {
 		r.entryAction = seq
 		
 		val allStates = statechart.allRegularStates.filter(typeof(State))
-		allStates.forEach( s | { s.create.entryAction = s.mapEntryAction() null } )
+		allStates.forEach( s | { s.create.entryAction = s.mapEntryAction()  } )
 		return r
 	}
 
@@ -119,7 +119,7 @@ class BehaviorMapping {
 		r.exitAction = seq
 		
 		val allStates = statechart.allRegularStates.filter(typeof(State))
-		allStates.forEach( s | { s.create.exitAction = s.mapExitAction() null } )
+		allStates.forEach( s | { s.create.exitAction = s.mapExitAction() } )
 		return r
 	}
 

+ 2 - 2
plugins/org.yakindu.sct.model.sexec/src/org/yakindu/sct/model/sexec/transformation/FlowOptimizer.xtend

@@ -58,11 +58,11 @@ class FlowOptimizer {
 
 				
 		if (_inlineChoices) {
-			flow.nodes.filter(typeof(ExecutionChoice)).forEach( node | { node.reactions.forEach( r | { r.check.inline r.effect.inline }) node })
+			flow.nodes.filter(typeof(ExecutionChoice)).forEach( node | { node.reactions.forEach( r | { r.check.inline r.effect.inline })  })
 			flow.nodes.filter(typeof(ExecutionChoice)).forEach( node | node.reactSequence.inline )
 		}
 		if (_inlineEntries) {
-			flow.nodes.filter(typeof(ExecutionEntry)).forEach( node | { node.reactions.forEach( r | { r.check.inline r.effect.inline }) node })
+			flow.nodes.filter(typeof(ExecutionEntry)).forEach( node | { node.reactions.forEach( r | { r.check.inline r.effect.inline })  })
 			flow.nodes.filter(typeof(ExecutionEntry)).forEach( node | node.reactSequence.inline )
 		}
 

+ 1 - 1
plugins/org.yakindu.sct.model.sexec/src/org/yakindu/sct/model/sexec/transformation/SequenceBuilder.xtend

@@ -436,7 +436,7 @@ class SequenceBuilder {
 		
 		div
 	}
-	
+	 
 	def Statement multiply(Expression stmnt, long factor) {
 		val NumericalMultiplyDivideExpression div = stext.factory.createNumericalMultiplyDivideExpression
 		val PrimitiveValueExpression pve = stext.factory.createPrimitiveValueExpression 

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

@@ -28,12 +28,12 @@ class StatechartExtensions {
 	
 	
 	/** calculates the maximum orthogonality (maximum number of possible active leaf states) of the statechart */
-	def int maxOrthogonality(Statechart sc) {
+	def dispatch int maxOrthogonality(Statechart sc) {
 		sc.regions.fold(0, [o, r | r.maxOrthogonality + o])
 	}
 
 	/** calculates the maximum orthogonality (maximum number of possible active leaf states) of a region */
-	def int maxOrthogonality(Region r) {
+	def dispatch int maxOrthogonality(Region r) {
 		r.vertices.fold(0, [s, v | {
 			val mo = v.maxOrthogonality
 			if (mo > s) mo else s }])

A diferenza do arquivo foi suprimida porque é demasiado grande
+ 961 - 963
plugins/org.yakindu.sct.model.sexec/xtend-gen/org/yakindu/sct/model/sexec/transformation/BehaviorMapping.java


A diferenza do arquivo foi suprimida porque é demasiado grande
+ 808 - 810
plugins/org.yakindu.sct.model.sexec/xtend-gen/org/yakindu/sct/model/sexec/transformation/FlowOptimizer.java


+ 261 - 261
plugins/org.yakindu.sct.model.sexec/xtend-gen/org/yakindu/sct/model/sexec/transformation/ModelSequencer.java

@@ -1,261 +1,261 @@
-package org.yakindu.sct.model.sexec.transformation;
-
-import com.google.common.base.Objects;
-import com.google.common.collect.Iterables;
-import com.google.inject.Inject;
-import java.util.Arrays;
-import java.util.Collection;
-import java.util.List;
-import java.util.Set;
-import org.apache.commons.logging.Log;
-import org.apache.commons.logging.LogConfigurationException;
-import org.apache.commons.logging.LogFactory;
-import org.eclipse.emf.ecore.EObject;
-import org.eclipse.xtext.EcoreUtil2;
-import org.eclipse.xtext.naming.IQualifiedNameProvider;
-import org.eclipse.xtext.naming.QualifiedName;
-import org.eclipse.xtext.xbase.lib.Exceptions;
-import org.eclipse.xtext.xbase.lib.Functions.Function1;
-import org.eclipse.xtext.xbase.lib.InputOutput;
-import org.eclipse.xtext.xbase.lib.IterableExtensions;
-import org.eclipse.xtext.xbase.lib.Procedures.Procedure1;
-import org.yakindu.base.types.Feature;
-import org.yakindu.sct.model.sexec.ExecutionFlow;
-import org.yakindu.sct.model.sexec.TimeEvent;
-import org.yakindu.sct.model.sexec.transformation.BehaviorMapping;
-import org.yakindu.sct.model.sexec.transformation.ReactionBuilder;
-import org.yakindu.sct.model.sexec.transformation.SequenceBuilder;
-import org.yakindu.sct.model.sexec.transformation.SexecElementMapping;
-import org.yakindu.sct.model.sexec.transformation.StateVectorBuilder;
-import org.yakindu.sct.model.sexec.transformation.StructureMapping;
-import org.yakindu.sct.model.sgraph.Declaration;
-import org.yakindu.sct.model.sgraph.Statechart;
-import org.yakindu.sct.model.stext.stext.ElementReferenceExpression;
-import org.yakindu.sct.model.stext.stext.EventDefinition;
-import org.yakindu.sct.model.stext.stext.FeatureCall;
-import org.yakindu.sct.model.stext.stext.OperationDefinition;
-import org.yakindu.sct.model.stext.stext.VariableDefinition;
-
-@SuppressWarnings("all")
-public class ModelSequencer {
-  @Inject
-  private IQualifiedNameProvider qfnProvider;
-  
-  @Inject
-  private SexecElementMapping mapping;
-  
-  @Inject
-  private StructureMapping structureMapping;
-  
-  @Inject
-  private BehaviorMapping behaviorMapping;
-  
-  @Inject
-  private ReactionBuilder reactBuilder;
-  
-  @Inject
-  private SequenceBuilder seqBuilder;
-  
-  @Inject
-  private StateVectorBuilder svBuilder;
-  
-  /**
-   * ==========================================================================
-   * TRANSFORMATION ROOT
-   */
-  public ExecutionFlow transform(final Statechart sc) {
-    final ExecutionFlow ef = this.mapping.create(sc);
-    this.structureMapping.mapScopes(sc, ef);
-    this.structureMapping.mapRegularStates(sc, ef);
-    this.structureMapping.mapRegions(sc, ef);
-    this.structureMapping.mapPseudoStates(sc, ef);
-    this.structureMapping.mapTimeEvents(sc, ef);
-    this.svBuilder.defineStateVector(ef, sc);
-    this.svBuilder.defineHistoryVector(ef, sc);
-    this.behaviorMapping.mapEntryActions(sc, ef);
-    this.behaviorMapping.mapExitActions(sc, ef);
-    this.seqBuilder.defineStateEnterSequences(ef, sc);
-    this.seqBuilder.defineStateExitSequences(ef, sc);
-    this.seqBuilder.defineDeepEnterSequences(ef, sc);
-    this.seqBuilder.defineShallowEnterSequences(ef, sc);
-    this.seqBuilder.defineStatechartEnterSequence(ef, sc);
-    this.seqBuilder.defineStatechartExitSequence(ef, sc);
-    this.behaviorMapping.mapTransitions(sc, ef);
-    this.behaviorMapping.mapLocalReactions(sc, ef);
-    this.behaviorMapping.mapChoiceTransitions(sc, ef);
-    this.reactBuilder.defineEntryReactions(sc, ef);
-    this.reactBuilder.defineRegularStateReactions(ef, sc);
-    this.reactBuilder.definePseudoStateReactions(ef, sc);
-    this.reactBuilder.defineStatechartReaction(ef, sc);
-    this.retargetDeclRefs(ef);
-    return ef;
-  }
-  
-  /**
-   * retarget declaration refs
-   */
-  public void retargetDeclRefs(final ExecutionFlow flow) {
-    final List<EObject> allContent = EcoreUtil2.eAllContentsAsList(flow);
-    final Function1<EObject,Boolean> _function = new Function1<EObject,Boolean>() {
-        public Boolean apply(final EObject e) {
-          boolean _or = false;
-          boolean _or_1 = false;
-          if ((e instanceof EventDefinition)) {
-            _or_1 = true;
-          } else {
-            _or_1 = ((e instanceof EventDefinition) || (e instanceof VariableDefinition));
-          }
-          if (_or_1) {
-            _or = true;
-          } else {
-            _or = (_or_1 || (e instanceof OperationDefinition));
-          }
-          return Boolean.valueOf(_or);
-        }
-      };
-    Iterable<EObject> _filter = IterableExtensions.<EObject>filter(allContent, _function);
-    final Set<EObject> declared = IterableExtensions.<EObject>toSet(_filter);
-    Iterable<ElementReferenceExpression> _filter_1 = Iterables.<ElementReferenceExpression>filter(allContent, ElementReferenceExpression.class);
-    final Procedure1<ElementReferenceExpression> _function_1 = new Procedure1<ElementReferenceExpression>() {
-        public void apply(final ElementReferenceExpression ere) {
-          ModelSequencer.this.retarget(ere, declared);
-        }
-      };
-    IterableExtensions.<ElementReferenceExpression>forEach(_filter_1, _function_1);
-    Iterable<FeatureCall> _filter_2 = Iterables.<FeatureCall>filter(allContent, FeatureCall.class);
-    final Procedure1<FeatureCall> _function_2 = new Procedure1<FeatureCall>() {
-        public void apply(final FeatureCall call) {
-          ModelSequencer.this.retarget(call, declared);
-        }
-      };
-    IterableExtensions.<FeatureCall>forEach(_filter_2, _function_2);
-  }
-  
-  public void retarget(final ElementReferenceExpression ere, final Collection<EObject> declared) {
-    boolean _and = false;
-    EObject _reference = ere.getReference();
-    boolean _notEquals = (!Objects.equal(_reference, null));
-    if (!_notEquals) {
-      _and = false;
-    } else {
-      EObject _reference_1 = ere.getReference();
-      boolean _contains = declared.contains(_reference_1);
-      boolean _not = (!_contains);
-      _and = (_notEquals && _not);
-    }
-    if (_and) {
-      EObject _reference_2 = ere.getReference();
-      final Declaration r = this.replaced(_reference_2);
-      boolean _notEquals_1 = (!Objects.equal(r, null));
-      if (_notEquals_1) {
-        ere.setReference(r);
-      }
-    }
-  }
-  
-  public void retarget(final FeatureCall call, final Collection<EObject> declared) {
-    boolean _and = false;
-    EObject _feature = call.getFeature();
-    boolean _notEquals = (!Objects.equal(_feature, null));
-    if (!_notEquals) {
-      _and = false;
-    } else {
-      EObject _feature_1 = call.getFeature();
-      boolean _contains = declared.contains(_feature_1);
-      boolean _not = (!_contains);
-      _and = (_notEquals && _not);
-    }
-    if (_and) {
-      EObject _feature_2 = call.getFeature();
-      final Declaration r = this.replaced(_feature_2);
-      boolean _notEquals_1 = (!Objects.equal(r, null));
-      if (_notEquals_1) {
-        call.setFeature(((Feature) r));
-      }
-    }
-  }
-  
-  protected Declaration _replaced(final EObject ne) {
-    Declaration _xblockexpression = null;
-    {
-      try {
-        Comparable<? extends Object> _xifexpression = null;
-        boolean _equals = Objects.equal(ne, null);
-        if (_equals) {
-          _xifexpression = "null";
-        } else {
-          QualifiedName _fullyQualifiedName = this.qfnProvider.getFullyQualifiedName(ne);
-          _xifexpression = _fullyQualifiedName;
-        }
-        String _plus = ("Replace with unknown eObject called: " + _xifexpression);
-        InputOutput.<String>println(_plus);
-        Log _log = LogFactory.getLog(ModelSequencer.class);
-        Comparable<? extends Object> _xifexpression_1 = null;
-        boolean _equals_1 = Objects.equal(ne, null);
-        if (_equals_1) {
-          _xifexpression_1 = "null";
-        } else {
-          QualifiedName _fullyQualifiedName_1 = this.qfnProvider.getFullyQualifiedName(ne);
-          _xifexpression_1 = _fullyQualifiedName_1;
-        }
-        String _plus_1 = ("Replace with unknown NamedElement called: " + _xifexpression_1);
-        _log.error(_plus_1);
-      } catch (final Throwable _t) {
-        if (_t instanceof LogConfigurationException) {
-          final LogConfigurationException e = (LogConfigurationException)_t;
-          e.printStackTrace();
-          Comparable<? extends Object> _xifexpression_2 = null;
-          boolean _equals_2 = Objects.equal(ne, null);
-          if (_equals_2) {
-            _xifexpression_2 = "null";
-          } else {
-            QualifiedName _fullyQualifiedName_2 = this.qfnProvider.getFullyQualifiedName(ne);
-            _xifexpression_2 = _fullyQualifiedName_2;
-          }
-          String _plus_2 = ("Replace with unknown NamedElement called: " + _xifexpression_2);
-          InputOutput.<String>println(_plus_2);
-        } else {
-          throw Exceptions.sneakyThrow(_t);
-        }
-      }
-      _xblockexpression = (null);
-    }
-    return _xblockexpression;
-  }
-  
-  protected Declaration _replaced(final VariableDefinition vd) {
-    VariableDefinition _create = this.mapping.create(vd);
-    return _create;
-  }
-  
-  protected Declaration _replaced(final OperationDefinition vd) {
-    OperationDefinition _create = this.mapping.create(vd);
-    return _create;
-  }
-  
-  protected Declaration _replaced(final EventDefinition ed) {
-    EventDefinition _create = this.mapping.create(ed);
-    return _create;
-  }
-  
-  protected Declaration _replaced(final TimeEvent ed) {
-    return ed;
-  }
-  
-  public Declaration replaced(final EObject ed) {
-    if (ed instanceof TimeEvent) {
-      return _replaced((TimeEvent)ed);
-    } else if (ed instanceof EventDefinition) {
-      return _replaced((EventDefinition)ed);
-    } else if (ed instanceof OperationDefinition) {
-      return _replaced((OperationDefinition)ed);
-    } else if (ed instanceof VariableDefinition) {
-      return _replaced((VariableDefinition)ed);
-    } else if (ed != null) {
-      return _replaced(ed);
-    } else {
-      throw new IllegalArgumentException("Unhandled parameter types: " +
-        Arrays.<Object>asList(ed).toString());
-    }
-  }
-}
+package org.yakindu.sct.model.sexec.transformation;
+
+import com.google.common.base.Objects;
+import com.google.common.collect.Iterables;
+import com.google.inject.Inject;
+import java.util.Arrays;
+import java.util.Collection;
+import java.util.List;
+import java.util.Set;
+import org.apache.commons.logging.Log;
+import org.apache.commons.logging.LogConfigurationException;
+import org.apache.commons.logging.LogFactory;
+import org.eclipse.emf.ecore.EObject;
+import org.eclipse.xtext.EcoreUtil2;
+import org.eclipse.xtext.naming.IQualifiedNameProvider;
+import org.eclipse.xtext.naming.QualifiedName;
+import org.eclipse.xtext.xbase.lib.Exceptions;
+import org.eclipse.xtext.xbase.lib.Functions.Function1;
+import org.eclipse.xtext.xbase.lib.InputOutput;
+import org.eclipse.xtext.xbase.lib.IterableExtensions;
+import org.eclipse.xtext.xbase.lib.Procedures.Procedure1;
+import org.yakindu.base.types.Feature;
+import org.yakindu.sct.model.sexec.ExecutionFlow;
+import org.yakindu.sct.model.sexec.TimeEvent;
+import org.yakindu.sct.model.sexec.transformation.BehaviorMapping;
+import org.yakindu.sct.model.sexec.transformation.ReactionBuilder;
+import org.yakindu.sct.model.sexec.transformation.SequenceBuilder;
+import org.yakindu.sct.model.sexec.transformation.SexecElementMapping;
+import org.yakindu.sct.model.sexec.transformation.StateVectorBuilder;
+import org.yakindu.sct.model.sexec.transformation.StructureMapping;
+import org.yakindu.sct.model.sgraph.Declaration;
+import org.yakindu.sct.model.sgraph.Statechart;
+import org.yakindu.sct.model.stext.stext.ElementReferenceExpression;
+import org.yakindu.sct.model.stext.stext.EventDefinition;
+import org.yakindu.sct.model.stext.stext.FeatureCall;
+import org.yakindu.sct.model.stext.stext.OperationDefinition;
+import org.yakindu.sct.model.stext.stext.VariableDefinition;
+
+@SuppressWarnings("all")
+public class ModelSequencer {
+  @Inject
+  private IQualifiedNameProvider qfnProvider;
+  
+  @Inject
+  private SexecElementMapping mapping;
+  
+  @Inject
+  private StructureMapping structureMapping;
+  
+  @Inject
+  private BehaviorMapping behaviorMapping;
+  
+  @Inject
+  private ReactionBuilder reactBuilder;
+  
+  @Inject
+  private SequenceBuilder seqBuilder;
+  
+  @Inject
+  private StateVectorBuilder svBuilder;
+  
+  /**
+   * ==========================================================================
+   * TRANSFORMATION ROOT
+   */
+  public ExecutionFlow transform(final Statechart sc) {
+    final ExecutionFlow ef = this.mapping.create(sc);
+    this.structureMapping.mapScopes(sc, ef);
+    this.structureMapping.mapRegularStates(sc, ef);
+    this.structureMapping.mapRegions(sc, ef);
+    this.structureMapping.mapPseudoStates(sc, ef);
+    this.structureMapping.mapTimeEvents(sc, ef);
+    this.svBuilder.defineStateVector(ef, sc);
+    this.svBuilder.defineHistoryVector(ef, sc);
+    this.behaviorMapping.mapEntryActions(sc, ef);
+    this.behaviorMapping.mapExitActions(sc, ef);
+    this.seqBuilder.defineStateEnterSequences(ef, sc);
+    this.seqBuilder.defineStateExitSequences(ef, sc);
+    this.seqBuilder.defineDeepEnterSequences(ef, sc);
+    this.seqBuilder.defineShallowEnterSequences(ef, sc);
+    this.seqBuilder.defineStatechartEnterSequence(ef, sc);
+    this.seqBuilder.defineStatechartExitSequence(ef, sc);
+    this.behaviorMapping.mapTransitions(sc, ef);
+    this.behaviorMapping.mapLocalReactions(sc, ef);
+    this.behaviorMapping.mapChoiceTransitions(sc, ef);
+    this.reactBuilder.defineEntryReactions(sc, ef);
+    this.reactBuilder.defineRegularStateReactions(ef, sc);
+    this.reactBuilder.definePseudoStateReactions(ef, sc);
+    this.reactBuilder.defineStatechartReaction(ef, sc);
+    this.retargetDeclRefs(ef);
+    return ef;
+  }
+  
+  /**
+   * retarget declaration refs
+   */
+  public void retargetDeclRefs(final ExecutionFlow flow) {
+    final List<EObject> allContent = EcoreUtil2.eAllContentsAsList(flow);
+    final Function1<EObject,Boolean> _function = new Function1<EObject,Boolean>() {
+        public Boolean apply(final EObject e) {
+          boolean _or = false;
+          boolean _or_1 = false;
+          if ((e instanceof EventDefinition)) {
+            _or_1 = true;
+          } else {
+            _or_1 = ((e instanceof EventDefinition) || (e instanceof VariableDefinition));
+          }
+          if (_or_1) {
+            _or = true;
+          } else {
+            _or = (_or_1 || (e instanceof OperationDefinition));
+          }
+          return Boolean.valueOf(_or);
+        }
+      };
+    Iterable<EObject> _filter = IterableExtensions.<EObject>filter(allContent, _function);
+    final Set<EObject> declared = IterableExtensions.<EObject>toSet(_filter);
+    Iterable<ElementReferenceExpression> _filter_1 = Iterables.<ElementReferenceExpression>filter(allContent, ElementReferenceExpression.class);
+    final Procedure1<ElementReferenceExpression> _function_1 = new Procedure1<ElementReferenceExpression>() {
+        public void apply(final ElementReferenceExpression ere) {
+          ModelSequencer.this.retarget(ere, declared);
+        }
+      };
+    IterableExtensions.<ElementReferenceExpression>forEach(_filter_1, _function_1);
+    Iterable<FeatureCall> _filter_2 = Iterables.<FeatureCall>filter(allContent, FeatureCall.class);
+    final Procedure1<FeatureCall> _function_2 = new Procedure1<FeatureCall>() {
+        public void apply(final FeatureCall call) {
+          ModelSequencer.this.retarget(call, declared);
+        }
+      };
+    IterableExtensions.<FeatureCall>forEach(_filter_2, _function_2);
+  }
+  
+  public void retarget(final ElementReferenceExpression ere, final Collection<EObject> declared) {
+    boolean _and = false;
+    EObject _reference = ere.getReference();
+    boolean _notEquals = (!Objects.equal(_reference, null));
+    if (!_notEquals) {
+      _and = false;
+    } else {
+      EObject _reference_1 = ere.getReference();
+      boolean _contains = declared.contains(_reference_1);
+      boolean _not = (!_contains);
+      _and = (_notEquals && _not);
+    }
+    if (_and) {
+      EObject _reference_2 = ere.getReference();
+      final Declaration r = this.replaced(_reference_2);
+      boolean _notEquals_1 = (!Objects.equal(r, null));
+      if (_notEquals_1) {
+        ere.setReference(r);
+      }
+    }
+  }
+  
+  public void retarget(final FeatureCall call, final Collection<EObject> declared) {
+    boolean _and = false;
+    EObject _feature = call.getFeature();
+    boolean _notEquals = (!Objects.equal(_feature, null));
+    if (!_notEquals) {
+      _and = false;
+    } else {
+      EObject _feature_1 = call.getFeature();
+      boolean _contains = declared.contains(_feature_1);
+      boolean _not = (!_contains);
+      _and = (_notEquals && _not);
+    }
+    if (_and) {
+      EObject _feature_2 = call.getFeature();
+      final Declaration r = this.replaced(_feature_2);
+      boolean _notEquals_1 = (!Objects.equal(r, null));
+      if (_notEquals_1) {
+        call.setFeature(((Feature) r));
+      }
+    }
+  }
+  
+  protected Declaration _replaced(final EObject ne) {
+    Declaration _xblockexpression = null;
+    {
+      try {
+        Comparable<? extends Object> _xifexpression = null;
+        boolean _equals = Objects.equal(ne, null);
+        if (_equals) {
+          _xifexpression = "null";
+        } else {
+          QualifiedName _fullyQualifiedName = this.qfnProvider.getFullyQualifiedName(ne);
+          _xifexpression = _fullyQualifiedName;
+        }
+        String _plus = ("Replace with unknown eObject called: " + _xifexpression);
+        InputOutput.<String>println(_plus);
+        Log _log = LogFactory.getLog(ModelSequencer.class);
+        Comparable<? extends Object> _xifexpression_1 = null;
+        boolean _equals_1 = Objects.equal(ne, null);
+        if (_equals_1) {
+          _xifexpression_1 = "null";
+        } else {
+          QualifiedName _fullyQualifiedName_1 = this.qfnProvider.getFullyQualifiedName(ne);
+          _xifexpression_1 = _fullyQualifiedName_1;
+        }
+        String _plus_1 = ("Replace with unknown NamedElement called: " + _xifexpression_1);
+        _log.error(_plus_1);
+      } catch (final Throwable _t) {
+        if (_t instanceof LogConfigurationException) {
+          final LogConfigurationException e = (LogConfigurationException)_t;
+          e.printStackTrace();
+          Comparable<? extends Object> _xifexpression_2 = null;
+          boolean _equals_2 = Objects.equal(ne, null);
+          if (_equals_2) {
+            _xifexpression_2 = "null";
+          } else {
+            QualifiedName _fullyQualifiedName_2 = this.qfnProvider.getFullyQualifiedName(ne);
+            _xifexpression_2 = _fullyQualifiedName_2;
+          }
+          String _plus_2 = ("Replace with unknown NamedElement called: " + _xifexpression_2);
+          InputOutput.<String>println(_plus_2);
+        } else {
+          throw Exceptions.sneakyThrow(_t);
+        }
+      }
+      _xblockexpression = (null);
+    }
+    return _xblockexpression;
+  }
+  
+  protected Declaration _replaced(final VariableDefinition vd) {
+    VariableDefinition _create = this.mapping.create(vd);
+    return _create;
+  }
+  
+  protected Declaration _replaced(final OperationDefinition vd) {
+    OperationDefinition _create = this.mapping.create(vd);
+    return _create;
+  }
+  
+  protected Declaration _replaced(final EventDefinition ed) {
+    EventDefinition _create = this.mapping.create(ed);
+    return _create;
+  }
+  
+  protected Declaration _replaced(final TimeEvent ed) {
+    return ed;
+  }
+  
+  public Declaration replaced(final EObject ed) {
+    if (ed instanceof TimeEvent) {
+      return _replaced((TimeEvent)ed);
+    } else if (ed instanceof EventDefinition) {
+      return _replaced((EventDefinition)ed);
+    } else if (ed instanceof OperationDefinition) {
+      return _replaced((OperationDefinition)ed);
+    } else if (ed instanceof VariableDefinition) {
+      return _replaced((VariableDefinition)ed);
+    } else if (ed != null) {
+      return _replaced(ed);
+    } else {
+      throw new IllegalArgumentException("Unhandled parameter types: " +
+        Arrays.<Object>asList(ed).toString());
+    }
+  }
+}

A diferenza do arquivo foi suprimida porque é demasiado grande
+ 541 - 541
plugins/org.yakindu.sct.model.sexec/xtend-gen/org/yakindu/sct/model/sexec/transformation/ReactionBuilder.java


A diferenza do arquivo foi suprimida porque é demasiado grande
+ 875 - 875
plugins/org.yakindu.sct.model.sexec/xtend-gen/org/yakindu/sct/model/sexec/transformation/SequenceBuilder.java


A diferenza do arquivo foi suprimida porque é demasiado grande
+ 786 - 786
plugins/org.yakindu.sct.model.sexec/xtend-gen/org/yakindu/sct/model/sexec/transformation/SexecElementMapping.java


+ 145 - 145
plugins/org.yakindu.sct.model.sexec/xtend-gen/org/yakindu/sct/model/sexec/transformation/SexecExtensions.java

@@ -1,145 +1,145 @@
-package org.yakindu.sct.model.sexec.transformation;
-
-import com.google.common.base.Objects;
-import java.util.ArrayList;
-import java.util.Arrays;
-import java.util.List;
-import org.eclipse.emf.common.util.EList;
-import org.eclipse.xtext.xbase.lib.CollectionLiterals;
-import org.yakindu.sct.model.sexec.EnterState;
-import org.yakindu.sct.model.sexec.ExecutionRegion;
-import org.yakindu.sct.model.sexec.ExecutionScope;
-import org.yakindu.sct.model.sexec.ExecutionState;
-import org.yakindu.sct.model.sexec.ExitState;
-import org.yakindu.sct.model.sexec.SaveHistory;
-import org.yakindu.sct.model.sexec.SexecFactory;
-import org.yakindu.sct.model.sexec.StateCase;
-import org.yakindu.sct.model.sexec.StateVector;
-import org.yakindu.sct.model.sexec.Step;
-
-@SuppressWarnings("all")
-public class SexecExtensions {
-  public SexecFactory factory() {
-    return SexecFactory.eINSTANCE;
-  }
-  
-  public EnterState newEnterStateStep(final ExecutionState s) {
-    EnterState ess = null;
-    boolean _notEquals = (!Objects.equal(s, null));
-    if (_notEquals) {
-      SexecFactory _factory = this.factory();
-      EnterState _createEnterState = _factory.createEnterState();
-      ess = _createEnterState;
-      ess.setState(s);
-    }
-    return ess;
-  }
-  
-  public ExitState newExitStateStep(final ExecutionState s) {
-    ExitState ess = null;
-    boolean _notEquals = (!Objects.equal(s, null));
-    if (_notEquals) {
-      SexecFactory _factory = this.factory();
-      ExitState _createExitState = _factory.createExitState();
-      ess = _createExitState;
-      ess.setState(s);
-    }
-    return ess;
-  }
-  
-  public StateCase newCase(final ExecutionState it, final Step step) {
-    SexecFactory _factory = this.factory();
-    final StateCase sCase = _factory.createStateCase();
-    sCase.setState(it);
-    sCase.setStep(step);
-    return sCase;
-  }
-  
-  public SaveHistory newSaveHistory(final ExecutionRegion r) {
-    SexecFactory _factory = this.factory();
-    final SaveHistory save = _factory.createSaveHistory();
-    save.setRegion(r);
-    return save;
-  }
-  
-  protected List<ExecutionState> _collectLeafStates(final ExecutionState state, final List<ExecutionState> leafStates) {
-    boolean _isLeaf = state.isLeaf();
-    if (_isLeaf) {
-      leafStates.add(state);
-    } else {
-      EList<ExecutionScope> _subScopes = state.getSubScopes();
-      for (final ExecutionScope r : _subScopes) {
-        this.collectLeafStates(r, leafStates);
-      }
-    }
-    return leafStates;
-  }
-  
-  protected List<ExecutionState> _collectLeafStates(final ExecutionRegion region, final List<ExecutionState> leafStates) {
-    EList<ExecutionScope> _subScopes = region.getSubScopes();
-    for (final ExecutionScope r : _subScopes) {
-      this.collectLeafStates(r, leafStates);
-    }
-    return leafStates;
-  }
-  
-  public int last(final StateVector sv) {
-    int _offset = sv.getOffset();
-    int _size = sv.getSize();
-    int _plus = (_offset + _size);
-    int _minus = (_plus - 1);
-    return _minus;
-  }
-  
-  public int first(final StateVector sv) {
-    int _offset = sv.getOffset();
-    return _offset;
-  }
-  
-  public ArrayList<ExecutionScope> parentScopes(final ExecutionScope scope) {
-    final ArrayList<ExecutionScope> parents = CollectionLiterals.<ExecutionScope>newArrayList();
-    ExecutionScope s = scope;
-    boolean _notEquals = (!Objects.equal(s, null));
-    boolean _while = _notEquals;
-    while (_while) {
-      {
-        parents.add(s);
-        ExecutionScope _superScope = s.getSuperScope();
-        s = _superScope;
-      }
-      boolean _notEquals_1 = (!Objects.equal(s, null));
-      _while = _notEquals_1;
-    }
-    return parents;
-  }
-  
-  /**
-   * Collect all scopes beneath this scope which does not contain subscopes and are instances of ExecutionState.
-   */
-  public List<ExecutionState> collectLeafScopes(final ExecutionScope scope, final List<ExecutionState> leafs) {
-    EList<ExecutionScope> _subScopes = scope.getSubScopes();
-    boolean _isEmpty = _subScopes.isEmpty();
-    if (_isEmpty) {
-      if ((scope instanceof ExecutionState)) {
-        leafs.add(((ExecutionState) scope));
-      }
-    } else {
-      EList<ExecutionScope> _subScopes_1 = scope.getSubScopes();
-      for (final ExecutionScope s : _subScopes_1) {
-        this.collectLeafScopes(s, leafs);
-      }
-    }
-    return leafs;
-  }
-  
-  public List<ExecutionState> collectLeafStates(final ExecutionScope region, final List<ExecutionState> leafStates) {
-    if (region instanceof ExecutionRegion) {
-      return _collectLeafStates((ExecutionRegion)region, leafStates);
-    } else if (region instanceof ExecutionState) {
-      return _collectLeafStates((ExecutionState)region, leafStates);
-    } else {
-      throw new IllegalArgumentException("Unhandled parameter types: " +
-        Arrays.<Object>asList(region, leafStates).toString());
-    }
-  }
-}
+package org.yakindu.sct.model.sexec.transformation;
+
+import com.google.common.base.Objects;
+import java.util.ArrayList;
+import java.util.Arrays;
+import java.util.List;
+import org.eclipse.emf.common.util.EList;
+import org.eclipse.xtext.xbase.lib.CollectionLiterals;
+import org.yakindu.sct.model.sexec.EnterState;
+import org.yakindu.sct.model.sexec.ExecutionRegion;
+import org.yakindu.sct.model.sexec.ExecutionScope;
+import org.yakindu.sct.model.sexec.ExecutionState;
+import org.yakindu.sct.model.sexec.ExitState;
+import org.yakindu.sct.model.sexec.SaveHistory;
+import org.yakindu.sct.model.sexec.SexecFactory;
+import org.yakindu.sct.model.sexec.StateCase;
+import org.yakindu.sct.model.sexec.StateVector;
+import org.yakindu.sct.model.sexec.Step;
+
+@SuppressWarnings("all")
+public class SexecExtensions {
+  public SexecFactory factory() {
+    return SexecFactory.eINSTANCE;
+  }
+  
+  public EnterState newEnterStateStep(final ExecutionState s) {
+    EnterState ess = null;
+    boolean _notEquals = (!Objects.equal(s, null));
+    if (_notEquals) {
+      SexecFactory _factory = this.factory();
+      EnterState _createEnterState = _factory.createEnterState();
+      ess = _createEnterState;
+      ess.setState(s);
+    }
+    return ess;
+  }
+  
+  public ExitState newExitStateStep(final ExecutionState s) {
+    ExitState ess = null;
+    boolean _notEquals = (!Objects.equal(s, null));
+    if (_notEquals) {
+      SexecFactory _factory = this.factory();
+      ExitState _createExitState = _factory.createExitState();
+      ess = _createExitState;
+      ess.setState(s);
+    }
+    return ess;
+  }
+  
+  public StateCase newCase(final ExecutionState it, final Step step) {
+    SexecFactory _factory = this.factory();
+    final StateCase sCase = _factory.createStateCase();
+    sCase.setState(it);
+    sCase.setStep(step);
+    return sCase;
+  }
+  
+  public SaveHistory newSaveHistory(final ExecutionRegion r) {
+    SexecFactory _factory = this.factory();
+    final SaveHistory save = _factory.createSaveHistory();
+    save.setRegion(r);
+    return save;
+  }
+  
+  protected List<ExecutionState> _collectLeafStates(final ExecutionState state, final List<ExecutionState> leafStates) {
+    boolean _isLeaf = state.isLeaf();
+    if (_isLeaf) {
+      leafStates.add(state);
+    } else {
+      EList<ExecutionScope> _subScopes = state.getSubScopes();
+      for (final ExecutionScope r : _subScopes) {
+        this.collectLeafStates(r, leafStates);
+      }
+    }
+    return leafStates;
+  }
+  
+  protected List<ExecutionState> _collectLeafStates(final ExecutionRegion region, final List<ExecutionState> leafStates) {
+    EList<ExecutionScope> _subScopes = region.getSubScopes();
+    for (final ExecutionScope r : _subScopes) {
+      this.collectLeafStates(r, leafStates);
+    }
+    return leafStates;
+  }
+  
+  public int last(final StateVector sv) {
+    int _offset = sv.getOffset();
+    int _size = sv.getSize();
+    int _plus = (_offset + _size);
+    int _minus = (_plus - 1);
+    return _minus;
+  }
+  
+  public int first(final StateVector sv) {
+    int _offset = sv.getOffset();
+    return _offset;
+  }
+  
+  public ArrayList<ExecutionScope> parentScopes(final ExecutionScope scope) {
+    final ArrayList<ExecutionScope> parents = CollectionLiterals.<ExecutionScope>newArrayList();
+    ExecutionScope s = scope;
+    boolean _notEquals = (!Objects.equal(s, null));
+    boolean _while = _notEquals;
+    while (_while) {
+      {
+        parents.add(s);
+        ExecutionScope _superScope = s.getSuperScope();
+        s = _superScope;
+      }
+      boolean _notEquals_1 = (!Objects.equal(s, null));
+      _while = _notEquals_1;
+    }
+    return parents;
+  }
+  
+  /**
+   * Collect all scopes beneath this scope which does not contain subscopes and are instances of ExecutionState.
+   */
+  public List<ExecutionState> collectLeafScopes(final ExecutionScope scope, final List<ExecutionState> leafs) {
+    EList<ExecutionScope> _subScopes = scope.getSubScopes();
+    boolean _isEmpty = _subScopes.isEmpty();
+    if (_isEmpty) {
+      if ((scope instanceof ExecutionState)) {
+        leafs.add(((ExecutionState) scope));
+      }
+    } else {
+      EList<ExecutionScope> _subScopes_1 = scope.getSubScopes();
+      for (final ExecutionScope s : _subScopes_1) {
+        this.collectLeafScopes(s, leafs);
+      }
+    }
+    return leafs;
+  }
+  
+  public List<ExecutionState> collectLeafStates(final ExecutionScope region, final List<ExecutionState> leafStates) {
+    if (region instanceof ExecutionRegion) {
+      return _collectLeafStates((ExecutionRegion)region, leafStates);
+    } else if (region instanceof ExecutionState) {
+      return _collectLeafStates((ExecutionState)region, leafStates);
+    } else {
+      throw new IllegalArgumentException("Unhandled parameter types: " +
+        Arrays.<Object>asList(region, leafStates).toString());
+    }
+  }
+}

+ 236 - 236
plugins/org.yakindu.sct.model.sexec/xtend-gen/org/yakindu/sct/model/sexec/transformation/SgraphExtensions.java

@@ -1,236 +1,236 @@
-package org.yakindu.sct.model.sexec.transformation;
-
-import com.google.common.base.Objects;
-import com.google.common.collect.Iterables;
-import java.util.ArrayList;
-import java.util.Arrays;
-import java.util.List;
-import org.eclipse.emf.common.util.EList;
-import org.eclipse.emf.ecore.EObject;
-import org.eclipse.xtext.xbase.lib.Functions.Function1;
-import org.eclipse.xtext.xbase.lib.IterableExtensions;
-import org.yakindu.sct.model.sgraph.Entry;
-import org.yakindu.sct.model.sgraph.EntryKind;
-import org.yakindu.sct.model.sgraph.FinalState;
-import org.yakindu.sct.model.sgraph.Region;
-import org.yakindu.sct.model.sgraph.RegularState;
-import org.yakindu.sct.model.sgraph.SGraphFactory;
-import org.yakindu.sct.model.sgraph.State;
-import org.yakindu.sct.model.sgraph.Transition;
-import org.yakindu.sct.model.sgraph.Vertex;
-
-@SuppressWarnings("all")
-public class SgraphExtensions {
-  public SGraphFactory factory() {
-    return SGraphFactory.eINSTANCE;
-  }
-  
-  protected boolean _isLeaf(final RegularState s) {
-    return false;
-  }
-  
-  protected boolean _isLeaf(final FinalState s) {
-    return true;
-  }
-  
-  protected boolean _isLeaf(final State s) {
-    boolean _isSimple = s.isSimple();
-    return _isSimple;
-  }
-  
-  public List<RegularState> parentStates(final RegularState s) {
-    List<EObject> _containers = this.containers(s);
-    Iterable<RegularState> _filter = Iterables.<RegularState>filter(_containers, RegularState.class);
-    List<RegularState> _list = IterableExtensions.<RegularState>toList(_filter);
-    return _list;
-  }
-  
-  public List<RegularState> parentStates(final Region s) {
-    List<EObject> _containers = this.containers(s);
-    Iterable<RegularState> _filter = Iterables.<RegularState>filter(_containers, RegularState.class);
-    List<RegularState> _list = IterableExtensions.<RegularState>toList(_filter);
-    return _list;
-  }
-  
-  public List<EObject> containers(final EObject obj) {
-    ArrayList<EObject> _arrayList = new ArrayList<EObject>();
-    final ArrayList<EObject> containerList = _arrayList;
-    this.collectContainers(obj, containerList);
-    return containerList;
-  }
-  
-  public void collectContainers(final EObject obj, final List<EObject> containerList) {
-    containerList.add(obj);
-    EObject _eContainer = obj==null?(EObject)null:obj.eContainer();
-    boolean _notEquals = (!Objects.equal(_eContainer, null));
-    if (_notEquals) {
-      EObject _eContainer_1 = obj.eContainer();
-      this.collectContainers(_eContainer_1, containerList);
-    }
-  }
-  
-  public Iterable<Entry> collectEntries(final Region r) {
-    EList<Vertex> _vertices = r.getVertices();
-    Iterable<Entry> _filter = Iterables.<Entry>filter(_vertices, Entry.class);
-    return _filter;
-  }
-  
-  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 _and = false;
-          if (!(v instanceof Entry)) {
-            _and = false;
-          } else {
-            boolean _or = false;
-            boolean _or_1 = false;
-            String _name = v.getName();
-            boolean _equals = Objects.equal(_name, null);
-            if (_equals) {
-              _or_1 = true;
-            } else {
-              String _name_1 = v.getName();
-              boolean _equals_1 = "".equals(_name_1);
-              _or_1 = (_equals || _equals_1);
-            }
-            if (_or_1) {
-              _or = true;
-            } else {
-              String _name_2 = v.getName();
-              boolean _equals_2 = Objects.equal(_name_2, "default");
-              _or = (_or_1 || _equals_2);
-            }
-            _and = ((v instanceof Entry) && _or);
-          }
-          return Boolean.valueOf(_and);
-        }
-      };
-    Vertex _findFirst = IterableExtensions.<Vertex>findFirst(_vertices, _function);
-    return ((Entry) _findFirst);
-  }
-  
-  /**
-   * Retrieves the target from an entry.
-   * TODO: validation of preconditions for entry targets e.g every region needs an entry with appropriate target
-   */
-  public State target(final Entry entry) {
-    State _xifexpression = null;
-    EList<Transition> _outgoingTransitions = entry==null?(EList<Transition>)null:entry.getOutgoingTransitions();
-    boolean _notEquals = (!Objects.equal(_outgoingTransitions, null));
-    if (_notEquals) {
-      State _xifexpression_1 = null;
-      EList<Transition> _outgoingTransitions_1 = entry.getOutgoingTransitions();
-      int _size = _outgoingTransitions_1.size();
-      boolean _greaterThan = (_size > 0);
-      if (_greaterThan) {
-        State _xblockexpression = null;
-        {
-          EList<Transition> _outgoingTransitions_2 = entry.getOutgoingTransitions();
-          Transition _get = _outgoingTransitions_2.get(0);
-          final Vertex target = _get.getTarget();
-          State _xifexpression_2 = null;
-          if ((target instanceof State)) {
-            _xifexpression_2 = ((State) target);
-          }
-          _xblockexpression = (_xifexpression_2);
-        }
-        _xifexpression_1 = _xblockexpression;
-      }
-      _xifexpression = _xifexpression_1;
-    }
-    return _xifexpression;
-  }
-  
-  public List<RegularState> collectLeafStates(final RegularState state, final List<RegularState> leafStates) {
-    boolean _isLeaf = this.isLeaf(state);
-    if (_isLeaf) {
-      leafStates.add(state);
-    } else {
-      if ((state instanceof State)) {
-        final State s = ((State) state);
-        EList<Region> _regions = s.getRegions();
-        for (final Region r : _regions) {
-          EList<Vertex> _vertices = r.getVertices();
-          for (final Vertex v : _vertices) {
-            if ((v instanceof RegularState)) {
-              this.collectLeafStates(((RegularState) v), leafStates);
-            }
-          }
-        }
-      }
-    }
-    return leafStates;
-  }
-  
-  public List<RegularState> collectLeafStates(final Region region, final List<RegularState> leafStates) {
-    EList<Vertex> _vertices = region.getVertices();
-    for (final Vertex v : _vertices) {
-      if ((v instanceof RegularState)) {
-        this.collectLeafStates(((RegularState) v), leafStates);
-      }
-    }
-    return leafStates;
-  }
-  
-  public boolean requireDeepHistory(final Region r) {
-    List<EObject> _containers = this.containers(r);
-    Iterable<Region> _filter = Iterables.<Region>filter(_containers, Region.class);
-    final Function1<Region,Boolean> _function = new Function1<Region,Boolean>() {
-        public Boolean apply(final Region p) {
-          EList<Vertex> _vertices = p.getVertices();
-          Iterable<Entry> _filter = Iterables.<Entry>filter(_vertices, Entry.class);
-          final Function1<Entry,Boolean> _function = new Function1<Entry,Boolean>() {
-              public Boolean apply(final Entry v) {
-                EntryKind _kind = v.getKind();
-                boolean _equals = Objects.equal(_kind, EntryKind.DEEP_HISTORY);
-                return Boolean.valueOf(_equals);
-              }
-            };
-          boolean _exists = IterableExtensions.<Entry>exists(_filter, _function);
-          return Boolean.valueOf(_exists);
-        }
-      };
-    boolean _exists = IterableExtensions.<Region>exists(_filter, _function);
-    return _exists;
-  }
-  
-  public boolean requireShallowHistory(final Region r) {
-    EList<Vertex> _vertices = r.getVertices();
-    Iterable<Entry> _filter = Iterables.<Entry>filter(_vertices, Entry.class);
-    final Function1<Entry,Boolean> _function = new Function1<Entry,Boolean>() {
-        public Boolean apply(final Entry v) {
-          EntryKind _kind = v.getKind();
-          boolean _equals = Objects.equal(_kind, EntryKind.SHALLOW_HISTORY);
-          return Boolean.valueOf(_equals);
-        }
-      };
-    boolean _exists = IterableExtensions.<Entry>exists(_filter, _function);
-    return _exists;
-  }
-  
-  public boolean requireHistory(final Region r) {
-    boolean _or = false;
-    boolean _requireDeepHistory = this.requireDeepHistory(r);
-    if (_requireDeepHistory) {
-      _or = true;
-    } else {
-      boolean _requireShallowHistory = this.requireShallowHistory(r);
-      _or = (_requireDeepHistory || _requireShallowHistory);
-    }
-    return _or;
-  }
-  
-  public boolean isLeaf(final RegularState s) {
-    if (s instanceof FinalState) {
-      return _isLeaf((FinalState)s);
-    } else if (s instanceof State) {
-      return _isLeaf((State)s);
-    } else if (s != null) {
-      return _isLeaf(s);
-    } else {
-      throw new IllegalArgumentException("Unhandled parameter types: " +
-        Arrays.<Object>asList(s).toString());
-    }
-  }
-}
+package org.yakindu.sct.model.sexec.transformation;
+
+import com.google.common.base.Objects;
+import com.google.common.collect.Iterables;
+import java.util.ArrayList;
+import java.util.Arrays;
+import java.util.List;
+import org.eclipse.emf.common.util.EList;
+import org.eclipse.emf.ecore.EObject;
+import org.eclipse.xtext.xbase.lib.Functions.Function1;
+import org.eclipse.xtext.xbase.lib.IterableExtensions;
+import org.yakindu.sct.model.sgraph.Entry;
+import org.yakindu.sct.model.sgraph.EntryKind;
+import org.yakindu.sct.model.sgraph.FinalState;
+import org.yakindu.sct.model.sgraph.Region;
+import org.yakindu.sct.model.sgraph.RegularState;
+import org.yakindu.sct.model.sgraph.SGraphFactory;
+import org.yakindu.sct.model.sgraph.State;
+import org.yakindu.sct.model.sgraph.Transition;
+import org.yakindu.sct.model.sgraph.Vertex;
+
+@SuppressWarnings("all")
+public class SgraphExtensions {
+  public SGraphFactory factory() {
+    return SGraphFactory.eINSTANCE;
+  }
+  
+  protected boolean _isLeaf(final RegularState s) {
+    return false;
+  }
+  
+  protected boolean _isLeaf(final FinalState s) {
+    return true;
+  }
+  
+  protected boolean _isLeaf(final State s) {
+    boolean _isSimple = s.isSimple();
+    return _isSimple;
+  }
+  
+  public List<RegularState> parentStates(final RegularState s) {
+    List<EObject> _containers = this.containers(s);
+    Iterable<RegularState> _filter = Iterables.<RegularState>filter(_containers, RegularState.class);
+    List<RegularState> _list = IterableExtensions.<RegularState>toList(_filter);
+    return _list;
+  }
+  
+  public List<RegularState> parentStates(final Region s) {
+    List<EObject> _containers = this.containers(s);
+    Iterable<RegularState> _filter = Iterables.<RegularState>filter(_containers, RegularState.class);
+    List<RegularState> _list = IterableExtensions.<RegularState>toList(_filter);
+    return _list;
+  }
+  
+  public List<EObject> containers(final EObject obj) {
+    ArrayList<EObject> _arrayList = new ArrayList<EObject>();
+    final ArrayList<EObject> containerList = _arrayList;
+    this.collectContainers(obj, containerList);
+    return containerList;
+  }
+  
+  public void collectContainers(final EObject obj, final List<EObject> containerList) {
+    containerList.add(obj);
+    EObject _eContainer = obj==null?(EObject)null:obj.eContainer();
+    boolean _notEquals = (!Objects.equal(_eContainer, null));
+    if (_notEquals) {
+      EObject _eContainer_1 = obj.eContainer();
+      this.collectContainers(_eContainer_1, containerList);
+    }
+  }
+  
+  public Iterable<Entry> collectEntries(final Region r) {
+    EList<Vertex> _vertices = r.getVertices();
+    Iterable<Entry> _filter = Iterables.<Entry>filter(_vertices, Entry.class);
+    return _filter;
+  }
+  
+  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 _and = false;
+          if (!(v instanceof Entry)) {
+            _and = false;
+          } else {
+            boolean _or = false;
+            boolean _or_1 = false;
+            String _name = v.getName();
+            boolean _equals = Objects.equal(_name, null);
+            if (_equals) {
+              _or_1 = true;
+            } else {
+              String _name_1 = v.getName();
+              boolean _equals_1 = "".equals(_name_1);
+              _or_1 = (_equals || _equals_1);
+            }
+            if (_or_1) {
+              _or = true;
+            } else {
+              String _name_2 = v.getName();
+              boolean _equals_2 = Objects.equal(_name_2, "default");
+              _or = (_or_1 || _equals_2);
+            }
+            _and = ((v instanceof Entry) && _or);
+          }
+          return Boolean.valueOf(_and);
+        }
+      };
+    Vertex _findFirst = IterableExtensions.<Vertex>findFirst(_vertices, _function);
+    return ((Entry) _findFirst);
+  }
+  
+  /**
+   * Retrieves the target from an entry.
+   * TODO: validation of preconditions for entry targets e.g every region needs an entry with appropriate target
+   */
+  public State target(final Entry entry) {
+    State _xifexpression = null;
+    EList<Transition> _outgoingTransitions = entry==null?(EList<Transition>)null:entry.getOutgoingTransitions();
+    boolean _notEquals = (!Objects.equal(_outgoingTransitions, null));
+    if (_notEquals) {
+      State _xifexpression_1 = null;
+      EList<Transition> _outgoingTransitions_1 = entry.getOutgoingTransitions();
+      int _size = _outgoingTransitions_1.size();
+      boolean _greaterThan = (_size > 0);
+      if (_greaterThan) {
+        State _xblockexpression = null;
+        {
+          EList<Transition> _outgoingTransitions_2 = entry.getOutgoingTransitions();
+          Transition _get = _outgoingTransitions_2.get(0);
+          final Vertex target = _get.getTarget();
+          State _xifexpression_2 = null;
+          if ((target instanceof State)) {
+            _xifexpression_2 = ((State) target);
+          }
+          _xblockexpression = (_xifexpression_2);
+        }
+        _xifexpression_1 = _xblockexpression;
+      }
+      _xifexpression = _xifexpression_1;
+    }
+    return _xifexpression;
+  }
+  
+  public List<RegularState> collectLeafStates(final RegularState state, final List<RegularState> leafStates) {
+    boolean _isLeaf = this.isLeaf(state);
+    if (_isLeaf) {
+      leafStates.add(state);
+    } else {
+      if ((state instanceof State)) {
+        final State s = ((State) state);
+        EList<Region> _regions = s.getRegions();
+        for (final Region r : _regions) {
+          EList<Vertex> _vertices = r.getVertices();
+          for (final Vertex v : _vertices) {
+            if ((v instanceof RegularState)) {
+              this.collectLeafStates(((RegularState) v), leafStates);
+            }
+          }
+        }
+      }
+    }
+    return leafStates;
+  }
+  
+  public List<RegularState> collectLeafStates(final Region region, final List<RegularState> leafStates) {
+    EList<Vertex> _vertices = region.getVertices();
+    for (final Vertex v : _vertices) {
+      if ((v instanceof RegularState)) {
+        this.collectLeafStates(((RegularState) v), leafStates);
+      }
+    }
+    return leafStates;
+  }
+  
+  public boolean requireDeepHistory(final Region r) {
+    List<EObject> _containers = this.containers(r);
+    Iterable<Region> _filter = Iterables.<Region>filter(_containers, Region.class);
+    final Function1<Region,Boolean> _function = new Function1<Region,Boolean>() {
+        public Boolean apply(final Region p) {
+          EList<Vertex> _vertices = p.getVertices();
+          Iterable<Entry> _filter = Iterables.<Entry>filter(_vertices, Entry.class);
+          final Function1<Entry,Boolean> _function = new Function1<Entry,Boolean>() {
+              public Boolean apply(final Entry v) {
+                EntryKind _kind = v.getKind();
+                boolean _equals = Objects.equal(_kind, EntryKind.DEEP_HISTORY);
+                return Boolean.valueOf(_equals);
+              }
+            };
+          boolean _exists = IterableExtensions.<Entry>exists(_filter, _function);
+          return Boolean.valueOf(_exists);
+        }
+      };
+    boolean _exists = IterableExtensions.<Region>exists(_filter, _function);
+    return _exists;
+  }
+  
+  public boolean requireShallowHistory(final Region r) {
+    EList<Vertex> _vertices = r.getVertices();
+    Iterable<Entry> _filter = Iterables.<Entry>filter(_vertices, Entry.class);
+    final Function1<Entry,Boolean> _function = new Function1<Entry,Boolean>() {
+        public Boolean apply(final Entry v) {
+          EntryKind _kind = v.getKind();
+          boolean _equals = Objects.equal(_kind, EntryKind.SHALLOW_HISTORY);
+          return Boolean.valueOf(_equals);
+        }
+      };
+    boolean _exists = IterableExtensions.<Entry>exists(_filter, _function);
+    return _exists;
+  }
+  
+  public boolean requireHistory(final Region r) {
+    boolean _or = false;
+    boolean _requireDeepHistory = this.requireDeepHistory(r);
+    if (_requireDeepHistory) {
+      _or = true;
+    } else {
+      boolean _requireShallowHistory = this.requireShallowHistory(r);
+      _or = (_requireDeepHistory || _requireShallowHistory);
+    }
+    return _or;
+  }
+  
+  public boolean isLeaf(final RegularState s) {
+    if (s instanceof FinalState) {
+      return _isLeaf((FinalState)s);
+    } else if (s instanceof State) {
+      return _isLeaf((State)s);
+    } else if (s != null) {
+      return _isLeaf(s);
+    } else {
+      throw new IllegalArgumentException("Unhandled parameter types: " +
+        Arrays.<Object>asList(s).toString());
+    }
+  }
+}

+ 239 - 239
plugins/org.yakindu.sct.model.sexec/xtend-gen/org/yakindu/sct/model/sexec/transformation/StateVectorBuilder.java

@@ -1,239 +1,239 @@
-package org.yakindu.sct.model.sexec.transformation;
-
-import com.google.common.collect.Iterators;
-import com.google.inject.Inject;
-import java.util.Arrays;
-import java.util.Iterator;
-import org.eclipse.emf.common.util.EList;
-import org.eclipse.emf.common.util.TreeIterator;
-import org.eclipse.emf.ecore.EObject;
-import org.eclipse.xtext.xbase.lib.Functions.Function2;
-import org.eclipse.xtext.xbase.lib.IterableExtensions;
-import org.eclipse.xtext.xbase.lib.IteratorExtensions;
-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.SexecFactory;
-import org.yakindu.sct.model.sexec.StateVector;
-import org.yakindu.sct.model.sexec.transformation.SexecElementMapping;
-import org.yakindu.sct.model.sexec.transformation.SexecExtensions;
-import org.yakindu.sct.model.sexec.transformation.SgraphExtensions;
-import org.yakindu.sct.model.sexec.transformation.StatechartExtensions;
-import org.yakindu.sct.model.sgraph.Choice;
-import org.yakindu.sct.model.sgraph.FinalState;
-import org.yakindu.sct.model.sgraph.Region;
-import org.yakindu.sct.model.sgraph.RegularState;
-import org.yakindu.sct.model.sgraph.State;
-import org.yakindu.sct.model.sgraph.Statechart;
-import org.yakindu.sct.model.sgraph.Vertex;
-
-@SuppressWarnings("all")
-public class StateVectorBuilder {
-  @Inject
-  private SexecExtensions sexec;
-  
-  @Inject
-  private SexecElementMapping mapping;
-  
-  @Inject
-  private StatechartExtensions sc;
-  
-  @Inject
-  private SgraphExtensions sgraph;
-  
-  public void defineHistoryVector(final ExecutionFlow flow, final Statechart sc) {
-    int offset = (-1);
-    TreeIterator<EObject> _eAllContents = sc.eAllContents();
-    Iterator<Region> _filter = Iterators.<Region>filter(_eAllContents, Region.class);
-    Iterable<Region> _iterable = IteratorExtensions.<Region>toIterable(_filter);
-    for (final Region r : _iterable) {
-      boolean _requireHistory = this.sgraph.requireHistory(r);
-      if (_requireHistory) {
-        int _plus = (offset + 1);
-        offset = _plus;
-        final ExecutionRegion er = this.mapping.create(r);
-        SexecFactory _factory = this.sexec.factory();
-        StateVector _createStateVector = _factory.createStateVector();
-        er.setHistoryVector(_createStateVector);
-        StateVector _historyVector = er.getHistoryVector();
-        _historyVector.setOffset(offset);
-        StateVector _historyVector_1 = er.getHistoryVector();
-        _historyVector_1.setSize(1);
-      }
-    }
-    int _minus = (-1);
-    boolean _notEquals = (offset != _minus);
-    if (_notEquals) {
-      SexecFactory _factory_1 = this.sexec.factory();
-      StateVector _createStateVector_1 = _factory_1.createStateVector();
-      flow.setHistoryVector(_createStateVector_1);
-      StateVector _historyVector_2 = flow.getHistoryVector();
-      _historyVector_2.setOffset(0);
-      StateVector _historyVector_3 = flow.getHistoryVector();
-      int _plus_1 = (offset + 1);
-      _historyVector_3.setSize(_plus_1);
-    }
-  }
-  
-  public void defineStateVector(final ExecutionFlow flow, final Statechart sc) {
-    int offset = 0;
-    EList<Region> _regions = sc.getRegions();
-    for (final Region r : _regions) {
-      int _defineStateVectors = this.defineStateVectors(r, offset);
-      int _plus = (offset + _defineStateVectors);
-      offset = _plus;
-    }
-    SexecFactory _factory = this.sexec.factory();
-    StateVector _createStateVector = _factory.createStateVector();
-    flow.setStateVector(_createStateVector);
-    StateVector _stateVector = flow.getStateVector();
-    _stateVector.setOffset(0);
-    StateVector _stateVector_1 = flow.getStateVector();
-    _stateVector_1.setSize(offset);
-  }
-  
-  /**
-   * calculates the maximum orthogonality (maximum number of possible active leaf states) of the statechart
-   */
-  public int defineStateVectors(final Statechart sc, final int offset) {
-    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 = StateVectorBuilder.this.sc.maxOrthogonality(r);
-          int _plus = (_maxOrthogonality + (o).intValue());
-          return Integer.valueOf(_plus);
-        }
-      };
-    Integer _fold = IterableExtensions.<Region, Integer>fold(_regions, Integer.valueOf(0), _function);
-    return (_fold).intValue();
-  }
-  
-  /**
-   * calculates the maximum orthogonality (maximum number of possible active leaf states) of a region
-   */
-  public int defineStateVectors(final Region r, final int offset) {
-    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;
-          {
-            final int mo = StateVectorBuilder.this.defineStateVectors(v, offset);
-            int _xifexpression = (int) 0;
-            boolean _greaterThan = (mo > (s).intValue());
-            if (_greaterThan) {
-              _xifexpression = mo;
-            } else {
-              _xifexpression = s;
-            }
-            _xblockexpression = (_xifexpression);
-          }
-          return Integer.valueOf(_xblockexpression);
-        }
-      };
-    final Integer maxOrthogonality = IterableExtensions.<Vertex, Integer>fold(_vertices, Integer.valueOf(0), _function);
-    final ExecutionRegion er = this.mapping.create(r);
-    SexecFactory _factory = this.sexec.factory();
-    StateVector _createStateVector = _factory.createStateVector();
-    er.setStateVector(_createStateVector);
-    StateVector _stateVector = er.getStateVector();
-    _stateVector.setOffset(offset);
-    StateVector _stateVector_1 = er.getStateVector();
-    _stateVector_1.setSize((maxOrthogonality).intValue());
-    return (maxOrthogonality).intValue();
-  }
-  
-  /**
-   * the maximum orthogonality of all  pseudo states is 0
-   */
-  protected int _defineStateVectors(final Vertex v, final int offset) {
-    return 0;
-  }
-  
-  /**
-   * calculates the maximum orthogonality (maximum number of possible active leaf states) of a state
-   */
-  protected int _defineStateVectors(final State s, final int offset) {
-    int maxOrthogonality = 0;
-    EList<Region> _regions = s.getRegions();
-    int _size = _regions.size();
-    boolean _greaterThan = (_size > 0);
-    if (_greaterThan) {
-      EList<Region> _regions_1 = s.getRegions();
-      for (final Region r : _regions_1) {
-        int _plus = (offset + maxOrthogonality);
-        int _defineStateVectors = this.defineStateVectors(r, _plus);
-        int _plus_1 = (maxOrthogonality + _defineStateVectors);
-        maxOrthogonality = _plus_1;
-      }
-    } else {
-      maxOrthogonality = 1;
-    }
-    final ExecutionState es = this.mapping.create(s);
-    SexecFactory _factory = this.sexec.factory();
-    StateVector _createStateVector = _factory.createStateVector();
-    es.setStateVector(_createStateVector);
-    StateVector _stateVector = es.getStateVector();
-    _stateVector.setOffset(offset);
-    StateVector _stateVector_1 = es.getStateVector();
-    _stateVector_1.setSize(maxOrthogonality);
-    return maxOrthogonality;
-  }
-  
-  /**
-   * calculates the maximum orthogonality (maximum number of possible active leaf states) of a state
-   */
-  protected int _defineStateVectors(final FinalState s, final int offset) {
-    final ExecutionState es = this.mapping.create(s);
-    SexecFactory _factory = this.sexec.factory();
-    StateVector _createStateVector = _factory.createStateVector();
-    es.setStateVector(_createStateVector);
-    StateVector _stateVector = es.getStateVector();
-    _stateVector.setOffset(offset);
-    StateVector _stateVector_1 = es.getStateVector();
-    _stateVector_1.setSize(1);
-    return 1;
-  }
-  
-  protected StateVector _stateVector(final Vertex v) {
-    return null;
-  }
-  
-  protected StateVector _stateVector(final RegularState s) {
-    ExecutionState _create = this.mapping.create(s);
-    StateVector _stateVector = _create.getStateVector();
-    return _stateVector;
-  }
-  
-  protected StateVector _stateVector(final Choice choice) {
-    Region _parentRegion = choice.getParentRegion();
-    ExecutionRegion _create = this.mapping.create(_parentRegion);
-    StateVector _stateVector = _create.getStateVector();
-    return _stateVector;
-  }
-  
-  public int defineStateVectors(final Vertex s, final int offset) {
-    if (s instanceof FinalState) {
-      return _defineStateVectors((FinalState)s, offset);
-    } else if (s instanceof State) {
-      return _defineStateVectors((State)s, offset);
-    } else if (s != null) {
-      return _defineStateVectors(s, offset);
-    } else {
-      throw new IllegalArgumentException("Unhandled parameter types: " +
-        Arrays.<Object>asList(s, offset).toString());
-    }
-  }
-  
-  public StateVector stateVector(final Vertex choice) {
-    if (choice instanceof Choice) {
-      return _stateVector((Choice)choice);
-    } else if (choice instanceof RegularState) {
-      return _stateVector((RegularState)choice);
-    } else if (choice != null) {
-      return _stateVector(choice);
-    } else {
-      throw new IllegalArgumentException("Unhandled parameter types: " +
-        Arrays.<Object>asList(choice).toString());
-    }
-  }
-}
+package org.yakindu.sct.model.sexec.transformation;
+
+import com.google.common.collect.Iterators;
+import com.google.inject.Inject;
+import java.util.Arrays;
+import java.util.Iterator;
+import org.eclipse.emf.common.util.EList;
+import org.eclipse.emf.common.util.TreeIterator;
+import org.eclipse.emf.ecore.EObject;
+import org.eclipse.xtext.xbase.lib.Functions.Function2;
+import org.eclipse.xtext.xbase.lib.IterableExtensions;
+import org.eclipse.xtext.xbase.lib.IteratorExtensions;
+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.SexecFactory;
+import org.yakindu.sct.model.sexec.StateVector;
+import org.yakindu.sct.model.sexec.transformation.SexecElementMapping;
+import org.yakindu.sct.model.sexec.transformation.SexecExtensions;
+import org.yakindu.sct.model.sexec.transformation.SgraphExtensions;
+import org.yakindu.sct.model.sexec.transformation.StatechartExtensions;
+import org.yakindu.sct.model.sgraph.Choice;
+import org.yakindu.sct.model.sgraph.FinalState;
+import org.yakindu.sct.model.sgraph.Region;
+import org.yakindu.sct.model.sgraph.RegularState;
+import org.yakindu.sct.model.sgraph.State;
+import org.yakindu.sct.model.sgraph.Statechart;
+import org.yakindu.sct.model.sgraph.Vertex;
+
+@SuppressWarnings("all")
+public class StateVectorBuilder {
+  @Inject
+  private SexecExtensions sexec;
+  
+  @Inject
+  private SexecElementMapping mapping;
+  
+  @Inject
+  private StatechartExtensions sc;
+  
+  @Inject
+  private SgraphExtensions sgraph;
+  
+  public void defineHistoryVector(final ExecutionFlow flow, final Statechart sc) {
+    int offset = (-1);
+    TreeIterator<EObject> _eAllContents = sc.eAllContents();
+    Iterator<Region> _filter = Iterators.<Region>filter(_eAllContents, Region.class);
+    Iterable<Region> _iterable = IteratorExtensions.<Region>toIterable(_filter);
+    for (final Region r : _iterable) {
+      boolean _requireHistory = this.sgraph.requireHistory(r);
+      if (_requireHistory) {
+        int _plus = (offset + 1);
+        offset = _plus;
+        final ExecutionRegion er = this.mapping.create(r);
+        SexecFactory _factory = this.sexec.factory();
+        StateVector _createStateVector = _factory.createStateVector();
+        er.setHistoryVector(_createStateVector);
+        StateVector _historyVector = er.getHistoryVector();
+        _historyVector.setOffset(offset);
+        StateVector _historyVector_1 = er.getHistoryVector();
+        _historyVector_1.setSize(1);
+      }
+    }
+    int _minus = (-1);
+    boolean _notEquals = (offset != _minus);
+    if (_notEquals) {
+      SexecFactory _factory_1 = this.sexec.factory();
+      StateVector _createStateVector_1 = _factory_1.createStateVector();
+      flow.setHistoryVector(_createStateVector_1);
+      StateVector _historyVector_2 = flow.getHistoryVector();
+      _historyVector_2.setOffset(0);
+      StateVector _historyVector_3 = flow.getHistoryVector();
+      int _plus_1 = (offset + 1);
+      _historyVector_3.setSize(_plus_1);
+    }
+  }
+  
+  public void defineStateVector(final ExecutionFlow flow, final Statechart sc) {
+    int offset = 0;
+    EList<Region> _regions = sc.getRegions();
+    for (final Region r : _regions) {
+      int _defineStateVectors = this.defineStateVectors(r, offset);
+      int _plus = (offset + _defineStateVectors);
+      offset = _plus;
+    }
+    SexecFactory _factory = this.sexec.factory();
+    StateVector _createStateVector = _factory.createStateVector();
+    flow.setStateVector(_createStateVector);
+    StateVector _stateVector = flow.getStateVector();
+    _stateVector.setOffset(0);
+    StateVector _stateVector_1 = flow.getStateVector();
+    _stateVector_1.setSize(offset);
+  }
+  
+  /**
+   * calculates the maximum orthogonality (maximum number of possible active leaf states) of the statechart
+   */
+  public int defineStateVectors(final Statechart sc, final int offset) {
+    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 = StateVectorBuilder.this.sc.maxOrthogonality(r);
+          int _plus = (_maxOrthogonality + (o).intValue());
+          return Integer.valueOf(_plus);
+        }
+      };
+    Integer _fold = IterableExtensions.<Region, Integer>fold(_regions, Integer.valueOf(0), _function);
+    return (_fold).intValue();
+  }
+  
+  /**
+   * calculates the maximum orthogonality (maximum number of possible active leaf states) of a region
+   */
+  public int defineStateVectors(final Region r, final int offset) {
+    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;
+          {
+            final int mo = StateVectorBuilder.this.defineStateVectors(v, offset);
+            int _xifexpression = (int) 0;
+            boolean _greaterThan = (mo > (s).intValue());
+            if (_greaterThan) {
+              _xifexpression = mo;
+            } else {
+              _xifexpression = s;
+            }
+            _xblockexpression = (_xifexpression);
+          }
+          return Integer.valueOf(_xblockexpression);
+        }
+      };
+    final Integer maxOrthogonality = IterableExtensions.<Vertex, Integer>fold(_vertices, Integer.valueOf(0), _function);
+    final ExecutionRegion er = this.mapping.create(r);
+    SexecFactory _factory = this.sexec.factory();
+    StateVector _createStateVector = _factory.createStateVector();
+    er.setStateVector(_createStateVector);
+    StateVector _stateVector = er.getStateVector();
+    _stateVector.setOffset(offset);
+    StateVector _stateVector_1 = er.getStateVector();
+    _stateVector_1.setSize((maxOrthogonality).intValue());
+    return (maxOrthogonality).intValue();
+  }
+  
+  /**
+   * the maximum orthogonality of all  pseudo states is 0
+   */
+  protected int _defineStateVectors(final Vertex v, final int offset) {
+    return 0;
+  }
+  
+  /**
+   * calculates the maximum orthogonality (maximum number of possible active leaf states) of a state
+   */
+  protected int _defineStateVectors(final State s, final int offset) {
+    int maxOrthogonality = 0;
+    EList<Region> _regions = s.getRegions();
+    int _size = _regions.size();
+    boolean _greaterThan = (_size > 0);
+    if (_greaterThan) {
+      EList<Region> _regions_1 = s.getRegions();
+      for (final Region r : _regions_1) {
+        int _plus = (offset + maxOrthogonality);
+        int _defineStateVectors = this.defineStateVectors(r, _plus);
+        int _plus_1 = (maxOrthogonality + _defineStateVectors);
+        maxOrthogonality = _plus_1;
+      }
+    } else {
+      maxOrthogonality = 1;
+    }
+    final ExecutionState es = this.mapping.create(s);
+    SexecFactory _factory = this.sexec.factory();
+    StateVector _createStateVector = _factory.createStateVector();
+    es.setStateVector(_createStateVector);
+    StateVector _stateVector = es.getStateVector();
+    _stateVector.setOffset(offset);
+    StateVector _stateVector_1 = es.getStateVector();
+    _stateVector_1.setSize(maxOrthogonality);
+    return maxOrthogonality;
+  }
+  
+  /**
+   * calculates the maximum orthogonality (maximum number of possible active leaf states) of a state
+   */
+  protected int _defineStateVectors(final FinalState s, final int offset) {
+    final ExecutionState es = this.mapping.create(s);
+    SexecFactory _factory = this.sexec.factory();
+    StateVector _createStateVector = _factory.createStateVector();
+    es.setStateVector(_createStateVector);
+    StateVector _stateVector = es.getStateVector();
+    _stateVector.setOffset(offset);
+    StateVector _stateVector_1 = es.getStateVector();
+    _stateVector_1.setSize(1);
+    return 1;
+  }
+  
+  protected StateVector _stateVector(final Vertex v) {
+    return null;
+  }
+  
+  protected StateVector _stateVector(final RegularState s) {
+    ExecutionState _create = this.mapping.create(s);
+    StateVector _stateVector = _create.getStateVector();
+    return _stateVector;
+  }
+  
+  protected StateVector _stateVector(final Choice choice) {
+    Region _parentRegion = choice.getParentRegion();
+    ExecutionRegion _create = this.mapping.create(_parentRegion);
+    StateVector _stateVector = _create.getStateVector();
+    return _stateVector;
+  }
+  
+  public int defineStateVectors(final Vertex s, final int offset) {
+    if (s instanceof FinalState) {
+      return _defineStateVectors((FinalState)s, offset);
+    } else if (s instanceof State) {
+      return _defineStateVectors((State)s, offset);
+    } else if (s != null) {
+      return _defineStateVectors(s, offset);
+    } else {
+      throw new IllegalArgumentException("Unhandled parameter types: " +
+        Arrays.<Object>asList(s, offset).toString());
+    }
+  }
+  
+  public StateVector stateVector(final Vertex choice) {
+    if (choice instanceof Choice) {
+      return _stateVector((Choice)choice);
+    } else if (choice instanceof RegularState) {
+      return _stateVector((RegularState)choice);
+    } else if (choice != null) {
+      return _stateVector(choice);
+    } else {
+      throw new IllegalArgumentException("Unhandled parameter types: " +
+        Arrays.<Object>asList(choice).toString());
+    }
+  }
+}

+ 452 - 447
plugins/org.yakindu.sct.model.sexec/xtend-gen/org/yakindu/sct/model/sexec/transformation/StatechartExtensions.java

@@ -1,447 +1,452 @@
-package org.yakindu.sct.model.sexec.transformation;
-
-import com.google.common.base.Objects;
-import com.google.common.collect.Iterables;
-import com.google.common.collect.Iterators;
-import java.util.ArrayList;
-import java.util.Arrays;
-import java.util.Iterator;
-import java.util.List;
-import org.eclipse.emf.common.util.EList;
-import org.eclipse.emf.common.util.TreeIterator;
-import org.eclipse.emf.ecore.EObject;
-import org.eclipse.xtext.EcoreUtil2;
-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.IteratorExtensions;
-import org.eclipse.xtext.xbase.lib.Procedures.Procedure1;
-import org.yakindu.sct.model.sgraph.Choice;
-import org.yakindu.sct.model.sgraph.Entry;
-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.EntryEvent;
-import org.yakindu.sct.model.stext.stext.EventSpec;
-import org.yakindu.sct.model.stext.stext.ExitEvent;
-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.TimeEventSpec;
-
-@SuppressWarnings("all")
-public class StatechartExtensions {
-  /**
-   * calculates the maximum orthogonality (maximum number of possible active leaf states) of the statechart
-   */
-  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 _plus = (_maxOrthogonality + (o).intValue());
-          return Integer.valueOf(_plus);
-        }
-      };
-    Integer _fold = IterableExtensions.<Region, Integer>fold(_regions, Integer.valueOf(0), _function);
-    return (_fold).intValue();
-  }
-  
-  /**
-   * calculates the maximum orthogonality (maximum number of possible active leaf states) of a region
-   */
-  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;
-          {
-            final int mo = StatechartExtensions.this.maxOrthogonality(v);
-            int _xifexpression = (int) 0;
-            boolean _greaterThan = (mo > (s).intValue());
-            if (_greaterThan) {
-              _xifexpression = mo;
-            } else {
-              _xifexpression = s;
-            }
-            _xblockexpression = (_xifexpression);
-          }
-          return Integer.valueOf(_xblockexpression);
-        }
-      };
-    Integer _fold = IterableExtensions.<Vertex, Integer>fold(_vertices, Integer.valueOf(0), _function);
-    return (_fold).intValue();
-  }
-  
-  /**
-   * the maximum orthogonality of all  pseudo states is 0
-   */
-  protected int _maxOrthogonality(final Vertex v) {
-    return 0;
-  }
-  
-  /**
-   * calculates the maximum orthogonality (maximum number of possible active leaf states) of a state
-   */
-  protected int _maxOrthogonality(final State s) {
-    Integer _xifexpression = null;
-    EList<Region> _regions = s.getRegions();
-    int _size = _regions.size();
-    boolean _greaterThan = (_size > 0);
-    if (_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 _plus = (_maxOrthogonality + (o).intValue());
-            return Integer.valueOf(_plus);
-          }
-        };
-      Integer _fold = IterableExtensions.<Region, Integer>fold(_regions_1, Integer.valueOf(0), _function);
-      _xifexpression = _fold;
-    } else {
-      _xifexpression = 1;
-    }
-    return (_xifexpression).intValue();
-  }
-  
-  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 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;
-  }
-  
-  /**
-   * Provides a list of all TimeEventSpecs that are defined in the context of 'statechart'.
-   */
-  public List<TimeEventSpec> timeEventSpecs(final Statechart state) {
-    ArrayList<TimeEventSpec> _arrayList = new ArrayList<TimeEventSpec>();
-    ArrayList<TimeEventSpec> tesList = _arrayList;
-    EList<Reaction> _localReactions = state.getLocalReactions();
-    final Function2<ArrayList<TimeEventSpec>,Reaction,ArrayList<TimeEventSpec>> _function = new Function2<ArrayList<TimeEventSpec>,Reaction,ArrayList<TimeEventSpec>>() {
-        public ArrayList<TimeEventSpec> apply(final ArrayList<TimeEventSpec> s, final Reaction r) {
-          ArrayList<TimeEventSpec> _xblockexpression = null;
-          {
-            List<EObject> _eAllContentsAsList = EcoreUtil2.eAllContentsAsList(r);
-            Iterable<TimeEventSpec> _filter = Iterables.<TimeEventSpec>filter(_eAllContentsAsList, TimeEventSpec.class);
-            final Procedure1<TimeEventSpec> _function = new Procedure1<TimeEventSpec>() {
-                public void apply(final TimeEventSpec tes) {
-                  s.add(tes);
-                }
-              };
-            IterableExtensions.<TimeEventSpec>forEach(_filter, _function);
-            _xblockexpression = (s);
-          }
-          return _xblockexpression;
-        }
-      };
-    IterableExtensions.<Reaction, ArrayList<TimeEventSpec>>fold(_localReactions, tesList, _function);
-    return tesList;
-  }
-  
-  /**
-   * Provides a list of all TimeEventSpecs that are defined in the context of 'state'.
-   */
-  protected 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 = Iterables.<TimeEventSpec>filter(_eAllContentsAsList, TimeEventSpec.class);
-            final Procedure1<TimeEventSpec> _function = new Procedure1<TimeEventSpec>() {
-                public void apply(final TimeEventSpec tes) {
-                  s.add(tes);
-                }
-              };
-            IterableExtensions.<TimeEventSpec>forEach(_filter, _function);
-            _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_1 = new Function2<ArrayList<TimeEventSpec>,Reaction,ArrayList<TimeEventSpec>>() {
-        public ArrayList<TimeEventSpec> apply(final ArrayList<TimeEventSpec> s, final Reaction r) {
-          ArrayList<TimeEventSpec> _xblockexpression = null;
-          {
-            List<EObject> _eAllContentsAsList = EcoreUtil2.eAllContentsAsList(r);
-            Iterable<TimeEventSpec> _filter = Iterables.<TimeEventSpec>filter(_eAllContentsAsList, TimeEventSpec.class);
-            final Procedure1<TimeEventSpec> _function = new Procedure1<TimeEventSpec>() {
-                public void apply(final TimeEventSpec tes) {
-                  s.add(tes);
-                }
-              };
-            IterableExtensions.<TimeEventSpec>forEach(_filter, _function);
-            _xblockexpression = (s);
-          }
-          return _xblockexpression;
-        }
-      };
-    IterableExtensions.<Reaction, ArrayList<TimeEventSpec>>fold(_localReactions, tesList, _function_1);
-    return tesList;
-  }
-  
-  /**
-   * Provides a list of all TimeEventSpecs that are defined in the context of 'state'.
-   */
-  protected List<TimeEventSpec> _timeEventSpecs(final Statechart state) {
-    ArrayList<TimeEventSpec> _arrayList = new ArrayList<TimeEventSpec>();
-    ArrayList<TimeEventSpec> tesList = _arrayList;
-    EList<Reaction> _localReactions = state.getLocalReactions();
-    final Function2<ArrayList<TimeEventSpec>,Reaction,ArrayList<TimeEventSpec>> _function = new Function2<ArrayList<TimeEventSpec>,Reaction,ArrayList<TimeEventSpec>>() {
-        public ArrayList<TimeEventSpec> apply(final ArrayList<TimeEventSpec> s, final Reaction r) {
-          ArrayList<TimeEventSpec> _xblockexpression = null;
-          {
-            List<EObject> _eAllContentsAsList = EcoreUtil2.eAllContentsAsList(r);
-            Iterable<TimeEventSpec> _filter = Iterables.<TimeEventSpec>filter(_eAllContentsAsList, TimeEventSpec.class);
-            final Procedure1<TimeEventSpec> _function = new Procedure1<TimeEventSpec>() {
-                public void apply(final TimeEventSpec tes) {
-                  s.add(tes);
-                }
-              };
-            IterableExtensions.<TimeEventSpec>forEach(_filter, _function);
-            _xblockexpression = (s);
-          }
-          return _xblockexpression;
-        }
-      };
-    IterableExtensions.<Reaction, ArrayList<TimeEventSpec>>fold(_localReactions, tesList, _function);
-    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 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 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 ReactiveElement)) {
-      EObject _eContainer_1 = s.eContainer();
-      _xifexpression = ((ReactiveElement) _eContainer_1);
-    }
-    return _xifexpression;
-  }
-  
-  public List<RegularState> allRegularStates(final Statechart sc) {
-    List<EObject> content = EcoreUtil2.eAllContentsAsList(sc);
-    final Iterable<RegularState> allStates = Iterables.<RegularState>filter(content, RegularState.class);
-    return IterableExtensions.<RegularState>toList(allStates);
-  }
-  
-  public List<Region> allRegions(final Statechart sc) {
-    List<EObject> content = EcoreUtil2.eAllContentsAsList(sc);
-    final Iterable<Region> allRegions = Iterables.<Region>filter(content, Region.class);
-    return IterableExtensions.<Region>toList(allRegions);
-  }
-  
-  public Iterable<Choice> allChoices(final Statechart sc) {
-    List<EObject> content = EcoreUtil2.eAllContentsAsList(sc);
-    final Iterable<Choice> allChoices = Iterables.<Choice>filter(content, Choice.class);
-    return allChoices;
-  }
-  
-  public Iterable<Entry> allEntries(final Statechart sc) {
-    TreeIterator<EObject> _eAllContents = sc.eAllContents();
-    Iterator<Entry> _filter = Iterators.<Entry>filter(_eAllContents, Entry.class);
-    return IteratorExtensions.<Entry>toIterable(_filter);
-  }
-  
-  public List<LocalReaction> entryReactions(final ReactiveElement state) {
-    EList<Reaction> _localReactions = state.getLocalReactions();
-    final Function1<Reaction,Boolean> _function = new Function1<Reaction,Boolean>() {
-        public Boolean apply(final Reaction r) {
-          Trigger _trigger = ((LocalReaction) r).getTrigger();
-          EList<EventSpec> _triggers = ((ReactionTrigger) _trigger).getTriggers();
-          final Function1<EventSpec,Boolean> _function = new Function1<EventSpec,Boolean>() {
-              public Boolean apply(final EventSpec t) {
-                return Boolean.valueOf((t instanceof EntryEvent));
-              }
-            };
-          boolean _exists = IterableExtensions.<EventSpec>exists(_triggers, _function);
-          return Boolean.valueOf(_exists);
-        }
-      };
-    Iterable<Reaction> _filter = IterableExtensions.<Reaction>filter(_localReactions, _function);
-    final Function1<Reaction,LocalReaction> _function_1 = new Function1<Reaction,LocalReaction>() {
-        public LocalReaction apply(final Reaction lr) {
-          return ((LocalReaction) lr);
-        }
-      };
-    Iterable<LocalReaction> _map = IterableExtensions.<Reaction, LocalReaction>map(_filter, _function_1);
-    List<LocalReaction> _list = IterableExtensions.<LocalReaction>toList(_map);
-    return _list;
-  }
-  
-  public List<LocalReaction> exitReactions(final ReactiveElement state) {
-    EList<Reaction> _localReactions = state.getLocalReactions();
-    final Function1<Reaction,Boolean> _function = new Function1<Reaction,Boolean>() {
-        public Boolean apply(final Reaction r) {
-          Trigger _trigger = ((LocalReaction) r).getTrigger();
-          EList<EventSpec> _triggers = ((ReactionTrigger) _trigger).getTriggers();
-          final Function1<EventSpec,Boolean> _function = new Function1<EventSpec,Boolean>() {
-              public Boolean apply(final EventSpec t) {
-                return Boolean.valueOf((t instanceof ExitEvent));
-              }
-            };
-          boolean _exists = IterableExtensions.<EventSpec>exists(_triggers, _function);
-          return Boolean.valueOf(_exists);
-        }
-      };
-    Iterable<Reaction> _filter = IterableExtensions.<Reaction>filter(_localReactions, _function);
-    final Function1<Reaction,LocalReaction> _function_1 = new Function1<Reaction,LocalReaction>() {
-        public LocalReaction apply(final Reaction lr) {
-          return ((LocalReaction) lr);
-        }
-      };
-    Iterable<LocalReaction> _map = IterableExtensions.<Reaction, LocalReaction>map(_filter, _function_1);
-    List<LocalReaction> _list = IterableExtensions.<LocalReaction>toList(_map);
-    return _list;
-  }
-  
-  protected String _id(final Object obj) {
-    return null;
-  }
-  
-  /**
-   * The id of a transition is unique within the context of its source vertex.
-   */
-  protected String _id(final Transition t) {
-    Object _xifexpression = null;
-    Vertex _source = t.getSource();
-    boolean _notEquals = (!Objects.equal(_source, null));
-    if (_notEquals) {
-      Vertex _source_1 = t.getSource();
-      EList<Transition> _outgoingTransitions = _source_1.getOutgoingTransitions();
-      int _indexOf = _outgoingTransitions.indexOf(t);
-      _xifexpression = _indexOf;
-    } else {
-      _xifexpression = "";
-    }
-    String _plus = ("tr" + ((Comparable<Object>)_xifexpression));
-    return _plus;
-  }
-  
-  /**
-   * The id of a local reaction is unique within the context of its source vertex.
-   */
-  protected String _id(final LocalReaction t) {
-    Object _xifexpression = null;
-    ReactiveElement _reactiveElement = this.reactiveElement(t);
-    boolean _notEquals = (!Objects.equal(_reactiveElement, null));
-    if (_notEquals) {
-      ReactiveElement _reactiveElement_1 = this.reactiveElement(t);
-      EList<Reaction> _localReactions = _reactiveElement_1.getLocalReactions();
-      int _indexOf = _localReactions.indexOf(t);
-      _xifexpression = _indexOf;
-    } else {
-      _xifexpression = "";
-    }
-    String _plus = ("lr" + ((Comparable<Object>)_xifexpression));
-    return _plus;
-  }
-  
-  public StextFactory stextFactory() {
-    return StextFactory.eINSTANCE;
-  }
-  
-  public int maxOrthogonality(final Vertex s) {
-    if (s instanceof State) {
-      return _maxOrthogonality((State)s);
-    } else if (s != null) {
-      return _maxOrthogonality(s);
-    } else {
-      throw new IllegalArgumentException("Unhandled parameter types: " +
-        Arrays.<Object>asList(s).toString());
-    }
-  }
-  
-  public List<TimeEventSpec> timeEventSpecs(final EObject state) {
-    if (state instanceof State) {
-      return _timeEventSpecs((State)state);
-    } else if (state instanceof Statechart) {
-      return _timeEventSpecs((Statechart)state);
-    } else {
-      throw new IllegalArgumentException("Unhandled parameter types: " +
-        Arrays.<Object>asList(state).toString());
-    }
-  }
-  
-  public ReactiveElement reactiveElement(final Reaction tr) {
-    if (tr instanceof Transition) {
-      return _reactiveElement((Transition)tr);
-    } else if (tr != null) {
-      return _reactiveElement(tr);
-    } else {
-      throw new IllegalArgumentException("Unhandled parameter types: " +
-        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 != null) {
-      return _id(t);
-    } else {
-      throw new IllegalArgumentException("Unhandled parameter types: " +
-        Arrays.<Object>asList(t).toString());
-    }
-  }
-}
+package org.yakindu.sct.model.sexec.transformation;
+
+import com.google.common.base.Objects;
+import com.google.common.collect.Iterables;
+import com.google.common.collect.Iterators;
+import java.util.ArrayList;
+import java.util.Arrays;
+import java.util.Iterator;
+import java.util.List;
+import org.eclipse.emf.common.util.EList;
+import org.eclipse.emf.common.util.TreeIterator;
+import org.eclipse.emf.ecore.EObject;
+import org.eclipse.xtext.EcoreUtil2;
+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.IteratorExtensions;
+import org.eclipse.xtext.xbase.lib.Procedures.Procedure1;
+import org.yakindu.base.base.NamedElement;
+import org.yakindu.sct.model.sgraph.Choice;
+import org.yakindu.sct.model.sgraph.Entry;
+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.EntryEvent;
+import org.yakindu.sct.model.stext.stext.EventSpec;
+import org.yakindu.sct.model.stext.stext.ExitEvent;
+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.TimeEventSpec;
+
+@SuppressWarnings("all")
+public class StatechartExtensions {
+  /**
+   * calculates the maximum orthogonality (maximum number of possible active leaf states) of the statechart
+   */
+  protected 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 _plus = (_maxOrthogonality + (o).intValue());
+          return Integer.valueOf(_plus);
+        }
+      };
+    Integer _fold = IterableExtensions.<Region, Integer>fold(_regions, Integer.valueOf(0), _function);
+    return (_fold).intValue();
+  }
+  
+  /**
+   * calculates the maximum orthogonality (maximum number of possible active leaf states) of a region
+   */
+  protected 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;
+          {
+            final int mo = StatechartExtensions.this.maxOrthogonality(v);
+            int _xifexpression = (int) 0;
+            boolean _greaterThan = (mo > (s).intValue());
+            if (_greaterThan) {
+              _xifexpression = mo;
+            } else {
+              _xifexpression = s;
+            }
+            _xblockexpression = (_xifexpression);
+          }
+          return Integer.valueOf(_xblockexpression);
+        }
+      };
+    Integer _fold = IterableExtensions.<Vertex, Integer>fold(_vertices, Integer.valueOf(0), _function);
+    return (_fold).intValue();
+  }
+  
+  /**
+   * the maximum orthogonality of all  pseudo states is 0
+   */
+  protected int _maxOrthogonality(final Vertex v) {
+    return 0;
+  }
+  
+  /**
+   * calculates the maximum orthogonality (maximum number of possible active leaf states) of a state
+   */
+  protected int _maxOrthogonality(final State s) {
+    Integer _xifexpression = null;
+    EList<Region> _regions = s.getRegions();
+    int _size = _regions.size();
+    boolean _greaterThan = (_size > 0);
+    if (_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 _plus = (_maxOrthogonality + (o).intValue());
+            return Integer.valueOf(_plus);
+          }
+        };
+      Integer _fold = IterableExtensions.<Region, Integer>fold(_regions_1, Integer.valueOf(0), _function);
+      _xifexpression = _fold;
+    } else {
+      _xifexpression = 1;
+    }
+    return (_xifexpression).intValue();
+  }
+  
+  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 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;
+  }
+  
+  /**
+   * Provides a list of all TimeEventSpecs that are defined in the context of 'statechart'.
+   */
+  public List<TimeEventSpec> timeEventSpecs(final Statechart state) {
+    ArrayList<TimeEventSpec> _arrayList = new ArrayList<TimeEventSpec>();
+    ArrayList<TimeEventSpec> tesList = _arrayList;
+    EList<Reaction> _localReactions = state.getLocalReactions();
+    final Function2<ArrayList<TimeEventSpec>,Reaction,ArrayList<TimeEventSpec>> _function = new Function2<ArrayList<TimeEventSpec>,Reaction,ArrayList<TimeEventSpec>>() {
+        public ArrayList<TimeEventSpec> apply(final ArrayList<TimeEventSpec> s, final Reaction r) {
+          ArrayList<TimeEventSpec> _xblockexpression = null;
+          {
+            List<EObject> _eAllContentsAsList = EcoreUtil2.eAllContentsAsList(r);
+            Iterable<TimeEventSpec> _filter = Iterables.<TimeEventSpec>filter(_eAllContentsAsList, TimeEventSpec.class);
+            final Procedure1<TimeEventSpec> _function = new Procedure1<TimeEventSpec>() {
+                public void apply(final TimeEventSpec tes) {
+                  s.add(tes);
+                }
+              };
+            IterableExtensions.<TimeEventSpec>forEach(_filter, _function);
+            _xblockexpression = (s);
+          }
+          return _xblockexpression;
+        }
+      };
+    IterableExtensions.<Reaction, ArrayList<TimeEventSpec>>fold(_localReactions, tesList, _function);
+    return tesList;
+  }
+  
+  /**
+   * Provides a list of all TimeEventSpecs that are defined in the context of 'state'.
+   */
+  protected 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 = Iterables.<TimeEventSpec>filter(_eAllContentsAsList, TimeEventSpec.class);
+            final Procedure1<TimeEventSpec> _function = new Procedure1<TimeEventSpec>() {
+                public void apply(final TimeEventSpec tes) {
+                  s.add(tes);
+                }
+              };
+            IterableExtensions.<TimeEventSpec>forEach(_filter, _function);
+            _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_1 = new Function2<ArrayList<TimeEventSpec>,Reaction,ArrayList<TimeEventSpec>>() {
+        public ArrayList<TimeEventSpec> apply(final ArrayList<TimeEventSpec> s, final Reaction r) {
+          ArrayList<TimeEventSpec> _xblockexpression = null;
+          {
+            List<EObject> _eAllContentsAsList = EcoreUtil2.eAllContentsAsList(r);
+            Iterable<TimeEventSpec> _filter = Iterables.<TimeEventSpec>filter(_eAllContentsAsList, TimeEventSpec.class);
+            final Procedure1<TimeEventSpec> _function = new Procedure1<TimeEventSpec>() {
+                public void apply(final TimeEventSpec tes) {
+                  s.add(tes);
+                }
+              };
+            IterableExtensions.<TimeEventSpec>forEach(_filter, _function);
+            _xblockexpression = (s);
+          }
+          return _xblockexpression;
+        }
+      };
+    IterableExtensions.<Reaction, ArrayList<TimeEventSpec>>fold(_localReactions, tesList, _function_1);
+    return tesList;
+  }
+  
+  /**
+   * Provides a list of all TimeEventSpecs that are defined in the context of 'state'.
+   */
+  protected List<TimeEventSpec> _timeEventSpecs(final Statechart state) {
+    ArrayList<TimeEventSpec> _arrayList = new ArrayList<TimeEventSpec>();
+    ArrayList<TimeEventSpec> tesList = _arrayList;
+    EList<Reaction> _localReactions = state.getLocalReactions();
+    final Function2<ArrayList<TimeEventSpec>,Reaction,ArrayList<TimeEventSpec>> _function = new Function2<ArrayList<TimeEventSpec>,Reaction,ArrayList<TimeEventSpec>>() {
+        public ArrayList<TimeEventSpec> apply(final ArrayList<TimeEventSpec> s, final Reaction r) {
+          ArrayList<TimeEventSpec> _xblockexpression = null;
+          {
+            List<EObject> _eAllContentsAsList = EcoreUtil2.eAllContentsAsList(r);
+            Iterable<TimeEventSpec> _filter = Iterables.<TimeEventSpec>filter(_eAllContentsAsList, TimeEventSpec.class);
+            final Procedure1<TimeEventSpec> _function = new Procedure1<TimeEventSpec>() {
+                public void apply(final TimeEventSpec tes) {
+                  s.add(tes);
+                }
+              };
+            IterableExtensions.<TimeEventSpec>forEach(_filter, _function);
+            _xblockexpression = (s);
+          }
+          return _xblockexpression;
+        }
+      };
+    IterableExtensions.<Reaction, ArrayList<TimeEventSpec>>fold(_localReactions, tesList, _function);
+    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 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 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 ReactiveElement)) {
+      EObject _eContainer_1 = s.eContainer();
+      _xifexpression = ((ReactiveElement) _eContainer_1);
+    }
+    return _xifexpression;
+  }
+  
+  public List<RegularState> allRegularStates(final Statechart sc) {
+    List<EObject> content = EcoreUtil2.eAllContentsAsList(sc);
+    final Iterable<RegularState> allStates = Iterables.<RegularState>filter(content, RegularState.class);
+    return IterableExtensions.<RegularState>toList(allStates);
+  }
+  
+  public List<Region> allRegions(final Statechart sc) {
+    List<EObject> content = EcoreUtil2.eAllContentsAsList(sc);
+    final Iterable<Region> allRegions = Iterables.<Region>filter(content, Region.class);
+    return IterableExtensions.<Region>toList(allRegions);
+  }
+  
+  public Iterable<Choice> allChoices(final Statechart sc) {
+    List<EObject> content = EcoreUtil2.eAllContentsAsList(sc);
+    final Iterable<Choice> allChoices = Iterables.<Choice>filter(content, Choice.class);
+    return allChoices;
+  }
+  
+  public Iterable<Entry> allEntries(final Statechart sc) {
+    TreeIterator<EObject> _eAllContents = sc.eAllContents();
+    Iterator<Entry> _filter = Iterators.<Entry>filter(_eAllContents, Entry.class);
+    return IteratorExtensions.<Entry>toIterable(_filter);
+  }
+  
+  public List<LocalReaction> entryReactions(final ReactiveElement state) {
+    EList<Reaction> _localReactions = state.getLocalReactions();
+    final Function1<Reaction,Boolean> _function = new Function1<Reaction,Boolean>() {
+        public Boolean apply(final Reaction r) {
+          Trigger _trigger = ((LocalReaction) r).getTrigger();
+          EList<EventSpec> _triggers = ((ReactionTrigger) _trigger).getTriggers();
+          final Function1<EventSpec,Boolean> _function = new Function1<EventSpec,Boolean>() {
+              public Boolean apply(final EventSpec t) {
+                return Boolean.valueOf((t instanceof EntryEvent));
+              }
+            };
+          boolean _exists = IterableExtensions.<EventSpec>exists(_triggers, _function);
+          return Boolean.valueOf(_exists);
+        }
+      };
+    Iterable<Reaction> _filter = IterableExtensions.<Reaction>filter(_localReactions, _function);
+    final Function1<Reaction,LocalReaction> _function_1 = new Function1<Reaction,LocalReaction>() {
+        public LocalReaction apply(final Reaction lr) {
+          return ((LocalReaction) lr);
+        }
+      };
+    Iterable<LocalReaction> _map = IterableExtensions.<Reaction, LocalReaction>map(_filter, _function_1);
+    List<LocalReaction> _list = IterableExtensions.<LocalReaction>toList(_map);
+    return _list;
+  }
+  
+  public List<LocalReaction> exitReactions(final ReactiveElement state) {
+    EList<Reaction> _localReactions = state.getLocalReactions();
+    final Function1<Reaction,Boolean> _function = new Function1<Reaction,Boolean>() {
+        public Boolean apply(final Reaction r) {
+          Trigger _trigger = ((LocalReaction) r).getTrigger();
+          EList<EventSpec> _triggers = ((ReactionTrigger) _trigger).getTriggers();
+          final Function1<EventSpec,Boolean> _function = new Function1<EventSpec,Boolean>() {
+              public Boolean apply(final EventSpec t) {
+                return Boolean.valueOf((t instanceof ExitEvent));
+              }
+            };
+          boolean _exists = IterableExtensions.<EventSpec>exists(_triggers, _function);
+          return Boolean.valueOf(_exists);
+        }
+      };
+    Iterable<Reaction> _filter = IterableExtensions.<Reaction>filter(_localReactions, _function);
+    final Function1<Reaction,LocalReaction> _function_1 = new Function1<Reaction,LocalReaction>() {
+        public LocalReaction apply(final Reaction lr) {
+          return ((LocalReaction) lr);
+        }
+      };
+    Iterable<LocalReaction> _map = IterableExtensions.<Reaction, LocalReaction>map(_filter, _function_1);
+    List<LocalReaction> _list = IterableExtensions.<LocalReaction>toList(_map);
+    return _list;
+  }
+  
+  protected String _id(final Object obj) {
+    return null;
+  }
+  
+  /**
+   * The id of a transition is unique within the context of its source vertex.
+   */
+  protected String _id(final Transition t) {
+    Object _xifexpression = null;
+    Vertex _source = t.getSource();
+    boolean _notEquals = (!Objects.equal(_source, null));
+    if (_notEquals) {
+      Vertex _source_1 = t.getSource();
+      EList<Transition> _outgoingTransitions = _source_1.getOutgoingTransitions();
+      int _indexOf = _outgoingTransitions.indexOf(t);
+      _xifexpression = _indexOf;
+    } else {
+      _xifexpression = "";
+    }
+    String _plus = ("tr" + ((Comparable<Object>)_xifexpression));
+    return _plus;
+  }
+  
+  /**
+   * The id of a local reaction is unique within the context of its source vertex.
+   */
+  protected String _id(final LocalReaction t) {
+    Object _xifexpression = null;
+    ReactiveElement _reactiveElement = this.reactiveElement(t);
+    boolean _notEquals = (!Objects.equal(_reactiveElement, null));
+    if (_notEquals) {
+      ReactiveElement _reactiveElement_1 = this.reactiveElement(t);
+      EList<Reaction> _localReactions = _reactiveElement_1.getLocalReactions();
+      int _indexOf = _localReactions.indexOf(t);
+      _xifexpression = _indexOf;
+    } else {
+      _xifexpression = "";
+    }
+    String _plus = ("lr" + ((Comparable<Object>)_xifexpression));
+    return _plus;
+  }
+  
+  public StextFactory stextFactory() {
+    return StextFactory.eINSTANCE;
+  }
+  
+  public int maxOrthogonality(final NamedElement s) {
+    if (s instanceof State) {
+      return _maxOrthogonality((State)s);
+    } else if (s instanceof Region) {
+      return _maxOrthogonality((Region)s);
+    } else if (s instanceof Statechart) {
+      return _maxOrthogonality((Statechart)s);
+    } else if (s instanceof Vertex) {
+      return _maxOrthogonality((Vertex)s);
+    } else {
+      throw new IllegalArgumentException("Unhandled parameter types: " +
+        Arrays.<Object>asList(s).toString());
+    }
+  }
+  
+  public List<TimeEventSpec> timeEventSpecs(final EObject state) {
+    if (state instanceof State) {
+      return _timeEventSpecs((State)state);
+    } else if (state instanceof Statechart) {
+      return _timeEventSpecs((Statechart)state);
+    } else {
+      throw new IllegalArgumentException("Unhandled parameter types: " +
+        Arrays.<Object>asList(state).toString());
+    }
+  }
+  
+  public ReactiveElement reactiveElement(final Reaction tr) {
+    if (tr instanceof Transition) {
+      return _reactiveElement((Transition)tr);
+    } else if (tr != null) {
+      return _reactiveElement(tr);
+    } else {
+      throw new IllegalArgumentException("Unhandled parameter types: " +
+        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 != null) {
+      return _id(t);
+    } else {
+      throw new IllegalArgumentException("Unhandled parameter types: " +
+        Arrays.<Object>asList(t).toString());
+    }
+  }
+}

+ 37 - 37
plugins/org.yakindu.sct.model.sexec/xtend-gen/org/yakindu/sct/model/sexec/transformation/StextExtensions.java

@@ -1,37 +1,37 @@
-package org.yakindu.sct.model.sexec.transformation;
-
-import org.yakindu.sct.model.stext.stext.Expression;
-import org.yakindu.sct.model.stext.stext.LogicalAndExpression;
-import org.yakindu.sct.model.stext.stext.LogicalOrExpression;
-import org.yakindu.sct.model.stext.stext.StextFactory;
-
-@SuppressWarnings("all")
-public class StextExtensions {
-  public StextFactory factory() {
-    return StextFactory.eINSTANCE;
-  }
-  
-  public Expression or(final Expression left, final Expression right) {
-    LogicalOrExpression _xblockexpression = null;
-    {
-      StextFactory _factory = this.factory();
-      final LogicalOrExpression or = _factory.createLogicalOrExpression();
-      or.setLeftOperand(left);
-      or.setRightOperand(right);
-      _xblockexpression = (or);
-    }
-    return _xblockexpression;
-  }
-  
-  public Expression and(final Expression left, final Expression right) {
-    LogicalAndExpression _xblockexpression = null;
-    {
-      StextFactory _factory = this.factory();
-      final LogicalAndExpression or = _factory.createLogicalAndExpression();
-      or.setLeftOperand(left);
-      or.setRightOperand(right);
-      _xblockexpression = (or);
-    }
-    return _xblockexpression;
-  }
-}
+package org.yakindu.sct.model.sexec.transformation;
+
+import org.yakindu.sct.model.stext.stext.Expression;
+import org.yakindu.sct.model.stext.stext.LogicalAndExpression;
+import org.yakindu.sct.model.stext.stext.LogicalOrExpression;
+import org.yakindu.sct.model.stext.stext.StextFactory;
+
+@SuppressWarnings("all")
+public class StextExtensions {
+  public StextFactory factory() {
+    return StextFactory.eINSTANCE;
+  }
+  
+  public Expression or(final Expression left, final Expression right) {
+    LogicalOrExpression _xblockexpression = null;
+    {
+      StextFactory _factory = this.factory();
+      final LogicalOrExpression or = _factory.createLogicalOrExpression();
+      or.setLeftOperand(left);
+      or.setRightOperand(right);
+      _xblockexpression = (or);
+    }
+    return _xblockexpression;
+  }
+  
+  public Expression and(final Expression left, final Expression right) {
+    LogicalAndExpression _xblockexpression = null;
+    {
+      StextFactory _factory = this.factory();
+      final LogicalAndExpression or = _factory.createLogicalAndExpression();
+      or.setLeftOperand(left);
+      or.setRightOperand(right);
+      _xblockexpression = (or);
+    }
+    return _xblockexpression;
+  }
+}

+ 306 - 306
plugins/org.yakindu.sct.model.sexec/xtend-gen/org/yakindu/sct/model/sexec/transformation/StructureMapping.java

@@ -1,306 +1,306 @@
-package org.yakindu.sct.model.sexec.transformation;
-
-import com.google.common.base.Objects;
-import com.google.common.collect.Iterables;
-import com.google.inject.Inject;
-import java.util.ArrayList;
-import java.util.Arrays;
-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.Functions.Function1;
-import org.eclipse.xtext.xbase.lib.IterableExtensions;
-import org.eclipse.xtext.xbase.lib.ListExtensions;
-import org.eclipse.xtext.xbase.lib.Procedures.Procedure1;
-import org.yakindu.sct.model.sexec.ExecutionChoice;
-import org.yakindu.sct.model.sexec.ExecutionEntry;
-import org.yakindu.sct.model.sexec.ExecutionFlow;
-import org.yakindu.sct.model.sexec.ExecutionNode;
-import org.yakindu.sct.model.sexec.ExecutionRegion;
-import org.yakindu.sct.model.sexec.ExecutionScope;
-import org.yakindu.sct.model.sexec.ExecutionState;
-import org.yakindu.sct.model.sexec.TimeEvent;
-import org.yakindu.sct.model.sexec.transformation.SexecElementMapping;
-import org.yakindu.sct.model.sexec.transformation.StatechartExtensions;
-import org.yakindu.sct.model.sgraph.Choice;
-import org.yakindu.sct.model.sgraph.CompositeElement;
-import org.yakindu.sct.model.sgraph.Declaration;
-import org.yakindu.sct.model.sgraph.Entry;
-import org.yakindu.sct.model.sgraph.FinalState;
-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.Vertex;
-import org.yakindu.sct.model.stext.stext.EventDefinition;
-import org.yakindu.sct.model.stext.stext.OperationDefinition;
-import org.yakindu.sct.model.stext.stext.TimeEventSpec;
-import org.yakindu.sct.model.stext.stext.VariableDefinition;
-
-@SuppressWarnings("all")
-public class StructureMapping {
-  @Inject
-  private SexecElementMapping mapping;
-  
-  @Inject
-  private StatechartExtensions sct;
-  
-  /**
-   * maps all required scope defined in the statechart to the execution flow.
-   * This includes creating the scopes and adding all relevant declarations. Empty scopes wont be mapped.
-   */
-  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 = StructureMapping.this.map(scope);
-            return _map;
-          }
-        };
-      List<Scope> _map = ListExtensions.<Scope, Scope>map(_scopes_1, _function);
-      _scopes.addAll(_map);
-      _xblockexpression = (flow);
-    }
-    return _xblockexpression;
-  }
-  
-  public Scope map(final Scope scope) {
-    final Scope _scope = this.mapping.create(scope);
-    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 = StructureMapping.this.map(decl);
-          return _map;
-        }
-      };
-    List<Declaration> _map = ListExtensions.<Declaration, Declaration>map(_declarations_1, _function);
-    final Function1<Declaration,Boolean> _function_1 = new Function1<Declaration,Boolean>() {
-        public Boolean apply(final Declaration e) {
-          boolean _notEquals = (!Objects.equal(e, null));
-          return Boolean.valueOf(_notEquals);
-        }
-      };
-    Iterable<Declaration> _filter = IterableExtensions.<Declaration>filter(_map, _function_1);
-    Iterables.<Declaration>addAll(_declarations, _filter);
-    return _scope;
-  }
-  
-  protected Declaration _map(final Declaration decl) {
-    return null;
-  }
-  
-  protected Declaration _map(final EventDefinition e) {
-    final EventDefinition _e = this.mapping.create(e);
-    return _e;
-  }
-  
-  protected Declaration _map(final VariableDefinition v) {
-    final VariableDefinition _v = this.mapping.create(v);
-    return _v;
-  }
-  
-  protected Declaration _map(final OperationDefinition v) {
-    final OperationDefinition _v = this.mapping.create(v);
-    return _v;
-  }
-  
-  public ExecutionFlow mapRegularStates(final Statechart statechart, final ExecutionFlow r) {
-    final List<RegularState> allStates = this.sct.allRegularStates(statechart);
-    EList<ExecutionState> _states = r.getStates();
-    final Function1<RegularState,ExecutionState> _function = new Function1<RegularState,ExecutionState>() {
-        public ExecutionState apply(final RegularState s) {
-          ExecutionState _mapState = StructureMapping.this.mapState(s);
-          return _mapState;
-        }
-      };
-    List<ExecutionState> _map = ListExtensions.<RegularState, ExecutionState>map(allStates, _function);
-    _states.addAll(_map);
-    return r;
-  }
-  
-  protected ExecutionState _mapState(final FinalState state) {
-    final ExecutionState _state = this.mapping.create(state);
-    _state.setLeaf(true);
-    _state.setEntryAction(null);
-    _state.setExitAction(null);
-    return _state;
-  }
-  
-  protected ExecutionState _mapState(final State state) {
-    final ExecutionState _state = this.mapping.create(state);
-    boolean _isSimple = state.isSimple();
-    _state.setLeaf(_isSimple);
-    return _state;
-  }
-  
-  protected ExecutionState _mapState(final RegularState state) {
-    return null;
-  }
-  
-  public ExecutionFlow mapRegions(final Statechart statechart, final ExecutionFlow flow) {
-    final List<Region> allRegions = this.sct.allRegions(statechart);
-    EList<ExecutionRegion> _regions = flow.getRegions();
-    final Function1<Region,ExecutionRegion> _function = new Function1<Region,ExecutionRegion>() {
-        public ExecutionRegion apply(final Region r) {
-          ExecutionRegion _mapRegion = StructureMapping.this.mapRegion(r);
-          return _mapRegion;
-        }
-      };
-    List<ExecutionRegion> _map = ListExtensions.<Region, ExecutionRegion>map(allRegions, _function);
-    _regions.addAll(_map);
-    return flow;
-  }
-  
-  public ExecutionRegion mapRegion(final Region region) {
-    final ExecutionRegion _region = this.mapping.create(region);
-    CompositeElement _composite = region.getComposite();
-    if ((_composite instanceof Statechart)) {
-      CompositeElement _composite_1 = region.getComposite();
-      ExecutionFlow _create = this.mapping.create(((Statechart) _composite_1));
-      _region.setSuperScope(_create);
-    } else {
-      CompositeElement _composite_2 = region.getComposite();
-      ExecutionState _create_1 = this.mapping.create(((State) _composite_2));
-      _region.setSuperScope(_create_1);
-    }
-    EList<ExecutionScope> _subScopes = _region.getSubScopes();
-    EList<Vertex> _vertices = region.getVertices();
-    Iterable<RegularState> _filter = Iterables.<RegularState>filter(_vertices, RegularState.class);
-    final Function1<RegularState,ExecutionScope> _function = new Function1<RegularState,ExecutionScope>() {
-        public ExecutionScope apply(final RegularState v) {
-          ExecutionState _create = StructureMapping.this.mapping.create(v);
-          return ((ExecutionScope) _create);
-        }
-      };
-    Iterable<ExecutionScope> _map = IterableExtensions.<RegularState, ExecutionScope>map(_filter, _function);
-    Iterables.<ExecutionScope>addAll(_subScopes, _map);
-    return _region;
-  }
-  
-  public ExecutionFlow mapPseudoStates(final Statechart statechart, final ExecutionFlow r) {
-    EList<ExecutionNode> _nodes = r.getNodes();
-    Iterable<Choice> _allChoices = this.sct.allChoices(statechart);
-    final Function1<Choice,ExecutionChoice> _function = new Function1<Choice,ExecutionChoice>() {
-        public ExecutionChoice apply(final Choice choice) {
-          ExecutionChoice _create = StructureMapping.this.mapping.create(choice);
-          return _create;
-        }
-      };
-    Iterable<ExecutionChoice> _map = IterableExtensions.<Choice, ExecutionChoice>map(_allChoices, _function);
-    Iterables.<ExecutionNode>addAll(_nodes, _map);
-    EList<ExecutionNode> _nodes_1 = r.getNodes();
-    Iterable<Entry> _allEntries = this.sct.allEntries(statechart);
-    final Function1<Entry,ExecutionEntry> _function_1 = new Function1<Entry,ExecutionEntry>() {
-        public ExecutionEntry apply(final Entry entry) {
-          ExecutionEntry _create = StructureMapping.this.mapping.create(entry);
-          return _create;
-        }
-      };
-    Iterable<ExecutionEntry> _map_1 = IterableExtensions.<Entry, ExecutionEntry>map(_allEntries, _function_1);
-    Iterables.<ExecutionNode>addAll(_nodes_1, _map_1);
-    return r;
-  }
-  
-  /**
-   * Time trigger will be mapped to execution model time events for each real state.
-   */
-  public ExecutionFlow mapTimeEvents(final Statechart statechart, final ExecutionFlow r) {
-    List<EObject> content = EcoreUtil2.eAllContentsAsList(statechart);
-    final Iterable<State> allStates = Iterables.<State>filter(content, State.class);
-    final Procedure1<State> _function = new Procedure1<State>() {
-        public void apply(final State s) {
-          StructureMapping.this.mapTimeEventSpecs(s);
-        }
-      };
-    IterableExtensions.<State>forEach(allStates, _function);
-    this.mapTimeEventSpecs(statechart);
-    return r;
-  }
-  
-  public ArrayList<TimeEvent> mapTimeEventSpecs(final State state) {
-    ArrayList<TimeEvent> _xblockexpression = null;
-    {
-      final List<TimeEventSpec> timeEventSpecs = this.sct.timeEventSpecs(state);
-      ArrayList<TimeEvent> _arrayList = new ArrayList<TimeEvent>();
-      final ArrayList<TimeEvent> result = _arrayList;
-      for (final TimeEventSpec tes : timeEventSpecs) {
-        {
-          final TimeEvent timeEvent = this.mapping.createDerivedEvent(tes);
-          String _name = state.getName();
-          String _plus = (_name + "_time_event_");
-          int _indexOf = timeEventSpecs.indexOf(tes);
-          String _plus_1 = (_plus + Integer.valueOf(_indexOf));
-          timeEvent.setName(_plus_1);
-          Statechart _statechart = this.sct.statechart(state);
-          ExecutionFlow _create = this.mapping.create(_statechart);
-          Scope _timeEventScope = this.mapping.timeEventScope(_create);
-          EList<Declaration> _declarations = _timeEventScope.getDeclarations();
-          _declarations.add(timeEvent);
-          result.add(timeEvent);
-        }
-      }
-      _xblockexpression = (result);
-    }
-    return _xblockexpression;
-  }
-  
-  public ArrayList<TimeEvent> mapTimeEventSpecs(final Statechart statechart) {
-    ArrayList<TimeEvent> _xblockexpression = null;
-    {
-      final List<TimeEventSpec> timeEventSpecs = this.sct.timeEventSpecs(statechart);
-      ArrayList<TimeEvent> _arrayList = new ArrayList<TimeEvent>();
-      final ArrayList<TimeEvent> result = _arrayList;
-      for (final TimeEventSpec tes : timeEventSpecs) {
-        {
-          final TimeEvent timeEvent = this.mapping.createDerivedEvent(tes);
-          String _name = statechart.getName();
-          String _plus = (_name + "_time_event_");
-          int _indexOf = timeEventSpecs.indexOf(tes);
-          String _plus_1 = (_plus + Integer.valueOf(_indexOf));
-          timeEvent.setName(_plus_1);
-          ExecutionFlow _create = this.mapping.create(statechart);
-          Scope _timeEventScope = this.mapping.timeEventScope(_create);
-          EList<Declaration> _declarations = _timeEventScope.getDeclarations();
-          _declarations.add(timeEvent);
-          result.add(timeEvent);
-        }
-      }
-      _xblockexpression = (result);
-    }
-    return _xblockexpression;
-  }
-  
-  public Declaration map(final Declaration e) {
-    if (e instanceof EventDefinition) {
-      return _map((EventDefinition)e);
-    } else if (e instanceof OperationDefinition) {
-      return _map((OperationDefinition)e);
-    } else if (e instanceof VariableDefinition) {
-      return _map((VariableDefinition)e);
-    } else if (e != null) {
-      return _map(e);
-    } else {
-      throw new IllegalArgumentException("Unhandled parameter types: " +
-        Arrays.<Object>asList(e).toString());
-    }
-  }
-  
-  public ExecutionState mapState(final RegularState state) {
-    if (state instanceof FinalState) {
-      return _mapState((FinalState)state);
-    } else if (state instanceof State) {
-      return _mapState((State)state);
-    } else if (state != null) {
-      return _mapState(state);
-    } else {
-      throw new IllegalArgumentException("Unhandled parameter types: " +
-        Arrays.<Object>asList(state).toString());
-    }
-  }
-}
+package org.yakindu.sct.model.sexec.transformation;
+
+import com.google.common.base.Objects;
+import com.google.common.collect.Iterables;
+import com.google.inject.Inject;
+import java.util.ArrayList;
+import java.util.Arrays;
+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.Functions.Function1;
+import org.eclipse.xtext.xbase.lib.IterableExtensions;
+import org.eclipse.xtext.xbase.lib.ListExtensions;
+import org.eclipse.xtext.xbase.lib.Procedures.Procedure1;
+import org.yakindu.sct.model.sexec.ExecutionChoice;
+import org.yakindu.sct.model.sexec.ExecutionEntry;
+import org.yakindu.sct.model.sexec.ExecutionFlow;
+import org.yakindu.sct.model.sexec.ExecutionNode;
+import org.yakindu.sct.model.sexec.ExecutionRegion;
+import org.yakindu.sct.model.sexec.ExecutionScope;
+import org.yakindu.sct.model.sexec.ExecutionState;
+import org.yakindu.sct.model.sexec.TimeEvent;
+import org.yakindu.sct.model.sexec.transformation.SexecElementMapping;
+import org.yakindu.sct.model.sexec.transformation.StatechartExtensions;
+import org.yakindu.sct.model.sgraph.Choice;
+import org.yakindu.sct.model.sgraph.CompositeElement;
+import org.yakindu.sct.model.sgraph.Declaration;
+import org.yakindu.sct.model.sgraph.Entry;
+import org.yakindu.sct.model.sgraph.FinalState;
+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.Vertex;
+import org.yakindu.sct.model.stext.stext.EventDefinition;
+import org.yakindu.sct.model.stext.stext.OperationDefinition;
+import org.yakindu.sct.model.stext.stext.TimeEventSpec;
+import org.yakindu.sct.model.stext.stext.VariableDefinition;
+
+@SuppressWarnings("all")
+public class StructureMapping {
+  @Inject
+  private SexecElementMapping mapping;
+  
+  @Inject
+  private StatechartExtensions sct;
+  
+  /**
+   * maps all required scope defined in the statechart to the execution flow.
+   * This includes creating the scopes and adding all relevant declarations. Empty scopes wont be mapped.
+   */
+  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 = StructureMapping.this.map(scope);
+            return _map;
+          }
+        };
+      List<Scope> _map = ListExtensions.<Scope, Scope>map(_scopes_1, _function);
+      _scopes.addAll(_map);
+      _xblockexpression = (flow);
+    }
+    return _xblockexpression;
+  }
+  
+  public Scope map(final Scope scope) {
+    final Scope _scope = this.mapping.create(scope);
+    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 = StructureMapping.this.map(decl);
+          return _map;
+        }
+      };
+    List<Declaration> _map = ListExtensions.<Declaration, Declaration>map(_declarations_1, _function);
+    final Function1<Declaration,Boolean> _function_1 = new Function1<Declaration,Boolean>() {
+        public Boolean apply(final Declaration e) {
+          boolean _notEquals = (!Objects.equal(e, null));
+          return Boolean.valueOf(_notEquals);
+        }
+      };
+    Iterable<Declaration> _filter = IterableExtensions.<Declaration>filter(_map, _function_1);
+    Iterables.<Declaration>addAll(_declarations, _filter);
+    return _scope;
+  }
+  
+  protected Declaration _map(final Declaration decl) {
+    return null;
+  }
+  
+  protected Declaration _map(final EventDefinition e) {
+    final EventDefinition _e = this.mapping.create(e);
+    return _e;
+  }
+  
+  protected Declaration _map(final VariableDefinition v) {
+    final VariableDefinition _v = this.mapping.create(v);
+    return _v;
+  }
+  
+  protected Declaration _map(final OperationDefinition v) {
+    final OperationDefinition _v = this.mapping.create(v);
+    return _v;
+  }
+  
+  public ExecutionFlow mapRegularStates(final Statechart statechart, final ExecutionFlow r) {
+    final List<RegularState> allStates = this.sct.allRegularStates(statechart);
+    EList<ExecutionState> _states = r.getStates();
+    final Function1<RegularState,ExecutionState> _function = new Function1<RegularState,ExecutionState>() {
+        public ExecutionState apply(final RegularState s) {
+          ExecutionState _mapState = StructureMapping.this.mapState(s);
+          return _mapState;
+        }
+      };
+    List<ExecutionState> _map = ListExtensions.<RegularState, ExecutionState>map(allStates, _function);
+    _states.addAll(_map);
+    return r;
+  }
+  
+  protected ExecutionState _mapState(final FinalState state) {
+    final ExecutionState _state = this.mapping.create(state);
+    _state.setLeaf(true);
+    _state.setEntryAction(null);
+    _state.setExitAction(null);
+    return _state;
+  }
+  
+  protected ExecutionState _mapState(final State state) {
+    final ExecutionState _state = this.mapping.create(state);
+    boolean _isSimple = state.isSimple();
+    _state.setLeaf(_isSimple);
+    return _state;
+  }
+  
+  protected ExecutionState _mapState(final RegularState state) {
+    return null;
+  }
+  
+  public ExecutionFlow mapRegions(final Statechart statechart, final ExecutionFlow flow) {
+    final List<Region> allRegions = this.sct.allRegions(statechart);
+    EList<ExecutionRegion> _regions = flow.getRegions();
+    final Function1<Region,ExecutionRegion> _function = new Function1<Region,ExecutionRegion>() {
+        public ExecutionRegion apply(final Region r) {
+          ExecutionRegion _mapRegion = StructureMapping.this.mapRegion(r);
+          return _mapRegion;
+        }
+      };
+    List<ExecutionRegion> _map = ListExtensions.<Region, ExecutionRegion>map(allRegions, _function);
+    _regions.addAll(_map);
+    return flow;
+  }
+  
+  public ExecutionRegion mapRegion(final Region region) {
+    final ExecutionRegion _region = this.mapping.create(region);
+    CompositeElement _composite = region.getComposite();
+    if ((_composite instanceof Statechart)) {
+      CompositeElement _composite_1 = region.getComposite();
+      ExecutionFlow _create = this.mapping.create(((Statechart) _composite_1));
+      _region.setSuperScope(_create);
+    } else {
+      CompositeElement _composite_2 = region.getComposite();
+      ExecutionState _create_1 = this.mapping.create(((State) _composite_2));
+      _region.setSuperScope(_create_1);
+    }
+    EList<ExecutionScope> _subScopes = _region.getSubScopes();
+    EList<Vertex> _vertices = region.getVertices();
+    Iterable<RegularState> _filter = Iterables.<RegularState>filter(_vertices, RegularState.class);
+    final Function1<RegularState,ExecutionScope> _function = new Function1<RegularState,ExecutionScope>() {
+        public ExecutionScope apply(final RegularState v) {
+          ExecutionState _create = StructureMapping.this.mapping.create(v);
+          return ((ExecutionScope) _create);
+        }
+      };
+    Iterable<ExecutionScope> _map = IterableExtensions.<RegularState, ExecutionScope>map(_filter, _function);
+    Iterables.<ExecutionScope>addAll(_subScopes, _map);
+    return _region;
+  }
+  
+  public ExecutionFlow mapPseudoStates(final Statechart statechart, final ExecutionFlow r) {
+    EList<ExecutionNode> _nodes = r.getNodes();
+    Iterable<Choice> _allChoices = this.sct.allChoices(statechart);
+    final Function1<Choice,ExecutionChoice> _function = new Function1<Choice,ExecutionChoice>() {
+        public ExecutionChoice apply(final Choice choice) {
+          ExecutionChoice _create = StructureMapping.this.mapping.create(choice);
+          return _create;
+        }
+      };
+    Iterable<ExecutionChoice> _map = IterableExtensions.<Choice, ExecutionChoice>map(_allChoices, _function);
+    Iterables.<ExecutionNode>addAll(_nodes, _map);
+    EList<ExecutionNode> _nodes_1 = r.getNodes();
+    Iterable<Entry> _allEntries = this.sct.allEntries(statechart);
+    final Function1<Entry,ExecutionEntry> _function_1 = new Function1<Entry,ExecutionEntry>() {
+        public ExecutionEntry apply(final Entry entry) {
+          ExecutionEntry _create = StructureMapping.this.mapping.create(entry);
+          return _create;
+        }
+      };
+    Iterable<ExecutionEntry> _map_1 = IterableExtensions.<Entry, ExecutionEntry>map(_allEntries, _function_1);
+    Iterables.<ExecutionNode>addAll(_nodes_1, _map_1);
+    return r;
+  }
+  
+  /**
+   * Time trigger will be mapped to execution model time events for each real state.
+   */
+  public ExecutionFlow mapTimeEvents(final Statechart statechart, final ExecutionFlow r) {
+    List<EObject> content = EcoreUtil2.eAllContentsAsList(statechart);
+    final Iterable<State> allStates = Iterables.<State>filter(content, State.class);
+    final Procedure1<State> _function = new Procedure1<State>() {
+        public void apply(final State s) {
+          StructureMapping.this.mapTimeEventSpecs(s);
+        }
+      };
+    IterableExtensions.<State>forEach(allStates, _function);
+    this.mapTimeEventSpecs(statechart);
+    return r;
+  }
+  
+  public ArrayList<TimeEvent> mapTimeEventSpecs(final State state) {
+    ArrayList<TimeEvent> _xblockexpression = null;
+    {
+      final List<TimeEventSpec> timeEventSpecs = this.sct.timeEventSpecs(state);
+      ArrayList<TimeEvent> _arrayList = new ArrayList<TimeEvent>();
+      final ArrayList<TimeEvent> result = _arrayList;
+      for (final TimeEventSpec tes : timeEventSpecs) {
+        {
+          final TimeEvent timeEvent = this.mapping.createDerivedEvent(tes);
+          String _name = state.getName();
+          String _plus = (_name + "_time_event_");
+          int _indexOf = timeEventSpecs.indexOf(tes);
+          String _plus_1 = (_plus + Integer.valueOf(_indexOf));
+          timeEvent.setName(_plus_1);
+          Statechart _statechart = this.sct.statechart(state);
+          ExecutionFlow _create = this.mapping.create(_statechart);
+          Scope _timeEventScope = this.mapping.timeEventScope(_create);
+          EList<Declaration> _declarations = _timeEventScope.getDeclarations();
+          _declarations.add(timeEvent);
+          result.add(timeEvent);
+        }
+      }
+      _xblockexpression = (result);
+    }
+    return _xblockexpression;
+  }
+  
+  public ArrayList<TimeEvent> mapTimeEventSpecs(final Statechart statechart) {
+    ArrayList<TimeEvent> _xblockexpression = null;
+    {
+      final List<TimeEventSpec> timeEventSpecs = this.sct.timeEventSpecs(statechart);
+      ArrayList<TimeEvent> _arrayList = new ArrayList<TimeEvent>();
+      final ArrayList<TimeEvent> result = _arrayList;
+      for (final TimeEventSpec tes : timeEventSpecs) {
+        {
+          final TimeEvent timeEvent = this.mapping.createDerivedEvent(tes);
+          String _name = statechart.getName();
+          String _plus = (_name + "_time_event_");
+          int _indexOf = timeEventSpecs.indexOf(tes);
+          String _plus_1 = (_plus + Integer.valueOf(_indexOf));
+          timeEvent.setName(_plus_1);
+          ExecutionFlow _create = this.mapping.create(statechart);
+          Scope _timeEventScope = this.mapping.timeEventScope(_create);
+          EList<Declaration> _declarations = _timeEventScope.getDeclarations();
+          _declarations.add(timeEvent);
+          result.add(timeEvent);
+        }
+      }
+      _xblockexpression = (result);
+    }
+    return _xblockexpression;
+  }
+  
+  public Declaration map(final Declaration e) {
+    if (e instanceof EventDefinition) {
+      return _map((EventDefinition)e);
+    } else if (e instanceof OperationDefinition) {
+      return _map((OperationDefinition)e);
+    } else if (e instanceof VariableDefinition) {
+      return _map((VariableDefinition)e);
+    } else if (e != null) {
+      return _map(e);
+    } else {
+      throw new IllegalArgumentException("Unhandled parameter types: " +
+        Arrays.<Object>asList(e).toString());
+    }
+  }
+  
+  public ExecutionState mapState(final RegularState state) {
+    if (state instanceof FinalState) {
+      return _mapState((FinalState)state);
+    } else if (state instanceof State) {
+      return _mapState((State)state);
+    } else if (state != null) {
+      return _mapState(state);
+    } else {
+      throw new IllegalArgumentException("Unhandled parameter types: " +
+        Arrays.<Object>asList(state).toString());
+    }
+  }
+}

+ 102 - 102
plugins/org.yakindu.sct.model.sexec/xtend-gen/org/yakindu/sct/model/sexec/transformation/TraceExtensions.java

@@ -1,102 +1,102 @@
-package org.yakindu.sct.model.sexec.transformation;
-
-import com.google.inject.Inject;
-import com.google.inject.name.Named;
-import org.eclipse.emf.common.util.EList;
-import org.yakindu.sct.model.sexec.ExecutionNode;
-import org.yakindu.sct.model.sexec.ExecutionState;
-import org.yakindu.sct.model.sexec.Reaction;
-import org.yakindu.sct.model.sexec.ReactionFired;
-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.TraceNodeExecuted;
-import org.yakindu.sct.model.sexec.TraceStateEntered;
-import org.yakindu.sct.model.sexec.TraceStateExited;
-import org.yakindu.sct.model.sexec.transformation.SexecElementMapping;
-import org.yakindu.sct.model.sexec.transformation.SexecExtensions;
-import org.yakindu.sct.model.sgraph.RegularState;
-
-@SuppressWarnings("all")
-public class TraceExtensions {
-  @Inject
-  private SexecExtensions sexec;
-  
-  @Inject
-  private SexecElementMapping mapping;
-  
-  @Inject
-  @Named("ADD_TRACES")
-  private boolean _addTraceSteps;
-  
-  public boolean isAddTraceSteps() {
-    return this._addTraceSteps;
-  }
-  
-  public ReactionFired newTraceReactionFired(final Reaction r) {
-    ReactionFired _xblockexpression = null;
-    {
-      SexecFactory _factory = this.sexec.factory();
-      final ReactionFired rf = _factory.createReactionFired();
-      rf.setReaction(r);
-      _xblockexpression = (rf);
-    }
-    return _xblockexpression;
-  }
-  
-  public TraceNodeExecuted newTraceNodeExecuted(final ExecutionNode node) {
-    TraceNodeExecuted _xblockexpression = null;
-    {
-      SexecFactory _factory = this.sexec.factory();
-      final TraceNodeExecuted t = _factory.createTraceNodeExecuted();
-      t.setNode(node);
-      _xblockexpression = (t);
-    }
-    return _xblockexpression;
-  }
-  
-  public TraceStateEntered newTraceStateEntered(final ExecutionState state) {
-    TraceStateEntered _xblockexpression = null;
-    {
-      SexecFactory _factory = this.sexec.factory();
-      final TraceStateEntered t = _factory.createTraceStateEntered();
-      t.setState(state);
-      _xblockexpression = (t);
-    }
-    return _xblockexpression;
-  }
-  
-  public TraceStateExited newTraceStateExited(final ExecutionState state) {
-    TraceStateExited _xblockexpression = null;
-    {
-      SexecFactory _factory = this.sexec.factory();
-      final TraceStateExited t = _factory.createTraceStateExited();
-      t.setState(state);
-      _xblockexpression = (t);
-    }
-    return _xblockexpression;
-  }
-  
-  public boolean traceStateExited(final Sequence seq, final ExecutionState state) {
-    boolean _xifexpression = false;
-    boolean _isAddTraceSteps = this.isAddTraceSteps();
-    if (_isAddTraceSteps) {
-      EList<Step> _steps = seq.getSteps();
-      TraceStateExited _newTraceStateExited = this.newTraceStateExited(state);
-      boolean _add = _steps.add(_newTraceStateExited);
-      _xifexpression = _add;
-    }
-    return _xifexpression;
-  }
-  
-  public boolean traceStateExited(final Sequence seq, final RegularState state) {
-    boolean _xifexpression = false;
-    boolean _isAddTraceSteps = this.isAddTraceSteps();
-    if (_isAddTraceSteps) {
-      ExecutionState _create = this.mapping.create(state);
-      boolean _traceStateExited = this.traceStateExited(seq, _create);
-      _xifexpression = _traceStateExited;
-    }
-    return _xifexpression;
-  }
-}
+package org.yakindu.sct.model.sexec.transformation;
+
+import com.google.inject.Inject;
+import com.google.inject.name.Named;
+import org.eclipse.emf.common.util.EList;
+import org.yakindu.sct.model.sexec.ExecutionNode;
+import org.yakindu.sct.model.sexec.ExecutionState;
+import org.yakindu.sct.model.sexec.Reaction;
+import org.yakindu.sct.model.sexec.ReactionFired;
+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.TraceNodeExecuted;
+import org.yakindu.sct.model.sexec.TraceStateEntered;
+import org.yakindu.sct.model.sexec.TraceStateExited;
+import org.yakindu.sct.model.sexec.transformation.SexecElementMapping;
+import org.yakindu.sct.model.sexec.transformation.SexecExtensions;
+import org.yakindu.sct.model.sgraph.RegularState;
+
+@SuppressWarnings("all")
+public class TraceExtensions {
+  @Inject
+  private SexecExtensions sexec;
+  
+  @Inject
+  private SexecElementMapping mapping;
+  
+  @Inject
+  @Named(value = "ADD_TRACES")
+  private boolean _addTraceSteps;
+  
+  public boolean isAddTraceSteps() {
+    return this._addTraceSteps;
+  }
+  
+  public ReactionFired newTraceReactionFired(final Reaction r) {
+    ReactionFired _xblockexpression = null;
+    {
+      SexecFactory _factory = this.sexec.factory();
+      final ReactionFired rf = _factory.createReactionFired();
+      rf.setReaction(r);
+      _xblockexpression = (rf);
+    }
+    return _xblockexpression;
+  }
+  
+  public TraceNodeExecuted newTraceNodeExecuted(final ExecutionNode node) {
+    TraceNodeExecuted _xblockexpression = null;
+    {
+      SexecFactory _factory = this.sexec.factory();
+      final TraceNodeExecuted t = _factory.createTraceNodeExecuted();
+      t.setNode(node);
+      _xblockexpression = (t);
+    }
+    return _xblockexpression;
+  }
+  
+  public TraceStateEntered newTraceStateEntered(final ExecutionState state) {
+    TraceStateEntered _xblockexpression = null;
+    {
+      SexecFactory _factory = this.sexec.factory();
+      final TraceStateEntered t = _factory.createTraceStateEntered();
+      t.setState(state);
+      _xblockexpression = (t);
+    }
+    return _xblockexpression;
+  }
+  
+  public TraceStateExited newTraceStateExited(final ExecutionState state) {
+    TraceStateExited _xblockexpression = null;
+    {
+      SexecFactory _factory = this.sexec.factory();
+      final TraceStateExited t = _factory.createTraceStateExited();
+      t.setState(state);
+      _xblockexpression = (t);
+    }
+    return _xblockexpression;
+  }
+  
+  public boolean traceStateExited(final Sequence seq, final ExecutionState state) {
+    boolean _xifexpression = false;
+    boolean _isAddTraceSteps = this.isAddTraceSteps();
+    if (_isAddTraceSteps) {
+      EList<Step> _steps = seq.getSteps();
+      TraceStateExited _newTraceStateExited = this.newTraceStateExited(state);
+      boolean _add = _steps.add(_newTraceStateExited);
+      _xifexpression = _add;
+    }
+    return _xifexpression;
+  }
+  
+  public boolean traceStateExited(final Sequence seq, final RegularState state) {
+    boolean _xifexpression = false;
+    boolean _isAddTraceSteps = this.isAddTraceSteps();
+    if (_isAddTraceSteps) {
+      ExecutionState _create = this.mapping.create(state);
+      boolean _traceStateExited = this.traceStateExited(seq, _create);
+      _xifexpression = _traceStateExited;
+    }
+    return _xifexpression;
+  }
+}