Pārlūkot izejas kodu

HistoryStateVector for ExecutionRegions added to ExecutionFlow with reference in ExecRegions

benjamin.schwertfeger@gmail.com 13 gadi atpakaļ
vecāks
revīzija
23596d8d0d
22 mainītis faili ar 896 papildinājumiem un 397 dzēšanām
  1. 7 1
      plugins/org.yakindu.sct.model.sexec/model/sexec.ecore
  2. 4 1
      plugins/org.yakindu.sct.model.sexec/model/sexec.genmodel
  3. 27 0
      plugins/org.yakindu.sct.model.sexec/src/org/yakindu/sct/model/sexec/ExecutionFlow.java
  4. 65 11
      plugins/org.yakindu.sct.model.sexec/src/org/yakindu/sct/model/sexec/ExecutionRegion.java
  5. 94 10
      plugins/org.yakindu.sct.model.sexec/src/org/yakindu/sct/model/sexec/SexecPackage.java
  6. 66 0
      plugins/org.yakindu.sct.model.sexec/src/org/yakindu/sct/model/sexec/impl/ExecutionFlowImpl.java
  7. 159 29
      plugins/org.yakindu.sct.model.sexec/src/org/yakindu/sct/model/sexec/impl/ExecutionRegionImpl.java
  8. 36 3
      plugins/org.yakindu.sct.model.sexec/src/org/yakindu/sct/model/sexec/impl/SexecPackageImpl.java
  9. 3 1
      plugins/org.yakindu.sct.model.sexec/src/org/yakindu/sct/model/sexec/transformation/ModelSequencer.xtend
  10. 2 64
      plugins/org.yakindu.sct.model.sexec/src/org/yakindu/sct/model/sexec/transformation/ReactionBuilder.xtend
  11. 91 3
      plugins/org.yakindu.sct.model.sexec/src/org/yakindu/sct/model/sexec/transformation/SequenceBuilder.xtend
  12. 1 2
      plugins/org.yakindu.sct.model.sexec/src/org/yakindu/sct/model/sexec/transformation/SexecExtensions.xtend
  13. 9 1
      plugins/org.yakindu.sct.model.sexec/src/org/yakindu/sct/model/sexec/transformation/SgraphExtensions.xtend
  14. 18 15
      plugins/org.yakindu.sct.model.sexec/src/org/yakindu/sct/model/sexec/transformation/StateVectorBuilder.xtend
  15. 4 0
      plugins/org.yakindu.sct.model.sexec/src/org/yakindu/sct/model/sexec/transformation/StructureMapping.xtend
  16. 3 1
      plugins/org.yakindu.sct.model.sexec/xtend-gen/org/yakindu/sct/model/sexec/transformation/ModelSequencer.java
  17. 14 158
      plugins/org.yakindu.sct.model.sexec/xtend-gen/org/yakindu/sct/model/sexec/transformation/ReactionBuilder.java
  18. 203 31
      plugins/org.yakindu.sct.model.sexec/xtend-gen/org/yakindu/sct/model/sexec/transformation/SequenceBuilder.java
  19. 1 2
      plugins/org.yakindu.sct.model.sexec/xtend-gen/org/yakindu/sct/model/sexec/transformation/SexecExtensions.java
  20. 44 0
      plugins/org.yakindu.sct.model.sexec/xtend-gen/org/yakindu/sct/model/sexec/transformation/SgraphExtensions.java
  21. 37 64
      plugins/org.yakindu.sct.model.sexec/xtend-gen/org/yakindu/sct/model/sexec/transformation/StateVectorBuilder.java
  22. 8 0
      plugins/org.yakindu.sct.model.sexec/xtend-gen/org/yakindu/sct/model/sexec/transformation/StructureMapping.java

+ 7 - 1
plugins/org.yakindu.sct.model.sexec/model/sexec.ecore

@@ -16,6 +16,8 @@
         eType="#//ExecutionNode" containment="true"/>
     <eStructuralFeatures xsi:type="ecore:EReference" name="regions" upperBound="-1"
         eType="#//ExecutionRegion" containment="true"/>
+    <eStructuralFeatures xsi:type="ecore:EReference" name="historyVector" eType="#//StateVector"
+        containment="true"/>
   </eClassifiers>
   <eClassifiers xsi:type="ecore:EClass" name="ExecutionNode" eSuperTypes="#//NamedElement #//MappedElement">
     <eStructuralFeatures xsi:type="ecore:EReference" name="reactions" upperBound="-1"
@@ -45,7 +47,11 @@
         containment="true"/>
   </eClassifiers>
   <eClassifiers xsi:type="ecore:EClass" name="ExecutionRegion" eSuperTypes="#//ExecutionScope">
-    <eStructuralFeatures xsi:type="ecore:EReference" name="historyStateVector" eType="#//StateVector"
+    <eStructuralFeatures xsi:type="ecore:EReference" name="deepEnterSequence" eType="#//Sequence"
+        containment="true"/>
+    <eStructuralFeatures xsi:type="ecore:EReference" name="shallowEnterSequence" eType="#//Sequence"
+        containment="true"/>
+    <eStructuralFeatures xsi:type="ecore:EReference" name="historyVector" eType="#//StateVector"
         containment="true"/>
   </eClassifiers>
   <eClassifiers xsi:type="ecore:EClass" name="ExecutionEntry" eSuperTypes="#//ExecutionNode"/>

+ 4 - 1
plugins/org.yakindu.sct.model.sexec/model/sexec.genmodel

@@ -17,6 +17,7 @@
       <genFeatures property="None" children="true" createChild="true" ecoreFeature="ecore:EReference sexec.ecore#//ExecutionFlow/states"/>
       <genFeatures property="None" children="true" createChild="true" ecoreFeature="ecore:EReference sexec.ecore#//ExecutionFlow/nodes"/>
       <genFeatures property="None" children="true" createChild="true" ecoreFeature="ecore:EReference sexec.ecore#//ExecutionFlow/regions"/>
+      <genFeatures property="None" children="true" createChild="true" ecoreFeature="ecore:EReference sexec.ecore#//ExecutionFlow/historyVector"/>
     </genClasses>
     <genClasses ecoreClass="sexec.ecore#//ExecutionNode">
       <genFeatures property="None" children="true" createChild="true" ecoreFeature="ecore:EReference sexec.ecore#//ExecutionNode/reactions"/>
@@ -36,7 +37,9 @@
       <genFeatures property="None" children="true" createChild="true" ecoreFeature="ecore:EReference sexec.ecore#//ExecutionScope/exitSequence"/>
     </genClasses>
     <genClasses ecoreClass="sexec.ecore#//ExecutionRegion">
-      <genFeatures property="None" children="true" createChild="true" ecoreFeature="ecore:EReference sexec.ecore#//ExecutionRegion/historyStateVector"/>
+      <genFeatures property="None" children="true" createChild="true" ecoreFeature="ecore:EReference sexec.ecore#//ExecutionRegion/deepEnterSequence"/>
+      <genFeatures property="None" children="true" createChild="true" ecoreFeature="ecore:EReference sexec.ecore#//ExecutionRegion/shallowEnterSequence"/>
+      <genFeatures property="None" children="true" createChild="true" ecoreFeature="ecore:EReference sexec.ecore#//ExecutionRegion/historyVector"/>
     </genClasses>
     <genClasses ecoreClass="sexec.ecore#//ExecutionEntry"/>
     <genClasses ecoreClass="sexec.ecore#//ExecutionChoice"/>

+ 27 - 0
plugins/org.yakindu.sct.model.sexec/src/org/yakindu/sct/model/sexec/ExecutionFlow.java

@@ -20,6 +20,7 @@ import org.yakindu.sct.model.sgraph.ScopedElement;
  *   <li>{@link org.yakindu.sct.model.sexec.ExecutionFlow#getStates <em>States</em>}</li>
  *   <li>{@link org.yakindu.sct.model.sexec.ExecutionFlow#getNodes <em>Nodes</em>}</li>
  *   <li>{@link org.yakindu.sct.model.sexec.ExecutionFlow#getRegions <em>Regions</em>}</li>
+ *   <li>{@link org.yakindu.sct.model.sexec.ExecutionFlow#getHistoryVector <em>History Vector</em>}</li>
  * </ul>
  * </p>
  *
@@ -76,4 +77,30 @@ public interface ExecutionFlow extends ScopedElement, ExecutionScope {
 	 */
 	EList<ExecutionRegion> getRegions();
 
+	/**
+	 * Returns the value of the '<em><b>History Vector</b></em>' containment reference.
+	 * <!-- begin-user-doc -->
+	 * <p>
+	 * If the meaning of the '<em>History Vector</em>' containment reference isn't clear,
+	 * there really should be more of a description here...
+	 * </p>
+	 * <!-- end-user-doc -->
+	 * @return the value of the '<em>History Vector</em>' containment reference.
+	 * @see #setHistoryVector(StateVector)
+	 * @see org.yakindu.sct.model.sexec.SexecPackage#getExecutionFlow_HistoryVector()
+	 * @model containment="true"
+	 * @generated
+	 */
+	StateVector getHistoryVector();
+
+	/**
+	 * Sets the value of the '{@link org.yakindu.sct.model.sexec.ExecutionFlow#getHistoryVector <em>History Vector</em>}' containment reference.
+	 * <!-- begin-user-doc -->
+	 * <!-- end-user-doc -->
+	 * @param value the new value of the '<em>History Vector</em>' containment reference.
+	 * @see #getHistoryVector()
+	 * @generated
+	 */
+	void setHistoryVector(StateVector value);
+
 } // ExecutionFlow

+ 65 - 11
plugins/org.yakindu.sct.model.sexec/src/org/yakindu/sct/model/sexec/ExecutionRegion.java

@@ -15,7 +15,9 @@ package org.yakindu.sct.model.sexec;
  * <p>
  * The following features are supported:
  * <ul>
- *   <li>{@link org.yakindu.sct.model.sexec.ExecutionRegion#getHistoryStateVector <em>History State Vector</em>}</li>
+ *   <li>{@link org.yakindu.sct.model.sexec.ExecutionRegion#getDeepEnterSequence <em>Deep Enter Sequence</em>}</li>
+ *   <li>{@link org.yakindu.sct.model.sexec.ExecutionRegion#getShallowEnterSequence <em>Shallow Enter Sequence</em>}</li>
+ *   <li>{@link org.yakindu.sct.model.sexec.ExecutionRegion#getHistoryVector <em>History Vector</em>}</li>
  * </ul>
  * </p>
  *
@@ -26,28 +28,80 @@ package org.yakindu.sct.model.sexec;
 public interface ExecutionRegion extends ExecutionScope {
 
 	/**
-	 * Returns the value of the '<em><b>History State Vector</b></em>' containment reference.
+	 * Returns the value of the '<em><b>Deep Enter Sequence</b></em>' containment reference.
 	 * <!-- begin-user-doc -->
 	 * <p>
-	 * If the meaning of the '<em>History State Vector</em>' containment reference isn't clear,
+	 * If the meaning of the '<em>Deep Enter Sequence</em>' containment reference isn't clear,
 	 * there really should be more of a description here...
 	 * </p>
 	 * <!-- end-user-doc -->
-	 * @return the value of the '<em>History State Vector</em>' containment reference.
-	 * @see #setHistoryStateVector(StateVector)
-	 * @see org.yakindu.sct.model.sexec.SexecPackage#getExecutionRegion_HistoryStateVector()
+	 * @return the value of the '<em>Deep Enter Sequence</em>' containment reference.
+	 * @see #setDeepEnterSequence(Sequence)
+	 * @see org.yakindu.sct.model.sexec.SexecPackage#getExecutionRegion_DeepEnterSequence()
 	 * @model containment="true"
 	 * @generated
 	 */
-	StateVector getHistoryStateVector();
+	Sequence getDeepEnterSequence();
 
 	/**
-	 * Sets the value of the '{@link org.yakindu.sct.model.sexec.ExecutionRegion#getHistoryStateVector <em>History State Vector</em>}' containment reference.
+	 * Sets the value of the '{@link org.yakindu.sct.model.sexec.ExecutionRegion#getDeepEnterSequence <em>Deep Enter Sequence</em>}' containment reference.
 	 * <!-- begin-user-doc -->
 	 * <!-- end-user-doc -->
-	 * @param value the new value of the '<em>History State Vector</em>' containment reference.
-	 * @see #getHistoryStateVector()
+	 * @param value the new value of the '<em>Deep Enter Sequence</em>' containment reference.
+	 * @see #getDeepEnterSequence()
 	 * @generated
 	 */
-	void setHistoryStateVector(StateVector value);
+	void setDeepEnterSequence(Sequence value);
+
+	/**
+	 * Returns the value of the '<em><b>Shallow Enter Sequence</b></em>' containment reference.
+	 * <!-- begin-user-doc -->
+	 * <p>
+	 * If the meaning of the '<em>Shallow Enter Sequence</em>' containment reference isn't clear,
+	 * there really should be more of a description here...
+	 * </p>
+	 * <!-- end-user-doc -->
+	 * @return the value of the '<em>Shallow Enter Sequence</em>' containment reference.
+	 * @see #setShallowEnterSequence(Sequence)
+	 * @see org.yakindu.sct.model.sexec.SexecPackage#getExecutionRegion_ShallowEnterSequence()
+	 * @model containment="true"
+	 * @generated
+	 */
+	Sequence getShallowEnterSequence();
+
+	/**
+	 * Sets the value of the '{@link org.yakindu.sct.model.sexec.ExecutionRegion#getShallowEnterSequence <em>Shallow Enter Sequence</em>}' containment reference.
+	 * <!-- begin-user-doc -->
+	 * <!-- end-user-doc -->
+	 * @param value the new value of the '<em>Shallow Enter Sequence</em>' containment reference.
+	 * @see #getShallowEnterSequence()
+	 * @generated
+	 */
+	void setShallowEnterSequence(Sequence value);
+
+	/**
+	 * Returns the value of the '<em><b>History Vector</b></em>' containment reference.
+	 * <!-- begin-user-doc -->
+	 * <p>
+	 * If the meaning of the '<em>History Vector</em>' containment reference isn't clear,
+	 * there really should be more of a description here...
+	 * </p>
+	 * <!-- end-user-doc -->
+	 * @return the value of the '<em>History Vector</em>' containment reference.
+	 * @see #setHistoryVector(StateVector)
+	 * @see org.yakindu.sct.model.sexec.SexecPackage#getExecutionRegion_HistoryVector()
+	 * @model containment="true"
+	 * @generated
+	 */
+	StateVector getHistoryVector();
+
+	/**
+	 * Sets the value of the '{@link org.yakindu.sct.model.sexec.ExecutionRegion#getHistoryVector <em>History Vector</em>}' containment reference.
+	 * <!-- begin-user-doc -->
+	 * <!-- end-user-doc -->
+	 * @param value the new value of the '<em>History Vector</em>' containment reference.
+	 * @see #getHistoryVector()
+	 * @generated
+	 */
+	void setHistoryVector(StateVector value);
 } // ExecutionRegion

+ 94 - 10
plugins/org.yakindu.sct.model.sexec/src/org/yakindu/sct/model/sexec/SexecPackage.java

@@ -235,6 +235,15 @@ public interface SexecPackage extends EPackage {
 	 */
 	int EXECUTION_FLOW__REGIONS = SGraphPackage.SCOPED_ELEMENT_FEATURE_COUNT + 9;
 
+	/**
+	 * The feature id for the '<em><b>History Vector</b></em>' containment reference.
+	 * <!-- begin-user-doc -->
+	 * <!-- end-user-doc -->
+	 * @generated
+	 * @ordered
+	 */
+	int EXECUTION_FLOW__HISTORY_VECTOR = SGraphPackage.SCOPED_ELEMENT_FEATURE_COUNT + 10;
+
 	/**
 	 * The number of structural features of the '<em>Execution Flow</em>' class.
 	 * <!-- begin-user-doc -->
@@ -242,7 +251,7 @@ public interface SexecPackage extends EPackage {
 	 * @generated
 	 * @ordered
 	 */
-	int EXECUTION_FLOW_FEATURE_COUNT = SGraphPackage.SCOPED_ELEMENT_FEATURE_COUNT + 10;
+	int EXECUTION_FLOW_FEATURE_COUNT = SGraphPackage.SCOPED_ELEMENT_FEATURE_COUNT + 11;
 
 	/**
 	 * The meta object id for the '{@link org.yakindu.sct.model.sexec.impl.ExecutionNodeImpl <em>Execution Node</em>}' class.
@@ -700,13 +709,31 @@ public interface SexecPackage extends EPackage {
 	int EXECUTION_REGION__EXIT_SEQUENCE = EXECUTION_SCOPE__EXIT_SEQUENCE;
 
 	/**
-	 * The feature id for the '<em><b>History State Vector</b></em>' containment reference.
+	 * The feature id for the '<em><b>Deep Enter Sequence</b></em>' containment reference.
+	 * <!-- begin-user-doc -->
+	 * <!-- end-user-doc -->
+	 * @generated
+	 * @ordered
+	 */
+	int EXECUTION_REGION__DEEP_ENTER_SEQUENCE = EXECUTION_SCOPE_FEATURE_COUNT + 0;
+
+	/**
+	 * The feature id for the '<em><b>Shallow Enter Sequence</b></em>' containment reference.
+	 * <!-- begin-user-doc -->
+	 * <!-- end-user-doc -->
+	 * @generated
+	 * @ordered
+	 */
+	int EXECUTION_REGION__SHALLOW_ENTER_SEQUENCE = EXECUTION_SCOPE_FEATURE_COUNT + 1;
+
+	/**
+	 * The feature id for the '<em><b>History Vector</b></em>' containment reference.
 	 * <!-- begin-user-doc -->
 	 * <!-- end-user-doc -->
 	 * @generated
 	 * @ordered
 	 */
-	int EXECUTION_REGION__HISTORY_STATE_VECTOR = EXECUTION_SCOPE_FEATURE_COUNT + 0;
+	int EXECUTION_REGION__HISTORY_VECTOR = EXECUTION_SCOPE_FEATURE_COUNT + 2;
 
 	/**
 	 * The number of structural features of the '<em>Execution Region</em>' class.
@@ -715,7 +742,7 @@ public interface SexecPackage extends EPackage {
 	 * @generated
 	 * @ordered
 	 */
-	int EXECUTION_REGION_FEATURE_COUNT = EXECUTION_SCOPE_FEATURE_COUNT + 1;
+	int EXECUTION_REGION_FEATURE_COUNT = EXECUTION_SCOPE_FEATURE_COUNT + 3;
 
 	/**
 	 * The meta object id for the '{@link org.yakindu.sct.model.sexec.impl.ExecutionEntryImpl <em>Execution Entry</em>}' class.
@@ -2104,6 +2131,17 @@ public interface SexecPackage extends EPackage {
 	 */
 	EReference getExecutionFlow_Regions();
 
+	/**
+	 * Returns the meta object for the containment reference '{@link org.yakindu.sct.model.sexec.ExecutionFlow#getHistoryVector <em>History Vector</em>}'.
+	 * <!-- begin-user-doc -->
+	 * <!-- end-user-doc -->
+	 * @return the meta object for the containment reference '<em>History Vector</em>'.
+	 * @see org.yakindu.sct.model.sexec.ExecutionFlow#getHistoryVector()
+	 * @see #getExecutionFlow()
+	 * @generated
+	 */
+	EReference getExecutionFlow_HistoryVector();
+
 	/**
 	 * Returns the meta object for class '{@link org.yakindu.sct.model.sexec.ExecutionNode <em>Execution Node</em>}'.
 	 * <!-- begin-user-doc -->
@@ -2255,15 +2293,37 @@ public interface SexecPackage extends EPackage {
 	EClass getExecutionRegion();
 
 	/**
-	 * Returns the meta object for the containment reference '{@link org.yakindu.sct.model.sexec.ExecutionRegion#getHistoryStateVector <em>History State Vector</em>}'.
+	 * Returns the meta object for the containment reference '{@link org.yakindu.sct.model.sexec.ExecutionRegion#getDeepEnterSequence <em>Deep Enter Sequence</em>}'.
+	 * <!-- begin-user-doc -->
+	 * <!-- end-user-doc -->
+	 * @return the meta object for the containment reference '<em>Deep Enter Sequence</em>'.
+	 * @see org.yakindu.sct.model.sexec.ExecutionRegion#getDeepEnterSequence()
+	 * @see #getExecutionRegion()
+	 * @generated
+	 */
+	EReference getExecutionRegion_DeepEnterSequence();
+
+	/**
+	 * Returns the meta object for the containment reference '{@link org.yakindu.sct.model.sexec.ExecutionRegion#getShallowEnterSequence <em>Shallow Enter Sequence</em>}'.
 	 * <!-- begin-user-doc -->
 	 * <!-- end-user-doc -->
-	 * @return the meta object for the containment reference '<em>History State Vector</em>'.
-	 * @see org.yakindu.sct.model.sexec.ExecutionRegion#getHistoryStateVector()
+	 * @return the meta object for the containment reference '<em>Shallow Enter Sequence</em>'.
+	 * @see org.yakindu.sct.model.sexec.ExecutionRegion#getShallowEnterSequence()
 	 * @see #getExecutionRegion()
 	 * @generated
 	 */
-	EReference getExecutionRegion_HistoryStateVector();
+	EReference getExecutionRegion_ShallowEnterSequence();
+
+	/**
+	 * Returns the meta object for the containment reference '{@link org.yakindu.sct.model.sexec.ExecutionRegion#getHistoryVector <em>History Vector</em>}'.
+	 * <!-- begin-user-doc -->
+	 * <!-- end-user-doc -->
+	 * @return the meta object for the containment reference '<em>History Vector</em>'.
+	 * @see org.yakindu.sct.model.sexec.ExecutionRegion#getHistoryVector()
+	 * @see #getExecutionRegion()
+	 * @generated
+	 */
+	EReference getExecutionRegion_HistoryVector();
 
 	/**
 	 * Returns the meta object for class '{@link org.yakindu.sct.model.sexec.ExecutionEntry <em>Execution Entry</em>}'.
@@ -3031,6 +3091,14 @@ public interface SexecPackage extends EPackage {
 		 */
 		EReference EXECUTION_FLOW__REGIONS = eINSTANCE.getExecutionFlow_Regions();
 
+		/**
+		 * The meta object literal for the '<em><b>History Vector</b></em>' containment reference feature.
+		 * <!-- begin-user-doc -->
+		 * <!-- end-user-doc -->
+		 * @generated
+		 */
+		EReference EXECUTION_FLOW__HISTORY_VECTOR = eINSTANCE.getExecutionFlow_HistoryVector();
+
 		/**
 		 * The meta object literal for the '{@link org.yakindu.sct.model.sexec.impl.ExecutionNodeImpl <em>Execution Node</em>}' class.
 		 * <!-- begin-user-doc -->
@@ -3152,12 +3220,28 @@ public interface SexecPackage extends EPackage {
 		EClass EXECUTION_REGION = eINSTANCE.getExecutionRegion();
 
 		/**
-		 * The meta object literal for the '<em><b>History State Vector</b></em>' containment reference feature.
+		 * The meta object literal for the '<em><b>Deep Enter Sequence</b></em>' containment reference feature.
+		 * <!-- begin-user-doc -->
+		 * <!-- end-user-doc -->
+		 * @generated
+		 */
+		EReference EXECUTION_REGION__DEEP_ENTER_SEQUENCE = eINSTANCE.getExecutionRegion_DeepEnterSequence();
+
+		/**
+		 * The meta object literal for the '<em><b>Shallow Enter Sequence</b></em>' containment reference feature.
+		 * <!-- begin-user-doc -->
+		 * <!-- end-user-doc -->
+		 * @generated
+		 */
+		EReference EXECUTION_REGION__SHALLOW_ENTER_SEQUENCE = eINSTANCE.getExecutionRegion_ShallowEnterSequence();
+
+		/**
+		 * The meta object literal for the '<em><b>History Vector</b></em>' containment reference feature.
 		 * <!-- begin-user-doc -->
 		 * <!-- end-user-doc -->
 		 * @generated
 		 */
-		EReference EXECUTION_REGION__HISTORY_STATE_VECTOR = eINSTANCE.getExecutionRegion_HistoryStateVector();
+		EReference EXECUTION_REGION__HISTORY_VECTOR = eINSTANCE.getExecutionRegion_HistoryVector();
 
 		/**
 		 * The meta object literal for the '{@link org.yakindu.sct.model.sexec.impl.ExecutionEntryImpl <em>Execution Entry</em>}' class.

+ 66 - 0
plugins/org.yakindu.sct.model.sexec/src/org/yakindu/sct/model/sexec/impl/ExecutionFlowImpl.java

@@ -47,6 +47,7 @@ import org.yakindu.sct.model.sgraph.impl.ScopedElementImpl;
  *   <li>{@link org.yakindu.sct.model.sexec.impl.ExecutionFlowImpl#getStates <em>States</em>}</li>
  *   <li>{@link org.yakindu.sct.model.sexec.impl.ExecutionFlowImpl#getNodes <em>Nodes</em>}</li>
  *   <li>{@link org.yakindu.sct.model.sexec.impl.ExecutionFlowImpl#getRegions <em>Regions</em>}</li>
+ *   <li>{@link org.yakindu.sct.model.sexec.impl.ExecutionFlowImpl#getHistoryVector <em>History Vector</em>}</li>
  * </ul>
  * </p>
  *
@@ -163,6 +164,16 @@ public class ExecutionFlowImpl extends ScopedElementImpl implements ExecutionFlo
 	 */
 	protected EList<ExecutionRegion> regions;
 
+	/**
+	 * The cached value of the '{@link #getHistoryVector() <em>History Vector</em>}' containment reference.
+	 * <!-- begin-user-doc -->
+	 * <!-- end-user-doc -->
+	 * @see #getHistoryVector()
+	 * @generated
+	 * @ordered
+	 */
+	protected StateVector historyVector;
+
 	/**
 	 * <!-- begin-user-doc -->
 	 * <!-- end-user-doc -->
@@ -478,6 +489,49 @@ public class ExecutionFlowImpl extends ScopedElementImpl implements ExecutionFlo
 		return regions;
 	}
 
+	/**
+	 * <!-- begin-user-doc -->
+	 * <!-- end-user-doc -->
+	 * @generated
+	 */
+	public StateVector getHistoryVector() {
+		return historyVector;
+	}
+
+	/**
+	 * <!-- begin-user-doc -->
+	 * <!-- end-user-doc -->
+	 * @generated
+	 */
+	public NotificationChain basicSetHistoryVector(StateVector newHistoryVector, NotificationChain msgs) {
+		StateVector oldHistoryVector = historyVector;
+		historyVector = newHistoryVector;
+		if (eNotificationRequired()) {
+			ENotificationImpl notification = new ENotificationImpl(this, Notification.SET, SexecPackage.EXECUTION_FLOW__HISTORY_VECTOR, oldHistoryVector, newHistoryVector);
+			if (msgs == null) msgs = notification; else msgs.add(notification);
+		}
+		return msgs;
+	}
+
+	/**
+	 * <!-- begin-user-doc -->
+	 * <!-- end-user-doc -->
+	 * @generated
+	 */
+	public void setHistoryVector(StateVector newHistoryVector) {
+		if (newHistoryVector != historyVector) {
+			NotificationChain msgs = null;
+			if (historyVector != null)
+				msgs = ((InternalEObject)historyVector).eInverseRemove(this, EOPPOSITE_FEATURE_BASE - SexecPackage.EXECUTION_FLOW__HISTORY_VECTOR, null, msgs);
+			if (newHistoryVector != null)
+				msgs = ((InternalEObject)newHistoryVector).eInverseAdd(this, EOPPOSITE_FEATURE_BASE - SexecPackage.EXECUTION_FLOW__HISTORY_VECTOR, null, msgs);
+			msgs = basicSetHistoryVector(newHistoryVector, msgs);
+			if (msgs != null) msgs.dispatch();
+		}
+		else if (eNotificationRequired())
+			eNotify(new ENotificationImpl(this, Notification.SET, SexecPackage.EXECUTION_FLOW__HISTORY_VECTOR, newHistoryVector, newHistoryVector));
+	}
+
 	/**
 	 * <!-- begin-user-doc -->
 	 * <!-- end-user-doc -->
@@ -521,6 +575,8 @@ public class ExecutionFlowImpl extends ScopedElementImpl implements ExecutionFlo
 				return ((InternalEList<?>)getNodes()).basicRemove(otherEnd, msgs);
 			case SexecPackage.EXECUTION_FLOW__REGIONS:
 				return ((InternalEList<?>)getRegions()).basicRemove(otherEnd, msgs);
+			case SexecPackage.EXECUTION_FLOW__HISTORY_VECTOR:
+				return basicSetHistoryVector(null, msgs);
 		}
 		return super.eInverseRemove(otherEnd, featureID, msgs);
 	}
@@ -555,6 +611,8 @@ public class ExecutionFlowImpl extends ScopedElementImpl implements ExecutionFlo
 				return getNodes();
 			case SexecPackage.EXECUTION_FLOW__REGIONS:
 				return getRegions();
+			case SexecPackage.EXECUTION_FLOW__HISTORY_VECTOR:
+				return getHistoryVector();
 		}
 		return super.eGet(featureID, resolve, coreType);
 	}
@@ -602,6 +660,9 @@ public class ExecutionFlowImpl extends ScopedElementImpl implements ExecutionFlo
 				getRegions().clear();
 				getRegions().addAll((Collection<? extends ExecutionRegion>)newValue);
 				return;
+			case SexecPackage.EXECUTION_FLOW__HISTORY_VECTOR:
+				setHistoryVector((StateVector)newValue);
+				return;
 		}
 		super.eSet(featureID, newValue);
 	}
@@ -644,6 +705,9 @@ public class ExecutionFlowImpl extends ScopedElementImpl implements ExecutionFlo
 			case SexecPackage.EXECUTION_FLOW__REGIONS:
 				getRegions().clear();
 				return;
+			case SexecPackage.EXECUTION_FLOW__HISTORY_VECTOR:
+				setHistoryVector((StateVector)null);
+				return;
 		}
 		super.eUnset(featureID);
 	}
@@ -676,6 +740,8 @@ public class ExecutionFlowImpl extends ScopedElementImpl implements ExecutionFlo
 				return nodes != null && !nodes.isEmpty();
 			case SexecPackage.EXECUTION_FLOW__REGIONS:
 				return regions != null && !regions.isEmpty();
+			case SexecPackage.EXECUTION_FLOW__HISTORY_VECTOR:
+				return historyVector != null;
 		}
 		return super.eIsSet(featureID);
 	}

+ 159 - 29
plugins/org.yakindu.sct.model.sexec/src/org/yakindu/sct/model/sexec/impl/ExecutionRegionImpl.java

@@ -13,6 +13,7 @@ import org.eclipse.emf.ecore.EClass;
 import org.eclipse.emf.ecore.InternalEObject;
 import org.eclipse.emf.ecore.impl.ENotificationImpl;
 import org.yakindu.sct.model.sexec.ExecutionRegion;
+import org.yakindu.sct.model.sexec.Sequence;
 import org.yakindu.sct.model.sexec.SexecPackage;
 import org.yakindu.sct.model.sexec.StateVector;
 
@@ -23,7 +24,9 @@ import org.yakindu.sct.model.sexec.StateVector;
  * <p>
  * The following features are implemented:
  * <ul>
- *   <li>{@link org.yakindu.sct.model.sexec.impl.ExecutionRegionImpl#getHistoryStateVector <em>History State Vector</em>}</li>
+ *   <li>{@link org.yakindu.sct.model.sexec.impl.ExecutionRegionImpl#getDeepEnterSequence <em>Deep Enter Sequence</em>}</li>
+ *   <li>{@link org.yakindu.sct.model.sexec.impl.ExecutionRegionImpl#getShallowEnterSequence <em>Shallow Enter Sequence</em>}</li>
+ *   <li>{@link org.yakindu.sct.model.sexec.impl.ExecutionRegionImpl#getHistoryVector <em>History Vector</em>}</li>
  * </ul>
  * </p>
  *
@@ -31,15 +34,32 @@ import org.yakindu.sct.model.sexec.StateVector;
  */
 public class ExecutionRegionImpl extends ExecutionScopeImpl implements ExecutionRegion {
 	/**
-	 * The cached value of the '{@link #getHistoryStateVector() <em>History State Vector</em>}' containment reference.
+	 * The cached value of the '{@link #getDeepEnterSequence() <em>Deep Enter Sequence</em>}' containment reference.
 	 * <!-- begin-user-doc -->
 	 * <!-- end-user-doc -->
-	 * @see #getHistoryStateVector()
+	 * @see #getDeepEnterSequence()
 	 * @generated
 	 * @ordered
 	 */
-	protected StateVector historyStateVector;
-
+	protected Sequence deepEnterSequence;
+	/**
+	 * The cached value of the '{@link #getShallowEnterSequence() <em>Shallow Enter Sequence</em>}' containment reference.
+	 * <!-- begin-user-doc -->
+	 * <!-- end-user-doc -->
+	 * @see #getShallowEnterSequence()
+	 * @generated
+	 * @ordered
+	 */
+	protected Sequence shallowEnterSequence;
+	/**
+	 * The cached value of the '{@link #getHistoryVector() <em>History Vector</em>}' containment reference.
+	 * <!-- begin-user-doc -->
+	 * <!-- end-user-doc -->
+	 * @see #getHistoryVector()
+	 * @generated
+	 * @ordered
+	 */
+	protected StateVector historyVector;
 	/**
 	 * <!-- begin-user-doc -->
 	 * <!-- end-user-doc -->
@@ -64,8 +84,8 @@ public class ExecutionRegionImpl extends ExecutionScopeImpl implements Execution
 	 * <!-- end-user-doc -->
 	 * @generated
 	 */
-	public StateVector getHistoryStateVector() {
-		return historyStateVector;
+	public Sequence getDeepEnterSequence() {
+		return deepEnterSequence;
 	}
 
 	/**
@@ -73,11 +93,11 @@ public class ExecutionRegionImpl extends ExecutionScopeImpl implements Execution
 	 * <!-- end-user-doc -->
 	 * @generated
 	 */
-	public NotificationChain basicSetHistoryStateVector(StateVector newHistoryStateVector, NotificationChain msgs) {
-		StateVector oldHistoryStateVector = historyStateVector;
-		historyStateVector = newHistoryStateVector;
+	public NotificationChain basicSetDeepEnterSequence(Sequence newDeepEnterSequence, NotificationChain msgs) {
+		Sequence oldDeepEnterSequence = deepEnterSequence;
+		deepEnterSequence = newDeepEnterSequence;
 		if (eNotificationRequired()) {
-			ENotificationImpl notification = new ENotificationImpl(this, Notification.SET, SexecPackage.EXECUTION_REGION__HISTORY_STATE_VECTOR, oldHistoryStateVector, newHistoryStateVector);
+			ENotificationImpl notification = new ENotificationImpl(this, Notification.SET, SexecPackage.EXECUTION_REGION__DEEP_ENTER_SEQUENCE, oldDeepEnterSequence, newDeepEnterSequence);
 			if (msgs == null) msgs = notification; else msgs.add(notification);
 		}
 		return msgs;
@@ -88,18 +108,104 @@ public class ExecutionRegionImpl extends ExecutionScopeImpl implements Execution
 	 * <!-- end-user-doc -->
 	 * @generated
 	 */
-	public void setHistoryStateVector(StateVector newHistoryStateVector) {
-		if (newHistoryStateVector != historyStateVector) {
+	public void setDeepEnterSequence(Sequence newDeepEnterSequence) {
+		if (newDeepEnterSequence != deepEnterSequence) {
 			NotificationChain msgs = null;
-			if (historyStateVector != null)
-				msgs = ((InternalEObject)historyStateVector).eInverseRemove(this, EOPPOSITE_FEATURE_BASE - SexecPackage.EXECUTION_REGION__HISTORY_STATE_VECTOR, null, msgs);
-			if (newHistoryStateVector != null)
-				msgs = ((InternalEObject)newHistoryStateVector).eInverseAdd(this, EOPPOSITE_FEATURE_BASE - SexecPackage.EXECUTION_REGION__HISTORY_STATE_VECTOR, null, msgs);
-			msgs = basicSetHistoryStateVector(newHistoryStateVector, msgs);
+			if (deepEnterSequence != null)
+				msgs = ((InternalEObject)deepEnterSequence).eInverseRemove(this, EOPPOSITE_FEATURE_BASE - SexecPackage.EXECUTION_REGION__DEEP_ENTER_SEQUENCE, null, msgs);
+			if (newDeepEnterSequence != null)
+				msgs = ((InternalEObject)newDeepEnterSequence).eInverseAdd(this, EOPPOSITE_FEATURE_BASE - SexecPackage.EXECUTION_REGION__DEEP_ENTER_SEQUENCE, null, msgs);
+			msgs = basicSetDeepEnterSequence(newDeepEnterSequence, msgs);
 			if (msgs != null) msgs.dispatch();
 		}
 		else if (eNotificationRequired())
-			eNotify(new ENotificationImpl(this, Notification.SET, SexecPackage.EXECUTION_REGION__HISTORY_STATE_VECTOR, newHistoryStateVector, newHistoryStateVector));
+			eNotify(new ENotificationImpl(this, Notification.SET, SexecPackage.EXECUTION_REGION__DEEP_ENTER_SEQUENCE, newDeepEnterSequence, newDeepEnterSequence));
+	}
+
+	/**
+	 * <!-- begin-user-doc -->
+	 * <!-- end-user-doc -->
+	 * @generated
+	 */
+	public Sequence getShallowEnterSequence() {
+		return shallowEnterSequence;
+	}
+
+	/**
+	 * <!-- begin-user-doc -->
+	 * <!-- end-user-doc -->
+	 * @generated
+	 */
+	public NotificationChain basicSetShallowEnterSequence(Sequence newShallowEnterSequence, NotificationChain msgs) {
+		Sequence oldShallowEnterSequence = shallowEnterSequence;
+		shallowEnterSequence = newShallowEnterSequence;
+		if (eNotificationRequired()) {
+			ENotificationImpl notification = new ENotificationImpl(this, Notification.SET, SexecPackage.EXECUTION_REGION__SHALLOW_ENTER_SEQUENCE, oldShallowEnterSequence, newShallowEnterSequence);
+			if (msgs == null) msgs = notification; else msgs.add(notification);
+		}
+		return msgs;
+	}
+
+	/**
+	 * <!-- begin-user-doc -->
+	 * <!-- end-user-doc -->
+	 * @generated
+	 */
+	public void setShallowEnterSequence(Sequence newShallowEnterSequence) {
+		if (newShallowEnterSequence != shallowEnterSequence) {
+			NotificationChain msgs = null;
+			if (shallowEnterSequence != null)
+				msgs = ((InternalEObject)shallowEnterSequence).eInverseRemove(this, EOPPOSITE_FEATURE_BASE - SexecPackage.EXECUTION_REGION__SHALLOW_ENTER_SEQUENCE, null, msgs);
+			if (newShallowEnterSequence != null)
+				msgs = ((InternalEObject)newShallowEnterSequence).eInverseAdd(this, EOPPOSITE_FEATURE_BASE - SexecPackage.EXECUTION_REGION__SHALLOW_ENTER_SEQUENCE, null, msgs);
+			msgs = basicSetShallowEnterSequence(newShallowEnterSequence, msgs);
+			if (msgs != null) msgs.dispatch();
+		}
+		else if (eNotificationRequired())
+			eNotify(new ENotificationImpl(this, Notification.SET, SexecPackage.EXECUTION_REGION__SHALLOW_ENTER_SEQUENCE, newShallowEnterSequence, newShallowEnterSequence));
+	}
+
+	/**
+	 * <!-- begin-user-doc -->
+	 * <!-- end-user-doc -->
+	 * @generated
+	 */
+	public StateVector getHistoryVector() {
+		return historyVector;
+	}
+
+	/**
+	 * <!-- begin-user-doc -->
+	 * <!-- end-user-doc -->
+	 * @generated
+	 */
+	public NotificationChain basicSetHistoryVector(StateVector newHistoryVector, NotificationChain msgs) {
+		StateVector oldHistoryVector = historyVector;
+		historyVector = newHistoryVector;
+		if (eNotificationRequired()) {
+			ENotificationImpl notification = new ENotificationImpl(this, Notification.SET, SexecPackage.EXECUTION_REGION__HISTORY_VECTOR, oldHistoryVector, newHistoryVector);
+			if (msgs == null) msgs = notification; else msgs.add(notification);
+		}
+		return msgs;
+	}
+
+	/**
+	 * <!-- begin-user-doc -->
+	 * <!-- end-user-doc -->
+	 * @generated
+	 */
+	public void setHistoryVector(StateVector newHistoryVector) {
+		if (newHistoryVector != historyVector) {
+			NotificationChain msgs = null;
+			if (historyVector != null)
+				msgs = ((InternalEObject)historyVector).eInverseRemove(this, EOPPOSITE_FEATURE_BASE - SexecPackage.EXECUTION_REGION__HISTORY_VECTOR, null, msgs);
+			if (newHistoryVector != null)
+				msgs = ((InternalEObject)newHistoryVector).eInverseAdd(this, EOPPOSITE_FEATURE_BASE - SexecPackage.EXECUTION_REGION__HISTORY_VECTOR, null, msgs);
+			msgs = basicSetHistoryVector(newHistoryVector, msgs);
+			if (msgs != null) msgs.dispatch();
+		}
+		else if (eNotificationRequired())
+			eNotify(new ENotificationImpl(this, Notification.SET, SexecPackage.EXECUTION_REGION__HISTORY_VECTOR, newHistoryVector, newHistoryVector));
 	}
 
 	/**
@@ -110,8 +216,12 @@ public class ExecutionRegionImpl extends ExecutionScopeImpl implements Execution
 	@Override
 	public NotificationChain eInverseRemove(InternalEObject otherEnd, int featureID, NotificationChain msgs) {
 		switch (featureID) {
-			case SexecPackage.EXECUTION_REGION__HISTORY_STATE_VECTOR:
-				return basicSetHistoryStateVector(null, msgs);
+			case SexecPackage.EXECUTION_REGION__DEEP_ENTER_SEQUENCE:
+				return basicSetDeepEnterSequence(null, msgs);
+			case SexecPackage.EXECUTION_REGION__SHALLOW_ENTER_SEQUENCE:
+				return basicSetShallowEnterSequence(null, msgs);
+			case SexecPackage.EXECUTION_REGION__HISTORY_VECTOR:
+				return basicSetHistoryVector(null, msgs);
 		}
 		return super.eInverseRemove(otherEnd, featureID, msgs);
 	}
@@ -124,8 +234,12 @@ public class ExecutionRegionImpl extends ExecutionScopeImpl implements Execution
 	@Override
 	public Object eGet(int featureID, boolean resolve, boolean coreType) {
 		switch (featureID) {
-			case SexecPackage.EXECUTION_REGION__HISTORY_STATE_VECTOR:
-				return getHistoryStateVector();
+			case SexecPackage.EXECUTION_REGION__DEEP_ENTER_SEQUENCE:
+				return getDeepEnterSequence();
+			case SexecPackage.EXECUTION_REGION__SHALLOW_ENTER_SEQUENCE:
+				return getShallowEnterSequence();
+			case SexecPackage.EXECUTION_REGION__HISTORY_VECTOR:
+				return getHistoryVector();
 		}
 		return super.eGet(featureID, resolve, coreType);
 	}
@@ -138,8 +252,14 @@ public class ExecutionRegionImpl extends ExecutionScopeImpl implements Execution
 	@Override
 	public void eSet(int featureID, Object newValue) {
 		switch (featureID) {
-			case SexecPackage.EXECUTION_REGION__HISTORY_STATE_VECTOR:
-				setHistoryStateVector((StateVector)newValue);
+			case SexecPackage.EXECUTION_REGION__DEEP_ENTER_SEQUENCE:
+				setDeepEnterSequence((Sequence)newValue);
+				return;
+			case SexecPackage.EXECUTION_REGION__SHALLOW_ENTER_SEQUENCE:
+				setShallowEnterSequence((Sequence)newValue);
+				return;
+			case SexecPackage.EXECUTION_REGION__HISTORY_VECTOR:
+				setHistoryVector((StateVector)newValue);
 				return;
 		}
 		super.eSet(featureID, newValue);
@@ -153,8 +273,14 @@ public class ExecutionRegionImpl extends ExecutionScopeImpl implements Execution
 	@Override
 	public void eUnset(int featureID) {
 		switch (featureID) {
-			case SexecPackage.EXECUTION_REGION__HISTORY_STATE_VECTOR:
-				setHistoryStateVector((StateVector)null);
+			case SexecPackage.EXECUTION_REGION__DEEP_ENTER_SEQUENCE:
+				setDeepEnterSequence((Sequence)null);
+				return;
+			case SexecPackage.EXECUTION_REGION__SHALLOW_ENTER_SEQUENCE:
+				setShallowEnterSequence((Sequence)null);
+				return;
+			case SexecPackage.EXECUTION_REGION__HISTORY_VECTOR:
+				setHistoryVector((StateVector)null);
 				return;
 		}
 		super.eUnset(featureID);
@@ -168,8 +294,12 @@ public class ExecutionRegionImpl extends ExecutionScopeImpl implements Execution
 	@Override
 	public boolean eIsSet(int featureID) {
 		switch (featureID) {
-			case SexecPackage.EXECUTION_REGION__HISTORY_STATE_VECTOR:
-				return historyStateVector != null;
+			case SexecPackage.EXECUTION_REGION__DEEP_ENTER_SEQUENCE:
+				return deepEnterSequence != null;
+			case SexecPackage.EXECUTION_REGION__SHALLOW_ENTER_SEQUENCE:
+				return shallowEnterSequence != null;
+			case SexecPackage.EXECUTION_REGION__HISTORY_VECTOR:
+				return historyVector != null;
 		}
 		return super.eIsSet(featureID);
 	}

+ 36 - 3
plugins/org.yakindu.sct.model.sexec/src/org/yakindu/sct/model/sexec/impl/SexecPackageImpl.java

@@ -382,6 +382,15 @@ public class SexecPackageImpl extends EPackageImpl implements SexecPackage {
 		return (EReference)executionFlowEClass.getEStructuralFeatures().get(2);
 	}
 
+	/**
+	 * <!-- begin-user-doc -->
+	 * <!-- end-user-doc -->
+	 * @generated
+	 */
+	public EReference getExecutionFlow_HistoryVector() {
+		return (EReference)executionFlowEClass.getEStructuralFeatures().get(3);
+	}
+
 	/**
 	 * <!-- begin-user-doc -->
 	 * <!-- end-user-doc -->
@@ -513,10 +522,28 @@ public class SexecPackageImpl extends EPackageImpl implements SexecPackage {
 	 * <!-- end-user-doc -->
 	 * @generated
 	 */
-	public EReference getExecutionRegion_HistoryStateVector() {
+	public EReference getExecutionRegion_DeepEnterSequence() {
 		return (EReference)executionRegionEClass.getEStructuralFeatures().get(0);
 	}
 
+	/**
+	 * <!-- begin-user-doc -->
+	 * <!-- end-user-doc -->
+	 * @generated
+	 */
+	public EReference getExecutionRegion_ShallowEnterSequence() {
+		return (EReference)executionRegionEClass.getEStructuralFeatures().get(1);
+	}
+
+	/**
+	 * <!-- begin-user-doc -->
+	 * <!-- end-user-doc -->
+	 * @generated
+	 */
+	public EReference getExecutionRegion_HistoryVector() {
+		return (EReference)executionRegionEClass.getEStructuralFeatures().get(2);
+	}
+
 	/**
 	 * <!-- begin-user-doc -->
 	 * <!-- end-user-doc -->
@@ -1158,6 +1185,7 @@ public class SexecPackageImpl extends EPackageImpl implements SexecPackage {
 		createEReference(executionFlowEClass, EXECUTION_FLOW__STATES);
 		createEReference(executionFlowEClass, EXECUTION_FLOW__NODES);
 		createEReference(executionFlowEClass, EXECUTION_FLOW__REGIONS);
+		createEReference(executionFlowEClass, EXECUTION_FLOW__HISTORY_VECTOR);
 
 		executionNodeEClass = createEClass(EXECUTION_NODE);
 		createEReference(executionNodeEClass, EXECUTION_NODE__REACTIONS);
@@ -1177,7 +1205,9 @@ public class SexecPackageImpl extends EPackageImpl implements SexecPackage {
 		createEReference(executionScopeEClass, EXECUTION_SCOPE__EXIT_SEQUENCE);
 
 		executionRegionEClass = createEClass(EXECUTION_REGION);
-		createEReference(executionRegionEClass, EXECUTION_REGION__HISTORY_STATE_VECTOR);
+		createEReference(executionRegionEClass, EXECUTION_REGION__DEEP_ENTER_SEQUENCE);
+		createEReference(executionRegionEClass, EXECUTION_REGION__SHALLOW_ENTER_SEQUENCE);
+		createEReference(executionRegionEClass, EXECUTION_REGION__HISTORY_VECTOR);
 
 		executionEntryEClass = createEClass(EXECUTION_ENTRY);
 
@@ -1343,6 +1373,7 @@ public class SexecPackageImpl extends EPackageImpl implements SexecPackage {
 		initEReference(getExecutionFlow_States(), this.getExecutionState(), null, "states", null, 0, -1, ExecutionFlow.class, !IS_TRANSIENT, !IS_VOLATILE, IS_CHANGEABLE, IS_COMPOSITE, !IS_RESOLVE_PROXIES, !IS_UNSETTABLE, IS_UNIQUE, !IS_DERIVED, IS_ORDERED);
 		initEReference(getExecutionFlow_Nodes(), this.getExecutionNode(), null, "nodes", null, 0, -1, ExecutionFlow.class, !IS_TRANSIENT, !IS_VOLATILE, IS_CHANGEABLE, IS_COMPOSITE, !IS_RESOLVE_PROXIES, !IS_UNSETTABLE, IS_UNIQUE, !IS_DERIVED, IS_ORDERED);
 		initEReference(getExecutionFlow_Regions(), this.getExecutionRegion(), null, "regions", null, 0, -1, ExecutionFlow.class, !IS_TRANSIENT, !IS_VOLATILE, IS_CHANGEABLE, IS_COMPOSITE, !IS_RESOLVE_PROXIES, !IS_UNSETTABLE, IS_UNIQUE, !IS_DERIVED, IS_ORDERED);
+		initEReference(getExecutionFlow_HistoryVector(), this.getStateVector(), null, "historyVector", null, 0, 1, ExecutionFlow.class, !IS_TRANSIENT, !IS_VOLATILE, IS_CHANGEABLE, IS_COMPOSITE, !IS_RESOLVE_PROXIES, !IS_UNSETTABLE, IS_UNIQUE, !IS_DERIVED, IS_ORDERED);
 
 		initEClass(executionNodeEClass, ExecutionNode.class, "ExecutionNode", !IS_ABSTRACT, !IS_INTERFACE, IS_GENERATED_INSTANCE_CLASS);
 		initEReference(getExecutionNode_Reactions(), this.getReaction(), null, "reactions", null, 0, -1, ExecutionNode.class, !IS_TRANSIENT, !IS_VOLATILE, IS_CHANGEABLE, IS_COMPOSITE, !IS_RESOLVE_PROXIES, !IS_UNSETTABLE, IS_UNIQUE, !IS_DERIVED, IS_ORDERED);
@@ -1362,7 +1393,9 @@ public class SexecPackageImpl extends EPackageImpl implements SexecPackage {
 		initEReference(getExecutionScope_ExitSequence(), this.getSequence(), null, "exitSequence", null, 0, 1, ExecutionScope.class, !IS_TRANSIENT, !IS_VOLATILE, IS_CHANGEABLE, IS_COMPOSITE, !IS_RESOLVE_PROXIES, !IS_UNSETTABLE, IS_UNIQUE, !IS_DERIVED, IS_ORDERED);
 
 		initEClass(executionRegionEClass, ExecutionRegion.class, "ExecutionRegion", !IS_ABSTRACT, !IS_INTERFACE, IS_GENERATED_INSTANCE_CLASS);
-		initEReference(getExecutionRegion_HistoryStateVector(), this.getStateVector(), null, "historyStateVector", null, 0, 1, ExecutionRegion.class, !IS_TRANSIENT, !IS_VOLATILE, IS_CHANGEABLE, IS_COMPOSITE, !IS_RESOLVE_PROXIES, !IS_UNSETTABLE, IS_UNIQUE, !IS_DERIVED, IS_ORDERED);
+		initEReference(getExecutionRegion_DeepEnterSequence(), this.getSequence(), null, "deepEnterSequence", null, 0, 1, ExecutionRegion.class, !IS_TRANSIENT, !IS_VOLATILE, IS_CHANGEABLE, IS_COMPOSITE, !IS_RESOLVE_PROXIES, !IS_UNSETTABLE, IS_UNIQUE, !IS_DERIVED, IS_ORDERED);
+		initEReference(getExecutionRegion_ShallowEnterSequence(), this.getSequence(), null, "shallowEnterSequence", null, 0, 1, ExecutionRegion.class, !IS_TRANSIENT, !IS_VOLATILE, IS_CHANGEABLE, IS_COMPOSITE, !IS_RESOLVE_PROXIES, !IS_UNSETTABLE, IS_UNIQUE, !IS_DERIVED, IS_ORDERED);
+		initEReference(getExecutionRegion_HistoryVector(), this.getStateVector(), null, "historyVector", null, 0, 1, ExecutionRegion.class, !IS_TRANSIENT, !IS_VOLATILE, IS_CHANGEABLE, IS_COMPOSITE, !IS_RESOLVE_PROXIES, !IS_UNSETTABLE, IS_UNIQUE, !IS_DERIVED, IS_ORDERED);
 
 		initEClass(executionEntryEClass, ExecutionEntry.class, "ExecutionEntry", !IS_ABSTRACT, !IS_INTERFACE, IS_GENERATED_INSTANCE_CLASS);
 

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

@@ -112,7 +112,7 @@ class ModelSequencer {
 
 		// calculate state vectors
 		ef.defineStateVector(sc)
-		ef.defineHistoryStateVector(sc)
+		ef.defineHistoryVector(sc)
 		
 		// derive all additional information that is necessary for the execution
 		sc.mapEntryActions(ef)
@@ -120,6 +120,8 @@ class ModelSequencer {
 		
 		ef.defineStateEnterSequences(sc)
 		ef.defineStateExitSequences(sc)
+		ef.defineDeepEnterSequences(sc)
+		ef.defineShallowEnterSequences(sc)
 		ef.defineStatechartEnterSequence(sc)
 		ef.defineStatechartExitSequence(sc)
 		

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

@@ -73,8 +73,6 @@ class ReactionBuilder {
 		return false
 	}
 
-
-
 	def Sequence defineCycle(RegularState state) {
 	
 		val execState = state.create
@@ -151,8 +149,7 @@ class ReactionBuilder {
 				if (trace.addTraceSteps) seq.steps += e.outgoingTransitions.get(0).create.newTraceReactionFired
 				entryStep.initialStep = target.enterSequence.newCall
 			}
-			val sSwitch = (e.eContainer as Region).defineShallowHistorySwitch()
-			entryStep.historyStep = sSwitch
+			entryStep.historyStep = (e.eContainer as Region).create.shallowEnterSequence.newCall
 			
 			seq.steps += entryStep
 		} else if (e.kind == EntryKind::DEEP_HISTORY) {
@@ -167,68 +164,9 @@ class ReactionBuilder {
 				if (trace.addTraceSteps) seq.steps += e.outgoingTransitions.get(0).create.newTraceReactionFired
 				entryStep.initialStep = target.enterSequence.newCall
 			}
-			val sSwitch = (e.eContainer as Region).defineDeepHistorySwitch()
-			entryStep.historyStep = sSwitch
+			entryStep.historyStep =  (e.eContainer as Region).create.deepEnterSequence.newCall
 
 			seq.steps += entryStep
 		}
 	}
-	
-	/**
-	 * Enter switch for a region with a deep history, which must be save before
-	 */
-	def StateSwitch defineDeepHistorySwitch(Region r) {
-		r.defineDeepHistorySwitch(r.create)
-	}
-	
-	def StateSwitch defineDeepHistorySwitch(Region r, ExecutionRegion historyRegion) {
-		val execRegion = r.create
-		
-		val StateSwitch sSwitch = sexec.factory.createStateSwitch
-		sSwitch.stateConfigurationIdx = execRegion.stateVector.offset
-		sSwitch.comment = "Handle shallow history entry of " +r.name
-		sSwitch.historyRegion = historyRegion
-		
-		for (child : r.vertices.filter(typeof(State))) {
-			for (childLeaf : child.collectLeafStates(newArrayList).filter(c|c.create.stateVector.offset == sSwitch.stateConfigurationIdx)) {
-				val execChild = child.create
-				val seq = sexec.factory.createSequence
-				seq.name = "enterSequence"
-				seq.comment = "enterSequence with history in child " + child.name+" for leaf "+childLeaf.name
-				if ( execChild.leaf ) {
-					seq.steps += execChild.enterSequence.newCall
-				} else {
-					if (execChild.entryAction != null ) seq.steps += execChild.entryAction.newCall
-					if ( trace.addTraceSteps ) seq.steps += execChild.newTraceStateEntered
-					for (childRegion : child.regions) {
-						seq.steps += childRegion.defineDeepHistorySwitch(historyRegion)
-					}
-				}
-				sSwitch.cases += childLeaf.create.newCase(seq)
-			}
-		}
-		
-		return sSwitch
-	}
-
-	/**
-	 * Enter switch for a region with a shallow history, which must be save before
-	 */
-	def StateSwitch defineShallowHistorySwitch(Region r) {
-		val execRegion = r.create
-		
-		val StateSwitch sSwitch = sexec.factory.createStateSwitch
-		sSwitch.stateConfigurationIdx = execRegion.stateVector.offset
-		sSwitch.comment = "Handle shallow history entry of " +r.name
-		sSwitch.historyRegion = r.create
-		
-		for (child : r.vertices.filter(typeof(State))) {
-			val execChild = child.create
-			for (childLeaf : child.collectLeafStates(newArrayList).filter(c|c.create.stateVector.offset == sSwitch.stateConfigurationIdx)) {
-				sSwitch.cases += childLeaf.create.newCase(execChild.enterSequence.newCall)
-			}
-		}
-		
-		return sSwitch
-	}
 }

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

@@ -1,5 +1,6 @@
 package org.yakindu.sct.model.sexec.transformation
 
+import static extension org.eclipse.xtext.xtend2.lib.EObjectExtensions.*
 import static extension org.eclipse.emf.ecore.util.EcoreUtil.*
 import org.yakindu.sct.model.sexec.ExecutionFlow
 import org.yakindu.sct.model.sgraph.Statechart
@@ -35,7 +36,94 @@ class SequenceBuilder {
 	boolean _addTraceSteps 
 	
 	
-		/**
+	def void defineDeepEnterSequences(ExecutionFlow flow, Statechart sc) {
+		for ( r : sc.regions) {
+			r.defineDeepEnterSequence
+		}
+	}
+	def void defineDeepEnterSequence(State s) {
+		for (r : s.regions) {
+			r.defineDeepEnterSequence
+		}
+	}
+
+	def void defineDeepEnterSequence(Region r) {
+		for (s : r.vertices.filter(typeof(State))) {
+			s.defineDeepEnterSequence
+		}
+		
+		val execRegion = r.create
+		val seq = sexec.factory.createSequence
+		seq.name = "enterSequence"
+		seq.comment = "deep enterSequence with history in child " + r.name
+		
+		seq.steps += r.defineDeepHistorySwitch
+		execRegion.deepEnterSequence = seq
+	}
+
+	def StateSwitch defineDeepHistorySwitch(Region r) {
+		val execRegion = r.create
+		
+		val StateSwitch sSwitch = sexec.factory.createStateSwitch
+		sSwitch.stateConfigurationIdx = execRegion.stateVector.offset
+		sSwitch.comment = "Handle deep history entry of " +r.name
+		sSwitch.historyRegion = execRegion
+		
+		for (child : r.vertices.filter(typeof(State))) {
+			//TODO consider direct children
+			for (childLeaf : child.collectLeafStates(newArrayList).filter(c|c.create.stateVector.offset == sSwitch.stateConfigurationIdx)) {
+				val execChild = child.create
+				val seq = sexec.factory.createSequence
+				seq.name = "enterSequence"
+				seq.comment = "enterSequence with history in child " + child.name+" for leaf "+childLeaf.name
+				if ( execChild.leaf ) {
+					seq.steps += execChild.enterSequence.newCall
+				} else {
+					if (execChild.entryAction != null ) seq.steps += execChild.entryAction.newCall
+					if ( trace.addTraceSteps ) seq.steps += execChild.newTraceStateEntered
+					for (childRegion : child.regions) {
+						seq.steps += childRegion.create.deepEnterSequence.newCall
+					}
+				}
+				sSwitch.cases += childLeaf.create.newCase(seq)
+			}
+		}
+		
+		return sSwitch
+	}
+	
+	def void defineShallowEnterSequences(ExecutionFlow flow, Statechart sc) {
+		for ( r : sc.allContentsIterable.filter(typeof(Region))) {
+			val execRegion = r.create
+			val seq = sexec.factory.createSequence
+			seq.name = "enterSequence"
+			seq.comment = "shallow enterSequence with history in child " + r.name
+			
+			seq.steps += r.defineShallowHistorySwitch
+			execRegion.shallowEnterSequence = seq
+		}
+	}
+	
+	def StateSwitch defineShallowHistorySwitch(Region r) {
+		val execRegion = r.create
+		
+		val StateSwitch sSwitch = sexec.factory.createStateSwitch
+		sSwitch.stateConfigurationIdx = execRegion.stateVector.offset
+		sSwitch.comment = "Handle shallow history entry of " +r.name
+		sSwitch.historyRegion = r.create
+		
+		for (child : r.vertices.filter(typeof(State))) {
+			val execChild = child.create
+			//TODO consider direct children
+			for (childLeaf : child.collectLeafStates(newArrayList).filter(c|c.create.stateVector.offset == sSwitch.stateConfigurationIdx)) {
+				sSwitch.cases += childLeaf.create.newCase(execChild.enterSequence.newCall)
+			}
+		}
+		
+		return sSwitch
+	}
+	
+	/**
 	 * Defines the enter sequences of all states
 	 */
 	def void defineStateEnterSequences(ExecutionFlow flow, Statechart sc) {
@@ -131,8 +219,8 @@ class SequenceBuilder {
 		// process all states of a region
 		for ( s : r.vertices ) defineStateExitSequence(s)
 		
-		if (r.collectEntries.exists(e|e.kind == EntryKind::DEEP_HISTORY || e.kind == EntryKind::SHALLOW_HISTORY)) {
-			seq.steps += execRegion.newSaveHistory(r.collectEntries.exists(e|e.kind == EntryKind::DEEP_HISTORY))
+		if (execRegion.historyVector != null) {
+			seq.steps += execRegion.newSaveHistory()
 		}
 		
 		// collect leaf states

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

@@ -52,10 +52,9 @@ class SexecExtensions {
 		return sCase
 	}
 
-	def newSaveHistory(ExecutionRegion r, boolean deep) {
+	def newSaveHistory(ExecutionRegion r) {
 		val save = factory.createSaveHistory
 		save.region = r
-		save.deep = deep
 		return save
 	}
 

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

@@ -9,6 +9,7 @@ import org.yakindu.sct.model.sgraph.Entry
 import java.util.List
 import org.eclipse.emf.ecore.EObject
 import java.util.ArrayList
+import org.yakindu.sct.model.sgraph.EntryKind
 
 class SgraphExtensions {
 	
@@ -88,6 +89,13 @@ class SgraphExtensions {
 		return leafStates	
 	}
 	
-	
+	def requireDeepHistory(Region r) {
+		r.vertices.filter(typeof(Entry)).exists(v|v.kind == EntryKind::DEEP_HISTORY)
+	}
+
+	def requireHistory(Region r) {
+		r.vertices.filter(typeof(Entry)).exists(v|v.kind == EntryKind::SHALLOW_HISTORY)
+		|| r.containers.filter(typeof(Region)).exists(p|p.requireDeepHistory)
+	}
 	
 }

+ 18 - 15
plugins/org.yakindu.sct.model.sexec/src/org/yakindu/sct/model/sexec/transformation/StateVectorBuilder.xtend

@@ -21,7 +21,25 @@ class StateVectorBuilder {
 	@Inject extension SexecExtensions sexec
 	@Inject extension SexecElementMapping mapping
 	@Inject extension StatechartExtensions sc
+	@Inject extension SgraphExtensions sgraph
 	
+	def defineHistoryVector(ExecutionFlow flow, Statechart sc) {
+		var offset = 0
+		for ( r : sc.allContentsIterable.filter(typeof(Region)) ) {
+			if (r.requireHistory) {
+				offset = offset+1
+				val er = r.create
+				er.historyVector = sexec.factory.createStateVector
+				er.historyVector.offset = offset;
+				er.historyVector.size = 1
+			}
+		}
+		
+		flow.historyVector = sexec.factory.createStateVector
+		flow.historyVector.offset = 0;
+		flow.historyVector.size = offset
+	}
+
 	def defineStateVector(ExecutionFlow flow, Statechart sc) {
 		var offset = 0
 		for ( r : sc.regions ) {
@@ -33,21 +51,6 @@ class StateVectorBuilder {
 		flow.stateVector.offset = 0;
 		flow.stateVector.size = offset			
 	}
-	def defineHistoryStateVector(ExecutionFlow flow, Statechart sc) {
-		for (Region r : sc.allContentsIterable.filter(typeof(Region))) {
-			val execRegion = r.create
-			if (r.vertices.filter(typeof(Entry)).exists(v|v.kind== EntryKind::DEEP_HISTORY)) {
-				execRegion.historyStateVector = sexec.factory.createStateVector
-				execRegion.historyStateVector.offset = execRegion.stateVector.offset;
-				execRegion.historyStateVector.size = execRegion.stateVector.size
-			} else if (r.vertices.filter(typeof(Entry)).exists(v|v.kind== EntryKind::SHALLOW_HISTORY)) {
-				execRegion.historyStateVector = sexec.factory.createStateVector
-				execRegion.historyStateVector.offset = execRegion.stateVector.offset;
-				execRegion.historyStateVector.size = 1
-			}
-		}
-	}
- 
 
 	/** calculates the maximum orthogonality (maximum number of possible active leaf states) of the statechart */
 	def int defineStateVectors(Statechart sc, int offset) {

+ 4 - 0
plugins/org.yakindu.sct.model.sexec/src/org/yakindu/sct/model/sexec/transformation/StructureMapping.xtend

@@ -19,10 +19,14 @@ import java.util.ArrayList
 import org.yakindu.sct.model.sexec.TimeEvent
 import org.yakindu.sct.model.stext.stext.OperationCall
 import org.yakindu.sct.model.stext.stext.Operation
+import org.yakindu.sct.model.sgraph.Entry
+import org.yakindu.sct.model.sgraph.EntryKind
 
 class StructureMapping {
 	 
 	@Inject extension SexecElementMapping mapping
+	@Inject extension SexecExtensions sexec
+	@Inject extension SgraphExtensions sgraph
 	@Inject extension StatechartExtensions sct
 	
 	

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

@@ -87,11 +87,13 @@ public class ModelSequencer {
       this.structureMapping.mapPseudoStates(sc, ef);
       this.structureMapping.mapTimeEvents(sc, ef);
       this.svBuilder.defineStateVector(ef, sc);
-      this.svBuilder.defineHistoryStateVector(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);

+ 14 - 158
plugins/org.yakindu.sct.model.sexec/xtend-gen/org/yakindu/sct/model/sexec/transformation/ReactionBuilder.java

@@ -1,13 +1,11 @@
 package org.yakindu.sct.model.sexec.transformation;
 
 import com.google.inject.Inject;
-import java.util.ArrayList;
 import java.util.List;
 import org.eclipse.emf.common.util.EList;
 import org.eclipse.emf.ecore.EObject;
 import org.eclipse.xtext.xbase.lib.BooleanExtensions;
 import org.eclipse.xtext.xbase.lib.CollectionExtensions;
-import org.eclipse.xtext.xbase.lib.CollectionLiterals;
 import org.eclipse.xtext.xbase.lib.Functions.Function1;
 import org.eclipse.xtext.xbase.lib.Functions.Function2;
 import org.eclipse.xtext.xbase.lib.IntegerExtensions;
@@ -30,12 +28,8 @@ 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.StateCase;
-import org.yakindu.sct.model.sexec.StateSwitch;
-import org.yakindu.sct.model.sexec.StateVector;
 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.transformation.SexecElementMapping;
 import org.yakindu.sct.model.sexec.transformation.SexecExtensions;
 import org.yakindu.sct.model.sexec.transformation.SgraphExtensions;
@@ -51,7 +45,6 @@ import org.yakindu.sct.model.sgraph.State;
 import org.yakindu.sct.model.sgraph.Statechart;
 import org.yakindu.sct.model.sgraph.Statement;
 import org.yakindu.sct.model.sgraph.Transition;
-import org.yakindu.sct.model.sgraph.Vertex;
 import org.yakindu.sct.model.stext.stext.BoolLiteral;
 import org.yakindu.sct.model.stext.stext.Literal;
 import org.yakindu.sct.model.stext.stext.PrimitiveValueExpression;
@@ -429,9 +422,10 @@ public class ReactionBuilder {
               }
             }
             EObject _eContainer_1 = e.eContainer();
-            StateSwitch _defineShallowHistorySwitch = this.defineShallowHistorySwitch(((Region) _eContainer_1));
-            final StateSwitch sSwitch = _defineShallowHistorySwitch;
-            entryStep.setHistoryStep(sSwitch);
+            ExecutionRegion _create_5 = this.mapping.create(((Region) _eContainer_1));
+            Sequence _shallowEnterSequence = _create_5.getShallowEnterSequence();
+            Call _newCall_2 = this.mapping.newCall(_shallowEnterSequence);
+            entryStep.setHistoryStep(_newCall_2);
             EList<Step> _steps_4 = seq.getSteps();
             boolean _operator_add_1 = CollectionExtensions.<Step>operator_add(_steps_4, entryStep);
             _xblockexpression_2 = (_operator_add_1);
@@ -450,8 +444,8 @@ public class ReactionBuilder {
               entryStep_1.setName("HistoryEntry");
               entryStep_1.setComment("Enter the region with deep history");
               EObject _eContainer_2 = e.eContainer();
-              ExecutionRegion _create_5 = this.mapping.create(((Region) _eContainer_2));
-              entryStep_1.setRegion(_create_5);
+              ExecutionRegion _create_6 = this.mapping.create(((Region) _eContainer_2));
+              entryStep_1.setRegion(_create_6);
               entryStep_1.setDeep(true);
               boolean _operator_and_2 = false;
               boolean _operator_notEquals_4 = ObjectExtensions.operator_notEquals(target, null);
@@ -469,19 +463,20 @@ public class ReactionBuilder {
                     EList<Step> _steps_5 = seq.getSteps();
                     EList<Transition> _outgoingTransitions_2 = e.getOutgoingTransitions();
                     Transition _get_2 = _outgoingTransitions_2.get(0);
-                    Reaction _create_6 = this.mapping.create(_get_2);
-                    ReactionFired _newTraceReactionFired_2 = this.trace.newTraceReactionFired(_create_6);
+                    Reaction _create_7 = this.mapping.create(_get_2);
+                    ReactionFired _newTraceReactionFired_2 = this.trace.newTraceReactionFired(_create_7);
                     CollectionExtensions.<Step>operator_add(_steps_5, _newTraceReactionFired_2);
                   }
                   Sequence _enterSequence_5 = target.getEnterSequence();
-                  Call _newCall_2 = this.mapping.newCall(_enterSequence_5);
-                  entryStep_1.setInitialStep(_newCall_2);
+                  Call _newCall_3 = this.mapping.newCall(_enterSequence_5);
+                  entryStep_1.setInitialStep(_newCall_3);
                 }
               }
               EObject _eContainer_3 = e.eContainer();
-              StateSwitch _defineDeepHistorySwitch = this.defineDeepHistorySwitch(((Region) _eContainer_3));
-              final StateSwitch sSwitch_1 = _defineDeepHistorySwitch;
-              entryStep_1.setHistoryStep(sSwitch_1);
+              ExecutionRegion _create_8 = this.mapping.create(((Region) _eContainer_3));
+              Sequence _deepEnterSequence = _create_8.getDeepEnterSequence();
+              Call _newCall_4 = this.mapping.newCall(_deepEnterSequence);
+              entryStep_1.setHistoryStep(_newCall_4);
               EList<Step> _steps_6 = seq.getSteps();
               boolean _operator_add_2 = CollectionExtensions.<Step>operator_add(_steps_6, entryStep_1);
               _xblockexpression_3 = (_operator_add_2);
@@ -496,143 +491,4 @@ public class ReactionBuilder {
     }
     return _xblockexpression;
   }
-  
-  public StateSwitch defineDeepHistorySwitch(final Region r) {
-    ExecutionRegion _create = this.mapping.create(r);
-    StateSwitch _defineDeepHistorySwitch = this.defineDeepHistorySwitch(r, _create);
-    return _defineDeepHistorySwitch;
-  }
-  
-  public StateSwitch defineDeepHistorySwitch(final Region r, final ExecutionRegion historyRegion) {
-    {
-      ExecutionRegion _create = this.mapping.create(r);
-      final ExecutionRegion execRegion = _create;
-      SexecFactory _factory = this.sexec.factory();
-      StateSwitch _createStateSwitch = _factory.createStateSwitch();
-      final StateSwitch sSwitch = _createStateSwitch;
-      StateVector _stateVector = execRegion.getStateVector();
-      int _offset = _stateVector.getOffset();
-      sSwitch.setStateConfigurationIdx(_offset);
-      String _name = r.getName();
-      String _operator_plus = StringExtensions.operator_plus("Handle shallow history entry of ", _name);
-      sSwitch.setComment(_operator_plus);
-      sSwitch.setHistoryRegion(historyRegion);
-      EList<Vertex> _vertices = r.getVertices();
-      Iterable<State> _filter = IterableExtensions.<State>filter(_vertices, org.yakindu.sct.model.sgraph.State.class);
-      for (final State child : _filter) {
-        ArrayList<RegularState> _newArrayList = CollectionLiterals.<RegularState>newArrayList();
-        List<RegularState> _collectLeafStates = this.sgraph.collectLeafStates(child, _newArrayList);
-        final Function1<RegularState,Boolean> _function = new Function1<RegularState,Boolean>() {
-            public Boolean apply(final RegularState c) {
-              ExecutionState _create_1 = ReactionBuilder.this.mapping.create(c);
-              StateVector _stateVector_1 = _create_1.getStateVector();
-              int _offset_1 = _stateVector_1.getOffset();
-              int _stateConfigurationIdx = sSwitch.getStateConfigurationIdx();
-              boolean _operator_equals = ObjectExtensions.operator_equals(((Integer)_offset_1), ((Integer)_stateConfigurationIdx));
-              return ((Boolean)_operator_equals);
-            }
-          };
-        Iterable<RegularState> _filter_1 = IterableExtensions.<RegularState>filter(_collectLeafStates, _function);
-        for (final RegularState childLeaf : _filter_1) {
-          {
-            ExecutionState _create_2 = this.mapping.create(child);
-            final ExecutionState execChild = _create_2;
-            SexecFactory _factory_1 = this.sexec.factory();
-            Sequence _createSequence = _factory_1.createSequence();
-            final Sequence seq = _createSequence;
-            seq.setName("enterSequence");
-            String _name_1 = child.getName();
-            String _operator_plus_1 = StringExtensions.operator_plus("enterSequence with history in child ", _name_1);
-            String _operator_plus_2 = StringExtensions.operator_plus(_operator_plus_1, " for leaf ");
-            String _name_2 = childLeaf.getName();
-            String _operator_plus_3 = StringExtensions.operator_plus(_operator_plus_2, _name_2);
-            seq.setComment(_operator_plus_3);
-            boolean _isLeaf = execChild.isLeaf();
-            if (_isLeaf) {
-              EList<Step> _steps = seq.getSteps();
-              Sequence _enterSequence = execChild.getEnterSequence();
-              Call _newCall = this.mapping.newCall(_enterSequence);
-              CollectionExtensions.<Step>operator_add(_steps, _newCall);
-            } else {
-              {
-                Step _entryAction = execChild.getEntryAction();
-                boolean _operator_notEquals = ObjectExtensions.operator_notEquals(_entryAction, null);
-                if (_operator_notEquals) {
-                  EList<Step> _steps_1 = seq.getSteps();
-                  Step _entryAction_1 = execChild.getEntryAction();
-                  Call _newCall_1 = this.mapping.newCall(_entryAction_1);
-                  CollectionExtensions.<Step>operator_add(_steps_1, _newCall_1);
-                }
-                boolean _isAddTraceSteps = this.trace.isAddTraceSteps();
-                if (_isAddTraceSteps) {
-                  EList<Step> _steps_2 = seq.getSteps();
-                  TraceStateEntered _newTraceStateEntered = this.trace.newTraceStateEntered(execChild);
-                  CollectionExtensions.<Step>operator_add(_steps_2, _newTraceStateEntered);
-                }
-                EList<Region> _regions = child.getRegions();
-                for (final Region childRegion : _regions) {
-                  EList<Step> _steps_3 = seq.getSteps();
-                  StateSwitch _defineDeepHistorySwitch = this.defineDeepHistorySwitch(childRegion, historyRegion);
-                  CollectionExtensions.<Step>operator_add(_steps_3, _defineDeepHistorySwitch);
-                }
-              }
-            }
-            EList<StateCase> _cases = sSwitch.getCases();
-            ExecutionState _create_3 = this.mapping.create(childLeaf);
-            StateCase _newCase = this.sexec.newCase(_create_3, seq);
-            CollectionExtensions.<StateCase>operator_add(_cases, _newCase);
-          }
-        }
-      }
-      return sSwitch;
-    }
-  }
-  
-  public StateSwitch defineShallowHistorySwitch(final Region r) {
-    {
-      ExecutionRegion _create = this.mapping.create(r);
-      final ExecutionRegion execRegion = _create;
-      SexecFactory _factory = this.sexec.factory();
-      StateSwitch _createStateSwitch = _factory.createStateSwitch();
-      final StateSwitch sSwitch = _createStateSwitch;
-      StateVector _stateVector = execRegion.getStateVector();
-      int _offset = _stateVector.getOffset();
-      sSwitch.setStateConfigurationIdx(_offset);
-      String _name = r.getName();
-      String _operator_plus = StringExtensions.operator_plus("Handle shallow history entry of ", _name);
-      sSwitch.setComment(_operator_plus);
-      ExecutionRegion _create_1 = this.mapping.create(r);
-      sSwitch.setHistoryRegion(_create_1);
-      EList<Vertex> _vertices = r.getVertices();
-      Iterable<State> _filter = IterableExtensions.<State>filter(_vertices, org.yakindu.sct.model.sgraph.State.class);
-      for (final State child : _filter) {
-        {
-          ExecutionState _create_2 = this.mapping.create(child);
-          final ExecutionState execChild = _create_2;
-          ArrayList<RegularState> _newArrayList = CollectionLiterals.<RegularState>newArrayList();
-          List<RegularState> _collectLeafStates = this.sgraph.collectLeafStates(child, _newArrayList);
-          final Function1<RegularState,Boolean> _function = new Function1<RegularState,Boolean>() {
-              public Boolean apply(final RegularState c) {
-                ExecutionState _create_3 = ReactionBuilder.this.mapping.create(c);
-                StateVector _stateVector_1 = _create_3.getStateVector();
-                int _offset_1 = _stateVector_1.getOffset();
-                int _stateConfigurationIdx = sSwitch.getStateConfigurationIdx();
-                boolean _operator_equals = ObjectExtensions.operator_equals(((Integer)_offset_1), ((Integer)_stateConfigurationIdx));
-                return ((Boolean)_operator_equals);
-              }
-            };
-          Iterable<RegularState> _filter_1 = IterableExtensions.<RegularState>filter(_collectLeafStates, _function);
-          for (final RegularState childLeaf : _filter_1) {
-            EList<StateCase> _cases = sSwitch.getCases();
-            ExecutionState _create_4 = this.mapping.create(childLeaf);
-            Sequence _enterSequence = execChild.getEnterSequence();
-            Call _newCall = this.mapping.newCall(_enterSequence);
-            StateCase _newCase = this.sexec.newCase(_create_4, _newCall);
-            CollectionExtensions.<StateCase>operator_add(_cases, _newCase);
-          }
-        }
-      }
-      return sSwitch;
-    }
-  }
 }

+ 203 - 31
plugins/org.yakindu.sct.model.sexec/xtend-gen/org/yakindu/sct/model/sexec/transformation/SequenceBuilder.java

@@ -5,9 +5,11 @@ import com.google.inject.name.Named;
 import java.util.ArrayList;
 import java.util.List;
 import org.eclipse.emf.common.util.EList;
+import org.eclipse.emf.ecore.EObject;
 import org.eclipse.emf.ecore.util.EcoreUtil;
 import org.eclipse.xtext.xbase.lib.BooleanExtensions;
 import org.eclipse.xtext.xbase.lib.CollectionExtensions;
+import org.eclipse.xtext.xbase.lib.CollectionLiterals;
 import org.eclipse.xtext.xbase.lib.Functions.Function1;
 import org.eclipse.xtext.xbase.lib.Functions.Function2;
 import org.eclipse.xtext.xbase.lib.IntegerExtensions;
@@ -15,6 +17,7 @@ import org.eclipse.xtext.xbase.lib.IterableExtensions;
 import org.eclipse.xtext.xbase.lib.ListExtensions;
 import org.eclipse.xtext.xbase.lib.ObjectExtensions;
 import org.eclipse.xtext.xbase.lib.StringExtensions;
+import org.eclipse.xtext.xtend2.lib.EObjectExtensions;
 import org.yakindu.sct.model.sexec.Call;
 import org.yakindu.sct.model.sexec.EnterState;
 import org.yakindu.sct.model.sexec.Execution;
@@ -39,7 +42,6 @@ import org.yakindu.sct.model.sexec.transformation.SgraphExtensions;
 import org.yakindu.sct.model.sexec.transformation.StextExtensions;
 import org.yakindu.sct.model.sexec.transformation.TraceExtensions;
 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.NamedElement;
 import org.yakindu.sct.model.sgraph.Region;
@@ -77,6 +79,200 @@ public class SequenceBuilder {
   @Named("ADD_TRACES")
   private boolean _addTraceSteps;
   
+  public void defineDeepEnterSequences(final ExecutionFlow flow, final Statechart sc) {
+    EList<Region> _regions = sc.getRegions();
+    for (final Region r : _regions) {
+      this.defineDeepEnterSequence(r);
+    }
+  }
+  
+  public void defineDeepEnterSequence(final State s) {
+    EList<Region> _regions = s.getRegions();
+    for (final Region r : _regions) {
+      this.defineDeepEnterSequence(r);
+    }
+  }
+  
+  public void defineDeepEnterSequence(final Region r) {
+    {
+      EList<Vertex> _vertices = r.getVertices();
+      Iterable<State> _filter = IterableExtensions.<State>filter(_vertices, org.yakindu.sct.model.sgraph.State.class);
+      for (final State s : _filter) {
+        this.defineDeepEnterSequence(s);
+      }
+      ExecutionRegion _create = this.mapping.create(r);
+      final ExecutionRegion execRegion = _create;
+      SexecFactory _factory = this.sexec.factory();
+      Sequence _createSequence = _factory.createSequence();
+      final Sequence seq = _createSequence;
+      seq.setName("enterSequence");
+      String _name = r.getName();
+      String _operator_plus = StringExtensions.operator_plus("deep enterSequence with history in child ", _name);
+      seq.setComment(_operator_plus);
+      EList<Step> _steps = seq.getSteps();
+      StateSwitch _defineDeepHistorySwitch = this.defineDeepHistorySwitch(r);
+      CollectionExtensions.<Step>operator_add(_steps, _defineDeepHistorySwitch);
+      execRegion.setDeepEnterSequence(seq);
+    }
+  }
+  
+  public StateSwitch defineDeepHistorySwitch(final Region r) {
+    {
+      ExecutionRegion _create = this.mapping.create(r);
+      final ExecutionRegion execRegion = _create;
+      SexecFactory _factory = this.sexec.factory();
+      StateSwitch _createStateSwitch = _factory.createStateSwitch();
+      final StateSwitch sSwitch = _createStateSwitch;
+      StateVector _stateVector = execRegion.getStateVector();
+      int _offset = _stateVector.getOffset();
+      sSwitch.setStateConfigurationIdx(_offset);
+      String _name = r.getName();
+      String _operator_plus = StringExtensions.operator_plus("Handle deep history entry of ", _name);
+      sSwitch.setComment(_operator_plus);
+      sSwitch.setHistoryRegion(execRegion);
+      EList<Vertex> _vertices = r.getVertices();
+      Iterable<State> _filter = IterableExtensions.<State>filter(_vertices, org.yakindu.sct.model.sgraph.State.class);
+      for (final State child : _filter) {
+        ArrayList<RegularState> _newArrayList = CollectionLiterals.<RegularState>newArrayList();
+        List<RegularState> _collectLeafStates = this.sgraph.collectLeafStates(child, _newArrayList);
+        final Function1<RegularState,Boolean> _function = new Function1<RegularState,Boolean>() {
+            public Boolean apply(final RegularState c) {
+              ExecutionState _create_1 = SequenceBuilder.this.mapping.create(c);
+              StateVector _stateVector_1 = _create_1.getStateVector();
+              int _offset_1 = _stateVector_1.getOffset();
+              int _stateConfigurationIdx = sSwitch.getStateConfigurationIdx();
+              boolean _operator_equals = ObjectExtensions.operator_equals(((Integer)_offset_1), ((Integer)_stateConfigurationIdx));
+              return ((Boolean)_operator_equals);
+            }
+          };
+        Iterable<RegularState> _filter_1 = IterableExtensions.<RegularState>filter(_collectLeafStates, _function);
+        for (final RegularState childLeaf : _filter_1) {
+          {
+            ExecutionState _create_2 = this.mapping.create(child);
+            final ExecutionState execChild = _create_2;
+            SexecFactory _factory_1 = this.sexec.factory();
+            Sequence _createSequence = _factory_1.createSequence();
+            final Sequence seq = _createSequence;
+            seq.setName("enterSequence");
+            String _name_1 = child.getName();
+            String _operator_plus_1 = StringExtensions.operator_plus("enterSequence with history in child ", _name_1);
+            String _operator_plus_2 = StringExtensions.operator_plus(_operator_plus_1, " for leaf ");
+            String _name_2 = childLeaf.getName();
+            String _operator_plus_3 = StringExtensions.operator_plus(_operator_plus_2, _name_2);
+            seq.setComment(_operator_plus_3);
+            boolean _isLeaf = execChild.isLeaf();
+            if (_isLeaf) {
+              EList<Step> _steps = seq.getSteps();
+              Sequence _enterSequence = execChild.getEnterSequence();
+              Call _newCall = this.mapping.newCall(_enterSequence);
+              CollectionExtensions.<Step>operator_add(_steps, _newCall);
+            } else {
+              {
+                Step _entryAction = execChild.getEntryAction();
+                boolean _operator_notEquals = ObjectExtensions.operator_notEquals(_entryAction, null);
+                if (_operator_notEquals) {
+                  EList<Step> _steps_1 = seq.getSteps();
+                  Step _entryAction_1 = execChild.getEntryAction();
+                  Call _newCall_1 = this.mapping.newCall(_entryAction_1);
+                  CollectionExtensions.<Step>operator_add(_steps_1, _newCall_1);
+                }
+                boolean _isAddTraceSteps = this.trace.isAddTraceSteps();
+                if (_isAddTraceSteps) {
+                  EList<Step> _steps_2 = seq.getSteps();
+                  TraceStateEntered _newTraceStateEntered = this.trace.newTraceStateEntered(execChild);
+                  CollectionExtensions.<Step>operator_add(_steps_2, _newTraceStateEntered);
+                }
+                EList<Region> _regions = child.getRegions();
+                for (final Region childRegion : _regions) {
+                  EList<Step> _steps_3 = seq.getSteps();
+                  ExecutionRegion _create_3 = this.mapping.create(childRegion);
+                  Sequence _deepEnterSequence = _create_3.getDeepEnterSequence();
+                  Call _newCall_2 = this.mapping.newCall(_deepEnterSequence);
+                  CollectionExtensions.<Step>operator_add(_steps_3, _newCall_2);
+                }
+              }
+            }
+            EList<StateCase> _cases = sSwitch.getCases();
+            ExecutionState _create_4 = this.mapping.create(childLeaf);
+            StateCase _newCase = this.sexec.newCase(_create_4, seq);
+            CollectionExtensions.<StateCase>operator_add(_cases, _newCase);
+          }
+        }
+      }
+      return sSwitch;
+    }
+  }
+  
+  public void defineShallowEnterSequences(final ExecutionFlow flow, final Statechart sc) {
+    Iterable<EObject> _allContentsIterable = EObjectExtensions.allContentsIterable(sc);
+    Iterable<Region> _filter = IterableExtensions.<Region>filter(_allContentsIterable, org.yakindu.sct.model.sgraph.Region.class);
+    for (final Region r : _filter) {
+      {
+        ExecutionRegion _create = this.mapping.create(r);
+        final ExecutionRegion execRegion = _create;
+        SexecFactory _factory = this.sexec.factory();
+        Sequence _createSequence = _factory.createSequence();
+        final Sequence seq = _createSequence;
+        seq.setName("enterSequence");
+        String _name = r.getName();
+        String _operator_plus = StringExtensions.operator_plus("shallow enterSequence with history in child ", _name);
+        seq.setComment(_operator_plus);
+        EList<Step> _steps = seq.getSteps();
+        StateSwitch _defineShallowHistorySwitch = this.defineShallowHistorySwitch(r);
+        CollectionExtensions.<Step>operator_add(_steps, _defineShallowHistorySwitch);
+        execRegion.setShallowEnterSequence(seq);
+      }
+    }
+  }
+  
+  public StateSwitch defineShallowHistorySwitch(final Region r) {
+    {
+      ExecutionRegion _create = this.mapping.create(r);
+      final ExecutionRegion execRegion = _create;
+      SexecFactory _factory = this.sexec.factory();
+      StateSwitch _createStateSwitch = _factory.createStateSwitch();
+      final StateSwitch sSwitch = _createStateSwitch;
+      StateVector _stateVector = execRegion.getStateVector();
+      int _offset = _stateVector.getOffset();
+      sSwitch.setStateConfigurationIdx(_offset);
+      String _name = r.getName();
+      String _operator_plus = StringExtensions.operator_plus("Handle shallow history entry of ", _name);
+      sSwitch.setComment(_operator_plus);
+      ExecutionRegion _create_1 = this.mapping.create(r);
+      sSwitch.setHistoryRegion(_create_1);
+      EList<Vertex> _vertices = r.getVertices();
+      Iterable<State> _filter = IterableExtensions.<State>filter(_vertices, org.yakindu.sct.model.sgraph.State.class);
+      for (final State child : _filter) {
+        {
+          ExecutionState _create_2 = this.mapping.create(child);
+          final ExecutionState execChild = _create_2;
+          ArrayList<RegularState> _newArrayList = CollectionLiterals.<RegularState>newArrayList();
+          List<RegularState> _collectLeafStates = this.sgraph.collectLeafStates(child, _newArrayList);
+          final Function1<RegularState,Boolean> _function = new Function1<RegularState,Boolean>() {
+              public Boolean apply(final RegularState c) {
+                ExecutionState _create_3 = SequenceBuilder.this.mapping.create(c);
+                StateVector _stateVector_1 = _create_3.getStateVector();
+                int _offset_1 = _stateVector_1.getOffset();
+                int _stateConfigurationIdx = sSwitch.getStateConfigurationIdx();
+                boolean _operator_equals = ObjectExtensions.operator_equals(((Integer)_offset_1), ((Integer)_stateConfigurationIdx));
+                return ((Boolean)_operator_equals);
+              }
+            };
+          Iterable<RegularState> _filter_1 = IterableExtensions.<RegularState>filter(_collectLeafStates, _function);
+          for (final RegularState childLeaf : _filter_1) {
+            EList<StateCase> _cases = sSwitch.getCases();
+            ExecutionState _create_4 = this.mapping.create(childLeaf);
+            Sequence _enterSequence = execChild.getEnterSequence();
+            Call _newCall = this.mapping.newCall(_enterSequence);
+            StateCase _newCase = this.sexec.newCase(_create_4, _newCall);
+            CollectionExtensions.<StateCase>operator_add(_cases, _newCase);
+          }
+        }
+      }
+      return sSwitch;
+    }
+  }
+  
   public void defineStateEnterSequences(final ExecutionFlow flow, final Statechart sc) {
     EList<Region> _regions = sc.getRegions();
     for (final Region r : _regions) {
@@ -228,46 +424,22 @@ public class SequenceBuilder {
       for (final Vertex s : _vertices) {
         this.defineStateExitSequence(s);
       }
-      Iterable<Entry> _collectEntries = this.sgraph.collectEntries(r);
-      final Function1<Entry,Boolean> _function = new Function1<Entry,Boolean>() {
-          public Boolean apply(final Entry e) {
-            boolean _operator_or = false;
-            EntryKind _kind = e.getKind();
-            boolean _operator_equals = ObjectExtensions.operator_equals(_kind, EntryKind.DEEP_HISTORY);
-            if (_operator_equals) {
-              _operator_or = true;
-            } else {
-              EntryKind _kind_1 = e.getKind();
-              boolean _operator_equals_1 = ObjectExtensions.operator_equals(_kind_1, EntryKind.SHALLOW_HISTORY);
-              _operator_or = BooleanExtensions.operator_or(_operator_equals, _operator_equals_1);
-            }
-            return ((Boolean)_operator_or);
-          }
-        };
-      boolean _exists = IterableExtensions.<Entry>exists(_collectEntries, _function);
-      if (_exists) {
+      StateVector _historyVector = execRegion.getHistoryVector();
+      boolean _operator_notEquals = ObjectExtensions.operator_notEquals(_historyVector, null);
+      if (_operator_notEquals) {
         EList<Step> _steps = seq.getSteps();
-        Iterable<Entry> _collectEntries_1 = this.sgraph.collectEntries(r);
-        final Function1<Entry,Boolean> _function_1 = new Function1<Entry,Boolean>() {
-            public Boolean apply(final Entry e_1) {
-              EntryKind _kind_2 = e_1.getKind();
-              boolean _operator_equals_2 = ObjectExtensions.operator_equals(_kind_2, EntryKind.DEEP_HISTORY);
-              return ((Boolean)_operator_equals_2);
-            }
-          };
-        boolean _exists_1 = IterableExtensions.<Entry>exists(_collectEntries_1, _function_1);
-        SaveHistory _newSaveHistory = this.sexec.newSaveHistory(execRegion, _exists_1);
+        SaveHistory _newSaveHistory = this.sexec.newSaveHistory(execRegion);
         CollectionExtensions.<Step>operator_add(_steps, _newSaveHistory);
       }
       ArrayList<RegularState> _arrayList = new ArrayList<RegularState>();
       List<RegularState> _collectLeafStates = this.sgraph.collectLeafStates(r, _arrayList);
-      final Function1<RegularState,ExecutionState> _function_2 = new Function1<RegularState,ExecutionState>() {
+      final Function1<RegularState,ExecutionState> _function = new Function1<RegularState,ExecutionState>() {
           public ExecutionState apply(final RegularState rs) {
             ExecutionState _create_1 = SequenceBuilder.this.mapping.create(rs);
             return _create_1;
           }
         };
-      List<ExecutionState> _map = ListExtensions.<RegularState, ExecutionState>map(_collectLeafStates, _function_2);
+      List<ExecutionState> _map = ListExtensions.<RegularState, ExecutionState>map(_collectLeafStates, _function);
       final Iterable<ExecutionState> leafStates = _map;
       StateVector _stateVector = execRegion.getStateVector();
       final StateVector sVector = _stateVector;

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

@@ -68,13 +68,12 @@ public class SexecExtensions {
     }
   }
   
-  public SaveHistory newSaveHistory(final ExecutionRegion r, final boolean deep) {
+  public SaveHistory newSaveHistory(final ExecutionRegion r) {
     {
       SexecFactory _factory = this.factory();
       SaveHistory _createSaveHistory = _factory.createSaveHistory();
       final SaveHistory save = _createSaveHistory;
       save.setRegion(r);
-      save.setDeep(deep);
       return save;
     }
   }

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

@@ -11,6 +11,7 @@ import org.eclipse.xtext.xbase.lib.Functions.Function1;
 import org.eclipse.xtext.xbase.lib.IterableExtensions;
 import org.eclipse.xtext.xbase.lib.ObjectExtensions;
 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;
@@ -181,6 +182,49 @@ public class SgraphExtensions {
     }
   }
   
+  public boolean requireDeepHistory(final Region r) {
+    EList<Vertex> _vertices = r.getVertices();
+    Iterable<Entry> _filter = IterableExtensions.<Entry>filter(_vertices, org.yakindu.sct.model.sgraph.Entry.class);
+    final Function1<Entry,Boolean> _function = new Function1<Entry,Boolean>() {
+        public Boolean apply(final Entry v) {
+          EntryKind _kind = v.getKind();
+          boolean _operator_equals = ObjectExtensions.operator_equals(_kind, EntryKind.DEEP_HISTORY);
+          return ((Boolean)_operator_equals);
+        }
+      };
+    boolean _exists = IterableExtensions.<Entry>exists(_filter, _function);
+    return _exists;
+  }
+  
+  public boolean requireHistory(final Region r) {
+    boolean _operator_or = false;
+    EList<Vertex> _vertices = r.getVertices();
+    Iterable<Entry> _filter = IterableExtensions.<Entry>filter(_vertices, org.yakindu.sct.model.sgraph.Entry.class);
+    final Function1<Entry,Boolean> _function = new Function1<Entry,Boolean>() {
+        public Boolean apply(final Entry v) {
+          EntryKind _kind = v.getKind();
+          boolean _operator_equals = ObjectExtensions.operator_equals(_kind, EntryKind.SHALLOW_HISTORY);
+          return ((Boolean)_operator_equals);
+        }
+      };
+    boolean _exists = IterableExtensions.<Entry>exists(_filter, _function);
+    if (_exists) {
+      _operator_or = true;
+    } else {
+      List<EObject> _containers = this.containers(r);
+      Iterable<Region> _filter_1 = IterableExtensions.<Region>filter(_containers, org.yakindu.sct.model.sgraph.Region.class);
+      final Function1<Region,Boolean> _function_1 = new Function1<Region,Boolean>() {
+          public Boolean apply(final Region p) {
+            boolean _requireDeepHistory = SgraphExtensions.this.requireDeepHistory(p);
+            return ((Boolean)_requireDeepHistory);
+          }
+        };
+      boolean _exists_1 = IterableExtensions.<Region>exists(_filter_1, _function_1);
+      _operator_or = BooleanExtensions.operator_or(_exists, _exists_1);
+    }
+    return _operator_or;
+  }
+  
   public boolean isLeaf(final RegularState s) {
     if ((s instanceof FinalState)) {
       return _isLeaf((FinalState)s);

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

@@ -4,11 +4,9 @@ import com.google.inject.Inject;
 import org.eclipse.emf.common.util.EList;
 import org.eclipse.emf.ecore.EObject;
 import org.eclipse.xtext.xbase.lib.ComparableExtensions;
-import org.eclipse.xtext.xbase.lib.Functions.Function1;
 import org.eclipse.xtext.xbase.lib.Functions.Function2;
 import org.eclipse.xtext.xbase.lib.IntegerExtensions;
 import org.eclipse.xtext.xbase.lib.IterableExtensions;
-import org.eclipse.xtext.xbase.lib.ObjectExtensions;
 import org.eclipse.xtext.xtend2.lib.EObjectExtensions;
 import org.yakindu.sct.model.sexec.ExecutionFlow;
 import org.yakindu.sct.model.sexec.ExecutionRegion;
@@ -17,10 +15,9 @@ 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.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;
@@ -40,6 +37,42 @@ public class StateVectorBuilder {
   @Inject
   private StatechartExtensions sc;
   
+  @Inject
+  private SgraphExtensions sgraph;
+  
+  public void defineHistoryVector(final ExecutionFlow flow, final Statechart sc) {
+    {
+      int offset = 0;
+      Iterable<EObject> _allContentsIterable = EObjectExtensions.allContentsIterable(sc);
+      Iterable<Region> _filter = IterableExtensions.<Region>filter(_allContentsIterable, org.yakindu.sct.model.sgraph.Region.class);
+      for (final Region r : _filter) {
+        boolean _requireHistory = this.sgraph.requireHistory(r);
+        if (_requireHistory) {
+          {
+            int _operator_plus = IntegerExtensions.operator_plus(((Integer)offset), ((Integer)1));
+            offset = _operator_plus;
+            ExecutionRegion _create = this.mapping.create(r);
+            final ExecutionRegion er = _create;
+            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);
+          }
+        }
+      }
+      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();
+      _historyVector_3.setSize(offset);
+    }
+  }
+  
   public void defineStateVector(final ExecutionFlow flow, final Statechart sc) {
     {
       int offset = 0;
@@ -59,66 +92,6 @@ public class StateVectorBuilder {
     }
   }
   
-  public void defineHistoryStateVector(final ExecutionFlow flow, final Statechart sc) {
-    Iterable<EObject> _allContentsIterable = EObjectExtensions.allContentsIterable(sc);
-    Iterable<Region> _filter = IterableExtensions.<Region>filter(_allContentsIterable, org.yakindu.sct.model.sgraph.Region.class);
-    for (final Region r : _filter) {
-      {
-        ExecutionRegion _create = this.mapping.create(r);
-        final ExecutionRegion execRegion = _create;
-        EList<Vertex> _vertices = r.getVertices();
-        Iterable<Entry> _filter_1 = IterableExtensions.<Entry>filter(_vertices, org.yakindu.sct.model.sgraph.Entry.class);
-        final Function1<Entry,Boolean> _function = new Function1<Entry,Boolean>() {
-            public Boolean apply(final Entry v) {
-              EntryKind _kind = v.getKind();
-              boolean _operator_equals = ObjectExtensions.operator_equals(_kind, EntryKind.DEEP_HISTORY);
-              return ((Boolean)_operator_equals);
-            }
-          };
-        boolean _exists = IterableExtensions.<Entry>exists(_filter_1, _function);
-        if (_exists) {
-          {
-            SexecFactory _factory = this.sexec.factory();
-            StateVector _createStateVector = _factory.createStateVector();
-            execRegion.setHistoryStateVector(_createStateVector);
-            StateVector _historyStateVector = execRegion.getHistoryStateVector();
-            StateVector _stateVector = execRegion.getStateVector();
-            int _offset = _stateVector.getOffset();
-            _historyStateVector.setOffset(_offset);
-            StateVector _historyStateVector_1 = execRegion.getHistoryStateVector();
-            StateVector _stateVector_1 = execRegion.getStateVector();
-            int _size = _stateVector_1.getSize();
-            _historyStateVector_1.setSize(_size);
-          }
-        } else {
-          EList<Vertex> _vertices_1 = r.getVertices();
-          Iterable<Entry> _filter_2 = IterableExtensions.<Entry>filter(_vertices_1, org.yakindu.sct.model.sgraph.Entry.class);
-          final Function1<Entry,Boolean> _function_1 = new Function1<Entry,Boolean>() {
-              public Boolean apply(final Entry v_1) {
-                EntryKind _kind_1 = v_1.getKind();
-                boolean _operator_equals_1 = ObjectExtensions.operator_equals(_kind_1, EntryKind.SHALLOW_HISTORY);
-                return ((Boolean)_operator_equals_1);
-              }
-            };
-          boolean _exists_1 = IterableExtensions.<Entry>exists(_filter_2, _function_1);
-          if (_exists_1) {
-            {
-              SexecFactory _factory_1 = this.sexec.factory();
-              StateVector _createStateVector_1 = _factory_1.createStateVector();
-              execRegion.setHistoryStateVector(_createStateVector_1);
-              StateVector _historyStateVector_2 = execRegion.getHistoryStateVector();
-              StateVector _stateVector_2 = execRegion.getStateVector();
-              int _offset_1 = _stateVector_2.getOffset();
-              _historyStateVector_2.setOffset(_offset_1);
-              StateVector _historyStateVector_3 = execRegion.getHistoryStateVector();
-              _historyStateVector_3.setSize(1);
-            }
-          }
-        }
-      }
-    }
-  }
-  
   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>() {

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

@@ -21,6 +21,8 @@ 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.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.CompositeElement;
@@ -44,6 +46,12 @@ public class StructureMapping {
   @Inject
   private SexecElementMapping mapping;
   
+  @Inject
+  private SexecExtensions sexec;
+  
+  @Inject
+  private SgraphExtensions sgraph;
+  
   @Inject
   private StatechartExtensions sct;