Explorar el Código

Calculated entry sequences for states. This includes new references 'enterSequence' and 'exitSequence' for ExecutionState instances ( YAKHMI-269 & YAKHMI-273 )

terfloth@itemis.de hace 14 años
padre
commit
da65063f42
Se han modificado 26 ficheros con 1185 adiciones y 560 borrados
  1. 7 7
      plugins/org.yakindu.sct.model.sexec.edit/.classpath
  2. BIN
      plugins/org.yakindu.sct.model.sexec.edit/icons/full/ctool16/CreateExecutionState_enterSequence_Cycle.gif
  3. BIN
      plugins/org.yakindu.sct.model.sexec.edit/icons/full/ctool16/CreateExecutionState_enterSequence_Sequence.gif
  4. BIN
      plugins/org.yakindu.sct.model.sexec.edit/icons/full/ctool16/CreateExecutionState_exitSequence_Cycle.gif
  5. BIN
      plugins/org.yakindu.sct.model.sexec.edit/icons/full/ctool16/CreateExecutionState_exitSequence_Sequence.gif
  6. 2 0
      plugins/org.yakindu.sct.model.sexec.edit/plugin.properties
  7. 27 1
      plugins/org.yakindu.sct.model.sexec.edit/src/org/yakindu/sct/model/sexec/provider/ExecutionStateItemProvider.java
  8. 9 9
      plugins/org.yakindu.sct.model.sexec/.classpath
  9. 4 0
      plugins/org.yakindu.sct.model.sexec/model/sexec.ecore
  10. 54 0
      plugins/org.yakindu.sct.model.sexec/src/org/yakindu/sct/model/sexec/ExecutionState.java
  11. 57 1
      plugins/org.yakindu.sct.model.sexec/src/org/yakindu/sct/model/sexec/SexecPackage.java
  12. 133 0
      plugins/org.yakindu.sct.model.sexec/src/org/yakindu/sct/model/sexec/impl/ExecutionStateImpl.java
  13. 1 0
      plugins/org.yakindu.sct.model.sexec/src/org/yakindu/sct/model/sexec/impl/SexecFactoryImpl.java
  14. 22 0
      plugins/org.yakindu.sct.model.sexec/src/org/yakindu/sct/model/sexec/impl/SexecPackageImpl.java
  15. 4 2
      plugins/org.yakindu.sct.model.sexec/src/org/yakindu/sct/model/sexec/transformation/FactoryExtension.xtend
  16. 54 2
      plugins/org.yakindu.sct.model.sexec/src/org/yakindu/sct/model/sexec/transformation/ModelSequencer.xtend
  17. 1 0
      plugins/org.yakindu.sct.model.sexec/src/org/yakindu/sct/model/sexec/util/SexecAdapterFactory.java
  18. 1 0
      plugins/org.yakindu.sct.model.sexec/src/org/yakindu/sct/model/sexec/util/SexecSwitch.java
  19. 11 7
      plugins/org.yakindu.sct.model.sexec/xtend-gen/org/yakindu/sct/model/sexec/transformation/FactoryExtension.java
  20. 87 4
      plugins/org.yakindu.sct.model.sexec/xtend-gen/org/yakindu/sct/model/sexec/transformation/ModelSequencer.java
  21. 0 1
      test-plugins/org.yakindu.sct.model.sexec.test/.classpath
  22. 11 0
      test-plugins/org.yakindu.sct.model.sexec.test/src/org/yakindu/sct/model/sexec/transformation/test/AllTests.java
  23. 470 0
      test-plugins/org.yakindu.sct.model.sexec.test/src/org/yakindu/sct/model/sexec/transformation/test/ModelSequencerHierarchyTest.java
  24. 213 0
      test-plugins/org.yakindu.sct.model.sexec.test/src/org/yakindu/sct/model/sexec/transformation/test/ModelSequencerStateTest.java
  25. 0 526
      test-plugins/org.yakindu.sct.model.sexec.test/src/org/yakindu/sct/model/sexec/transformation/test/ModelSequencerTest.java
  26. 17 0
      test-plugins/org.yakindu.sct.model.sexec.test/src/org/yakindu/sct/model/sexec/transformation/test/SCTTestUtil.java

+ 7 - 7
plugins/org.yakindu.sct.model.sexec.edit/.classpath

@@ -1,7 +1,7 @@
-<?xml version="1.0" encoding="UTF-8"?>
-<classpath>
-	<classpathentry kind="con" path="org.eclipse.jdt.launching.JRE_CONTAINER/org.eclipse.jdt.internal.debug.ui.launcher.StandardVMType/J2SE-1.5"/>
-	<classpathentry kind="con" path="org.eclipse.pde.core.requiredPlugins"/>
-	<classpathentry kind="src" path="src"/>
-	<classpathentry kind="output" path="bin"/>
-</classpath>
+<?xml version="1.0" encoding="UTF-8"?>
+<classpath>
+	<classpathentry kind="src" path="src"/>
+	<classpathentry kind="con" path="org.eclipse.jdt.launching.JRE_CONTAINER/org.eclipse.jdt.internal.debug.ui.launcher.StandardVMType/J2SE-1.5"/>
+	<classpathentry kind="con" path="org.eclipse.pde.core.requiredPlugins"/>
+	<classpathentry kind="output" path="bin"/>
+</classpath>

BIN
plugins/org.yakindu.sct.model.sexec.edit/icons/full/ctool16/CreateExecutionState_enterSequence_Cycle.gif


BIN
plugins/org.yakindu.sct.model.sexec.edit/icons/full/ctool16/CreateExecutionState_enterSequence_Sequence.gif


BIN
plugins/org.yakindu.sct.model.sexec.edit/icons/full/ctool16/CreateExecutionState_exitSequence_Cycle.gif


BIN
plugins/org.yakindu.sct.model.sexec.edit/icons/full/ctool16/CreateExecutionState_exitSequence_Sequence.gif


+ 2 - 0
plugins/org.yakindu.sct.model.sexec.edit/plugin.properties

@@ -69,3 +69,5 @@ _UI_ScheduleTimeEvent_timeEvent_feature = Time Event
 _UI_ScheduleTimeEvent_timeValue_feature = Time Value
 _UI_UnscheduleTimeEvent_timeEvent_feature = Time Event
 _UI_Reaction_transition_feature = Transition
+_UI_ExecutionState_enterSequence_feature = Enter Sequence
+_UI_ExecutionState_exitSequence_feature = Exit Sequence

+ 27 - 1
plugins/org.yakindu.sct.model.sexec.edit/src/org/yakindu/sct/model/sexec/provider/ExecutionStateItemProvider.java

@@ -127,6 +127,8 @@ public class ExecutionStateItemProvider
 			childrenFeatures.add(SexecPackage.Literals.EXECUTION_STATE__REACTIONS);
 			childrenFeatures.add(SexecPackage.Literals.EXECUTION_STATE__ENTRY_ACTION);
 			childrenFeatures.add(SexecPackage.Literals.EXECUTION_STATE__EXIT_ACTION);
+			childrenFeatures.add(SexecPackage.Literals.EXECUTION_STATE__ENTER_SEQUENCE);
+			childrenFeatures.add(SexecPackage.Literals.EXECUTION_STATE__EXIT_SEQUENCE);
 		}
 		return childrenFeatures;
 	}
@@ -189,6 +191,8 @@ public class ExecutionStateItemProvider
 			case SexecPackage.EXECUTION_STATE__REACTIONS:
 			case SexecPackage.EXECUTION_STATE__ENTRY_ACTION:
 			case SexecPackage.EXECUTION_STATE__EXIT_ACTION:
+			case SexecPackage.EXECUTION_STATE__ENTER_SEQUENCE:
+			case SexecPackage.EXECUTION_STATE__EXIT_SEQUENCE:
 				fireNotifyChanged(new ViewerNotification(notification, notification.getNotifier(), true, false));
 				return;
 		}
@@ -325,6 +329,26 @@ public class ExecutionStateItemProvider
 			(createChildParameter
 				(SexecPackage.Literals.EXECUTION_STATE__EXIT_ACTION,
 				 SexecFactory.eINSTANCE.createUnscheduleTimeEvent()));
+
+		newChildDescriptors.add
+			(createChildParameter
+				(SexecPackage.Literals.EXECUTION_STATE__ENTER_SEQUENCE,
+				 SexecFactory.eINSTANCE.createSequence()));
+
+		newChildDescriptors.add
+			(createChildParameter
+				(SexecPackage.Literals.EXECUTION_STATE__ENTER_SEQUENCE,
+				 SexecFactory.eINSTANCE.createCycle()));
+
+		newChildDescriptors.add
+			(createChildParameter
+				(SexecPackage.Literals.EXECUTION_STATE__EXIT_SEQUENCE,
+				 SexecFactory.eINSTANCE.createSequence()));
+
+		newChildDescriptors.add
+			(createChildParameter
+				(SexecPackage.Literals.EXECUTION_STATE__EXIT_SEQUENCE,
+				 SexecFactory.eINSTANCE.createCycle()));
 	}
 
 	/**
@@ -341,7 +365,9 @@ public class ExecutionStateItemProvider
 		boolean qualify =
 			childFeature == SexecPackage.Literals.EXECUTION_STATE__CYCLE ||
 			childFeature == SexecPackage.Literals.EXECUTION_STATE__ENTRY_ACTION ||
-			childFeature == SexecPackage.Literals.EXECUTION_STATE__EXIT_ACTION;
+			childFeature == SexecPackage.Literals.EXECUTION_STATE__EXIT_ACTION ||
+			childFeature == SexecPackage.Literals.EXECUTION_STATE__ENTER_SEQUENCE ||
+			childFeature == SexecPackage.Literals.EXECUTION_STATE__EXIT_SEQUENCE;
 
 		if (qualify) {
 			return getString

+ 9 - 9
plugins/org.yakindu.sct.model.sexec/.classpath

@@ -1,9 +1,9 @@
-<?xml version="1.0" encoding="UTF-8"?>
-<classpath>
-	<classpathentry kind="con" path="org.eclipse.jdt.launching.JRE_CONTAINER/org.eclipse.jdt.internal.debug.ui.launcher.StandardVMType/J2SE-1.5"/>
-	<classpathentry kind="con" path="org.eclipse.pde.core.requiredPlugins"/>
-	<classpathentry kind="src" path="src"/>
-	<classpathentry kind="src" path="xtend-gen"/>
-	<classpathentry kind="src" path="model"/>
-	<classpathentry kind="output" path="bin"/>
-</classpath>
+<?xml version="1.0" encoding="UTF-8"?>
+<classpath>
+	<classpathentry kind="src" path="src"/>
+	<classpathentry kind="con" path="org.eclipse.jdt.launching.JRE_CONTAINER/org.eclipse.jdt.internal.debug.ui.launcher.StandardVMType/J2SE-1.5"/>
+	<classpathentry kind="con" path="org.eclipse.pde.core.requiredPlugins"/>
+	<classpathentry kind="src" path="xtend-gen"/>
+	<classpathentry kind="src" path="model"/>
+	<classpathentry kind="output" path="bin"/>
+</classpath>

+ 4 - 0
plugins/org.yakindu.sct.model.sexec/model/sexec.ecore

@@ -38,6 +38,10 @@
         containment="true"/>
     <eStructuralFeatures xsi:type="ecore:EReference" name="exitAction" eType="#//Step"
         containment="true"/>
+    <eStructuralFeatures xsi:type="ecore:EReference" name="enterSequence" eType="#//Sequence"
+        containment="true"/>
+    <eStructuralFeatures xsi:type="ecore:EReference" name="exitSequence" eType="#//Sequence"
+        containment="true"/>
   </eClassifiers>
   <eClassifiers xsi:type="ecore:EClass" name="Reaction" eSuperTypes="#//NamedElement">
     <eStructuralFeatures xsi:type="ecore:EReference" name="check" eType="#//Check"

+ 54 - 0
plugins/org.yakindu.sct.model.sexec/src/org/yakindu/sct/model/sexec/ExecutionState.java

@@ -22,6 +22,8 @@ import org.eclipse.emf.common.util.EList;
  *   <li>{@link org.yakindu.sct.model.sexec.ExecutionState#getReactions <em>Reactions</em>}</li>
  *   <li>{@link org.yakindu.sct.model.sexec.ExecutionState#getEntryAction <em>Entry Action</em>}</li>
  *   <li>{@link org.yakindu.sct.model.sexec.ExecutionState#getExitAction <em>Exit Action</em>}</li>
+ *   <li>{@link org.yakindu.sct.model.sexec.ExecutionState#getEnterSequence <em>Enter Sequence</em>}</li>
+ *   <li>{@link org.yakindu.sct.model.sexec.ExecutionState#getExitSequence <em>Exit Sequence</em>}</li>
  * </ul>
  * </p>
  *
@@ -150,6 +152,58 @@ public interface ExecutionState extends NamedElement {
 	 */
 	void setExitAction(Step value);
 
+	/**
+	 * Returns the value of the '<em><b>Enter Sequence</b></em>' containment reference.
+	 * <!-- begin-user-doc -->
+	 * <p>
+	 * If the meaning of the '<em>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>Enter Sequence</em>' containment reference.
+	 * @see #setEnterSequence(Sequence)
+	 * @see org.yakindu.sct.model.sexec.SexecPackage#getExecutionState_EnterSequence()
+	 * @model containment="true"
+	 * @generated
+	 */
+	Sequence getEnterSequence();
+
+	/**
+	 * Sets the value of the '{@link org.yakindu.sct.model.sexec.ExecutionState#getEnterSequence <em>Enter Sequence</em>}' containment reference.
+	 * <!-- begin-user-doc -->
+	 * <!-- end-user-doc -->
+	 * @param value the new value of the '<em>Enter Sequence</em>' containment reference.
+	 * @see #getEnterSequence()
+	 * @generated
+	 */
+	void setEnterSequence(Sequence value);
+
+	/**
+	 * Returns the value of the '<em><b>Exit Sequence</b></em>' containment reference.
+	 * <!-- begin-user-doc -->
+	 * <p>
+	 * If the meaning of the '<em>Exit 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>Exit Sequence</em>' containment reference.
+	 * @see #setExitSequence(Sequence)
+	 * @see org.yakindu.sct.model.sexec.SexecPackage#getExecutionState_ExitSequence()
+	 * @model containment="true"
+	 * @generated
+	 */
+	Sequence getExitSequence();
+
+	/**
+	 * Sets the value of the '{@link org.yakindu.sct.model.sexec.ExecutionState#getExitSequence <em>Exit Sequence</em>}' containment reference.
+	 * <!-- begin-user-doc -->
+	 * <!-- end-user-doc -->
+	 * @param value the new value of the '<em>Exit Sequence</em>' containment reference.
+	 * @see #getExitSequence()
+	 * @generated
+	 */
+	void setExitSequence(Sequence value);
+
 	/**
 	 * Returns the value of the '<em><b>Leaf</b></em>' attribute.
 	 * The default value is <code>"false"</code>.

+ 57 - 1
plugins/org.yakindu.sct.model.sexec/src/org/yakindu/sct/model/sexec/SexecPackage.java

@@ -407,6 +407,24 @@ public interface SexecPackage extends EPackage {
 	 */
 	int EXECUTION_STATE__EXIT_ACTION = NAMED_ELEMENT_FEATURE_COUNT + 5;
 
+	/**
+	 * The feature id for the '<em><b>Enter Sequence</b></em>' containment reference.
+	 * <!-- begin-user-doc -->
+	 * <!-- end-user-doc -->
+	 * @generated
+	 * @ordered
+	 */
+	int EXECUTION_STATE__ENTER_SEQUENCE = NAMED_ELEMENT_FEATURE_COUNT + 6;
+
+	/**
+	 * The feature id for the '<em><b>Exit Sequence</b></em>' containment reference.
+	 * <!-- begin-user-doc -->
+	 * <!-- end-user-doc -->
+	 * @generated
+	 * @ordered
+	 */
+	int EXECUTION_STATE__EXIT_SEQUENCE = NAMED_ELEMENT_FEATURE_COUNT + 7;
+
 	/**
 	 * The number of structural features of the '<em>Execution State</em>' class.
 	 * <!-- begin-user-doc -->
@@ -414,7 +432,7 @@ public interface SexecPackage extends EPackage {
 	 * @generated
 	 * @ordered
 	 */
-	int EXECUTION_STATE_FEATURE_COUNT = NAMED_ELEMENT_FEATURE_COUNT + 6;
+	int EXECUTION_STATE_FEATURE_COUNT = NAMED_ELEMENT_FEATURE_COUNT + 8;
 
 	/**
 	 * The feature id for the '<em><b>Name</b></em>' attribute.
@@ -1080,6 +1098,28 @@ public interface SexecPackage extends EPackage {
 	 */
 	EReference getExecutionState_ExitAction();
 
+	/**
+	 * Returns the meta object for the containment reference '{@link org.yakindu.sct.model.sexec.ExecutionState#getEnterSequence <em>Enter Sequence</em>}'.
+	 * <!-- begin-user-doc -->
+	 * <!-- end-user-doc -->
+	 * @return the meta object for the containment reference '<em>Enter Sequence</em>'.
+	 * @see org.yakindu.sct.model.sexec.ExecutionState#getEnterSequence()
+	 * @see #getExecutionState()
+	 * @generated
+	 */
+	EReference getExecutionState_EnterSequence();
+
+	/**
+	 * Returns the meta object for the containment reference '{@link org.yakindu.sct.model.sexec.ExecutionState#getExitSequence <em>Exit Sequence</em>}'.
+	 * <!-- begin-user-doc -->
+	 * <!-- end-user-doc -->
+	 * @return the meta object for the containment reference '<em>Exit Sequence</em>'.
+	 * @see org.yakindu.sct.model.sexec.ExecutionState#getExitSequence()
+	 * @see #getExecutionState()
+	 * @generated
+	 */
+	EReference getExecutionState_ExitSequence();
+
 	/**
 	 * Returns the meta object for the attribute '{@link org.yakindu.sct.model.sexec.ExecutionState#isLeaf <em>Leaf</em>}'.
 	 * <!-- begin-user-doc -->
@@ -1596,6 +1636,22 @@ public interface SexecPackage extends EPackage {
 		 */
 		EReference EXECUTION_STATE__EXIT_ACTION = eINSTANCE.getExecutionState_ExitAction();
 
+		/**
+		 * The meta object literal for the '<em><b>Enter Sequence</b></em>' containment reference feature.
+		 * <!-- begin-user-doc -->
+		 * <!-- end-user-doc -->
+		 * @generated
+		 */
+		EReference EXECUTION_STATE__ENTER_SEQUENCE = eINSTANCE.getExecutionState_EnterSequence();
+
+		/**
+		 * The meta object literal for the '<em><b>Exit Sequence</b></em>' containment reference feature.
+		 * <!-- begin-user-doc -->
+		 * <!-- end-user-doc -->
+		 * @generated
+		 */
+		EReference EXECUTION_STATE__EXIT_SEQUENCE = eINSTANCE.getExecutionState_ExitSequence();
+
 		/**
 		 * The meta object literal for the '<em><b>Leaf</b></em>' attribute feature.
 		 * <!-- begin-user-doc -->

+ 133 - 0
plugins/org.yakindu.sct.model.sexec/src/org/yakindu/sct/model/sexec/impl/ExecutionStateImpl.java

@@ -19,6 +19,7 @@ import org.eclipse.emf.ecore.util.InternalEList;
 import org.yakindu.sct.model.sexec.Cycle;
 import org.yakindu.sct.model.sexec.ExecutionState;
 import org.yakindu.sct.model.sexec.Reaction;
+import org.yakindu.sct.model.sexec.Sequence;
 import org.yakindu.sct.model.sexec.SexecPackage;
 import org.yakindu.sct.model.sexec.Step;
 
@@ -35,6 +36,8 @@ import org.yakindu.sct.model.sexec.Step;
  *   <li>{@link org.yakindu.sct.model.sexec.impl.ExecutionStateImpl#getReactions <em>Reactions</em>}</li>
  *   <li>{@link org.yakindu.sct.model.sexec.impl.ExecutionStateImpl#getEntryAction <em>Entry Action</em>}</li>
  *   <li>{@link org.yakindu.sct.model.sexec.impl.ExecutionStateImpl#getExitAction <em>Exit Action</em>}</li>
+ *   <li>{@link org.yakindu.sct.model.sexec.impl.ExecutionStateImpl#getEnterSequence <em>Enter Sequence</em>}</li>
+ *   <li>{@link org.yakindu.sct.model.sexec.impl.ExecutionStateImpl#getExitSequence <em>Exit Sequence</em>}</li>
  * </ul>
  * </p>
  *
@@ -121,6 +124,26 @@ public class ExecutionStateImpl extends NamedElementImpl implements ExecutionSta
 	 */
 	protected Step exitAction;
 
+	/**
+	 * The cached value of the '{@link #getEnterSequence() <em>Enter Sequence</em>}' containment reference.
+	 * <!-- begin-user-doc -->
+	 * <!-- end-user-doc -->
+	 * @see #getEnterSequence()
+	 * @generated
+	 * @ordered
+	 */
+	protected Sequence enterSequence;
+
+	/**
+	 * The cached value of the '{@link #getExitSequence() <em>Exit Sequence</em>}' containment reference.
+	 * <!-- begin-user-doc -->
+	 * <!-- end-user-doc -->
+	 * @see #getExitSequence()
+	 * @generated
+	 * @ordered
+	 */
+	protected Sequence exitSequence;
+
 	/**
 	 * <!-- begin-user-doc -->
 	 * <!-- end-user-doc -->
@@ -302,6 +325,92 @@ public class ExecutionStateImpl extends NamedElementImpl implements ExecutionSta
 			eNotify(new ENotificationImpl(this, Notification.SET, SexecPackage.EXECUTION_STATE__EXIT_ACTION, newExitAction, newExitAction));
 	}
 
+	/**
+	 * <!-- begin-user-doc -->
+	 * <!-- end-user-doc -->
+	 * @generated
+	 */
+	public Sequence getEnterSequence() {
+		return enterSequence;
+	}
+
+	/**
+	 * <!-- begin-user-doc -->
+	 * <!-- end-user-doc -->
+	 * @generated
+	 */
+	public NotificationChain basicSetEnterSequence(Sequence newEnterSequence, NotificationChain msgs) {
+		Sequence oldEnterSequence = enterSequence;
+		enterSequence = newEnterSequence;
+		if (eNotificationRequired()) {
+			ENotificationImpl notification = new ENotificationImpl(this, Notification.SET, SexecPackage.EXECUTION_STATE__ENTER_SEQUENCE, oldEnterSequence, newEnterSequence);
+			if (msgs == null) msgs = notification; else msgs.add(notification);
+		}
+		return msgs;
+	}
+
+	/**
+	 * <!-- begin-user-doc -->
+	 * <!-- end-user-doc -->
+	 * @generated
+	 */
+	public void setEnterSequence(Sequence newEnterSequence) {
+		if (newEnterSequence != enterSequence) {
+			NotificationChain msgs = null;
+			if (enterSequence != null)
+				msgs = ((InternalEObject)enterSequence).eInverseRemove(this, EOPPOSITE_FEATURE_BASE - SexecPackage.EXECUTION_STATE__ENTER_SEQUENCE, null, msgs);
+			if (newEnterSequence != null)
+				msgs = ((InternalEObject)newEnterSequence).eInverseAdd(this, EOPPOSITE_FEATURE_BASE - SexecPackage.EXECUTION_STATE__ENTER_SEQUENCE, null, msgs);
+			msgs = basicSetEnterSequence(newEnterSequence, msgs);
+			if (msgs != null) msgs.dispatch();
+		}
+		else if (eNotificationRequired())
+			eNotify(new ENotificationImpl(this, Notification.SET, SexecPackage.EXECUTION_STATE__ENTER_SEQUENCE, newEnterSequence, newEnterSequence));
+	}
+
+	/**
+	 * <!-- begin-user-doc -->
+	 * <!-- end-user-doc -->
+	 * @generated
+	 */
+	public Sequence getExitSequence() {
+		return exitSequence;
+	}
+
+	/**
+	 * <!-- begin-user-doc -->
+	 * <!-- end-user-doc -->
+	 * @generated
+	 */
+	public NotificationChain basicSetExitSequence(Sequence newExitSequence, NotificationChain msgs) {
+		Sequence oldExitSequence = exitSequence;
+		exitSequence = newExitSequence;
+		if (eNotificationRequired()) {
+			ENotificationImpl notification = new ENotificationImpl(this, Notification.SET, SexecPackage.EXECUTION_STATE__EXIT_SEQUENCE, oldExitSequence, newExitSequence);
+			if (msgs == null) msgs = notification; else msgs.add(notification);
+		}
+		return msgs;
+	}
+
+	/**
+	 * <!-- begin-user-doc -->
+	 * <!-- end-user-doc -->
+	 * @generated
+	 */
+	public void setExitSequence(Sequence newExitSequence) {
+		if (newExitSequence != exitSequence) {
+			NotificationChain msgs = null;
+			if (exitSequence != null)
+				msgs = ((InternalEObject)exitSequence).eInverseRemove(this, EOPPOSITE_FEATURE_BASE - SexecPackage.EXECUTION_STATE__EXIT_SEQUENCE, null, msgs);
+			if (newExitSequence != null)
+				msgs = ((InternalEObject)newExitSequence).eInverseAdd(this, EOPPOSITE_FEATURE_BASE - SexecPackage.EXECUTION_STATE__EXIT_SEQUENCE, null, msgs);
+			msgs = basicSetExitSequence(newExitSequence, msgs);
+			if (msgs != null) msgs.dispatch();
+		}
+		else if (eNotificationRequired())
+			eNotify(new ENotificationImpl(this, Notification.SET, SexecPackage.EXECUTION_STATE__EXIT_SEQUENCE, newExitSequence, newExitSequence));
+	}
+
 	/**
 	 * <!-- begin-user-doc -->
 	 * <!-- end-user-doc -->
@@ -339,6 +448,10 @@ public class ExecutionStateImpl extends NamedElementImpl implements ExecutionSta
 				return basicSetEntryAction(null, msgs);
 			case SexecPackage.EXECUTION_STATE__EXIT_ACTION:
 				return basicSetExitAction(null, msgs);
+			case SexecPackage.EXECUTION_STATE__ENTER_SEQUENCE:
+				return basicSetEnterSequence(null, msgs);
+			case SexecPackage.EXECUTION_STATE__EXIT_SEQUENCE:
+				return basicSetExitSequence(null, msgs);
 		}
 		return super.eInverseRemove(otherEnd, featureID, msgs);
 	}
@@ -363,6 +476,10 @@ public class ExecutionStateImpl extends NamedElementImpl implements ExecutionSta
 				return getEntryAction();
 			case SexecPackage.EXECUTION_STATE__EXIT_ACTION:
 				return getExitAction();
+			case SexecPackage.EXECUTION_STATE__ENTER_SEQUENCE:
+				return getEnterSequence();
+			case SexecPackage.EXECUTION_STATE__EXIT_SEQUENCE:
+				return getExitSequence();
 		}
 		return super.eGet(featureID, resolve, coreType);
 	}
@@ -395,6 +512,12 @@ public class ExecutionStateImpl extends NamedElementImpl implements ExecutionSta
 			case SexecPackage.EXECUTION_STATE__EXIT_ACTION:
 				setExitAction((Step)newValue);
 				return;
+			case SexecPackage.EXECUTION_STATE__ENTER_SEQUENCE:
+				setEnterSequence((Sequence)newValue);
+				return;
+			case SexecPackage.EXECUTION_STATE__EXIT_SEQUENCE:
+				setExitSequence((Sequence)newValue);
+				return;
 		}
 		super.eSet(featureID, newValue);
 	}
@@ -425,6 +548,12 @@ public class ExecutionStateImpl extends NamedElementImpl implements ExecutionSta
 			case SexecPackage.EXECUTION_STATE__EXIT_ACTION:
 				setExitAction((Step)null);
 				return;
+			case SexecPackage.EXECUTION_STATE__ENTER_SEQUENCE:
+				setEnterSequence((Sequence)null);
+				return;
+			case SexecPackage.EXECUTION_STATE__EXIT_SEQUENCE:
+				setExitSequence((Sequence)null);
+				return;
 		}
 		super.eUnset(featureID);
 	}
@@ -449,6 +578,10 @@ public class ExecutionStateImpl extends NamedElementImpl implements ExecutionSta
 				return entryAction != null;
 			case SexecPackage.EXECUTION_STATE__EXIT_ACTION:
 				return exitAction != null;
+			case SexecPackage.EXECUTION_STATE__ENTER_SEQUENCE:
+				return enterSequence != null;
+			case SexecPackage.EXECUTION_STATE__EXIT_SEQUENCE:
+				return exitSequence != null;
 		}
 		return super.eIsSet(featureID);
 	}

+ 1 - 0
plugins/org.yakindu.sct.model.sexec/src/org/yakindu/sct/model/sexec/impl/SexecFactoryImpl.java

@@ -11,6 +11,7 @@ import org.eclipse.emf.ecore.EObject;
 import org.eclipse.emf.ecore.EPackage;
 import org.eclipse.emf.ecore.impl.EFactoryImpl;
 import org.eclipse.emf.ecore.plugin.EcorePlugin;
+import org.yakindu.sct.model.sexec.*;
 import org.yakindu.sct.model.sexec.Call;
 import org.yakindu.sct.model.sexec.Check;
 import org.yakindu.sct.model.sexec.CheckRef;

+ 22 - 0
plugins/org.yakindu.sct.model.sexec/src/org/yakindu/sct/model/sexec/impl/SexecPackageImpl.java

@@ -329,6 +329,24 @@ public class SexecPackageImpl extends EPackageImpl implements SexecPackage {
 		return (EReference)executionStateEClass.getEStructuralFeatures().get(5);
 	}
 
+	/**
+	 * <!-- begin-user-doc -->
+	 * <!-- end-user-doc -->
+	 * @generated
+	 */
+	public EReference getExecutionState_EnterSequence() {
+		return (EReference)executionStateEClass.getEStructuralFeatures().get(6);
+	}
+
+	/**
+	 * <!-- begin-user-doc -->
+	 * <!-- end-user-doc -->
+	 * @generated
+	 */
+	public EReference getExecutionState_ExitSequence() {
+		return (EReference)executionStateEClass.getEStructuralFeatures().get(7);
+	}
+
 	/**
 	 * <!-- begin-user-doc -->
 	 * <!-- end-user-doc -->
@@ -722,6 +740,8 @@ public class SexecPackageImpl extends EPackageImpl implements SexecPackage {
 		createEReference(executionStateEClass, EXECUTION_STATE__REACTIONS);
 		createEReference(executionStateEClass, EXECUTION_STATE__ENTRY_ACTION);
 		createEReference(executionStateEClass, EXECUTION_STATE__EXIT_ACTION);
+		createEReference(executionStateEClass, EXECUTION_STATE__ENTER_SEQUENCE);
+		createEReference(executionStateEClass, EXECUTION_STATE__EXIT_SEQUENCE);
 
 		reactionEClass = createEClass(REACTION);
 		createEReference(reactionEClass, REACTION__CHECK);
@@ -840,6 +860,8 @@ public class SexecPackageImpl extends EPackageImpl implements SexecPackage {
 		initEReference(getExecutionState_Reactions(), this.getReaction(), null, "reactions", null, 0, -1, ExecutionState.class, !IS_TRANSIENT, !IS_VOLATILE, IS_CHANGEABLE, IS_COMPOSITE, !IS_RESOLVE_PROXIES, !IS_UNSETTABLE, IS_UNIQUE, !IS_DERIVED, IS_ORDERED);
 		initEReference(getExecutionState_EntryAction(), this.getStep(), null, "entryAction", null, 0, 1, ExecutionState.class, !IS_TRANSIENT, !IS_VOLATILE, IS_CHANGEABLE, IS_COMPOSITE, !IS_RESOLVE_PROXIES, !IS_UNSETTABLE, IS_UNIQUE, !IS_DERIVED, IS_ORDERED);
 		initEReference(getExecutionState_ExitAction(), this.getStep(), null, "exitAction", null, 0, 1, ExecutionState.class, !IS_TRANSIENT, !IS_VOLATILE, IS_CHANGEABLE, IS_COMPOSITE, !IS_RESOLVE_PROXIES, !IS_UNSETTABLE, IS_UNIQUE, !IS_DERIVED, IS_ORDERED);
+		initEReference(getExecutionState_EnterSequence(), this.getSequence(), null, "enterSequence", null, 0, 1, ExecutionState.class, !IS_TRANSIENT, !IS_VOLATILE, IS_CHANGEABLE, IS_COMPOSITE, !IS_RESOLVE_PROXIES, !IS_UNSETTABLE, IS_UNIQUE, !IS_DERIVED, IS_ORDERED);
+		initEReference(getExecutionState_ExitSequence(), this.getSequence(), null, "exitSequence", null, 0, 1, ExecutionState.class, !IS_TRANSIENT, !IS_VOLATILE, IS_CHANGEABLE, IS_COMPOSITE, !IS_RESOLVE_PROXIES, !IS_UNSETTABLE, IS_UNIQUE, !IS_DERIVED, IS_ORDERED);
 
 		initEClass(reactionEClass, Reaction.class, "Reaction", !IS_ABSTRACT, !IS_INTERFACE, IS_GENERATED_INSTANCE_CLASS);
 		initEReference(getReaction_Check(), this.getCheck(), null, "check", null, 0, 1, Reaction.class, !IS_TRANSIENT, !IS_VOLATILE, IS_CHANGEABLE, IS_COMPOSITE, !IS_RESOLVE_PROXIES, !IS_UNSETTABLE, IS_UNIQUE, !IS_DERIVED, IS_ORDERED);

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

@@ -60,8 +60,10 @@ class FactoryExtension {
 	
 	
 	def ExecutionState create r : sexecFactory.createExecutionState create(State state){
-		r.simpleName = state.name
-		r.name = state.fullyQualifiedName.toString.replaceAll(" ", "")
+		if (state != null) {
+			r.simpleName = state.name
+			r.name = state.fullyQualifiedName.toString.replaceAll(" ", "")		
+		}
 	}
 	
 	def Check create r : sexecFactory.createCheck createCheck(ReactionTrigger tr){

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

@@ -84,6 +84,7 @@ class ModelSequencer {
 		
 		// derive all additional information that is necessary for the execution
 		ef.defineStateVector(sc)
+		ef.defineStateEnterSequences(sc)
 		ef.defineEnterSequence(sc)
 		ef.defineStateCycles(sc)
 		
@@ -523,6 +524,50 @@ class ModelSequencer {
 
 	/************** Calculating execution sequences **************/
 	
+	/**
+	 * Defines the enter sequences of all states
+	 */
+	def void defineStateEnterSequences(ExecutionFlow flow, Statechart sc) {
+		
+		// iterate over all regions
+		for ( r : sc.regions) defineStateEnterSequence(r)
+	}
+	
+
+	def void defineStateEnterSequence(Region r) {
+		
+		// process all states of a region
+		for ( s : r.vertices.filter(typeof(State))) defineStateEnterSequence(s)
+	}
+	
+	
+	def void defineStateEnterSequence(State state) {
+		
+		val execState = state.create
+		val seq = sexecFactory.createSequence
+		seq.name = "enterSequence"
+		seq.comment = "Default enter sequence for state " + state.name
+		if (execState.entryAction != null) seq.steps.add(execState.entryAction.newCall)
+
+		if ( execState.leaf ) {
+			
+			seq.steps += state.newEnterStateStep
+					
+		} else {
+	
+			for ( r : state.subRegions ) {
+				defineStateEnterSequence(r)
+				
+				val entryState = r.entry?.target?.create
+				
+				if (entryState != null && entryState.enterSequence != null) 
+					seq.steps.add(entryState.enterSequence.newCall);
+			} 
+		}
+
+		execState.enterSequence = seq
+	}
+	
 	
 	def defineEnterSequence(ExecutionFlow flow, Statechart sc) {
 		val enterSteps = new ArrayList<Step>()
@@ -535,6 +580,7 @@ class ModelSequencer {
 		// sc.regions.map(r | r.entry?.target?.newEnterStateStep).filter(e | e != null)
 		val enterSequence = sexecFactory.createSequence
 		enterSequence.name = "enter"
+		enterSequence.comment = "Default enter sequence for statechart " + sc.name
 		enterSteps.forEach(e | enterSequence.steps.add(e));
 		flow.enterSequence = enterSequence
 		return enterSequence
@@ -604,10 +650,16 @@ class ModelSequencer {
 		r.vertices.findFirst(v | v instanceof Entry && (v.name == null || "".equals(v.name) || v.name == 'default') ) as Entry
 	}
 	
-	
+	/**
+	 * Retrieves the target from an entry.
+	 * TODO: validation of preconditions for entry targets e.g every region needs an entry with appropriate target
+	 */
 	def target(Entry entry) {
 		if ( entry?.outgoingTransitions != null) {
-			if (entry.outgoingTransitions.size > 0) entry.outgoingTransitions.get(0).target as State
+			if (entry.outgoingTransitions.size > 0) {
+				val target =entry.outgoingTransitions.get(0).target
+				if (target instanceof State ) target as State	
+			}
 		}
 	}
 	 

+ 1 - 0
plugins/org.yakindu.sct.model.sexec/src/org/yakindu/sct/model/sexec/util/SexecAdapterFactory.java

@@ -10,6 +10,7 @@ import org.eclipse.emf.common.notify.Adapter;
 import org.eclipse.emf.common.notify.Notifier;
 import org.eclipse.emf.common.notify.impl.AdapterFactoryImpl;
 import org.eclipse.emf.ecore.EObject;
+import org.yakindu.sct.model.sexec.*;
 import org.yakindu.sct.model.sexec.Call;
 import org.yakindu.sct.model.sexec.Check;
 import org.yakindu.sct.model.sexec.CheckRef;

+ 1 - 0
plugins/org.yakindu.sct.model.sexec/src/org/yakindu/sct/model/sexec/util/SexecSwitch.java

@@ -9,6 +9,7 @@ package org.yakindu.sct.model.sexec.util;
 import org.eclipse.emf.ecore.EObject;
 import org.eclipse.emf.ecore.EPackage;
 import org.eclipse.emf.ecore.util.Switch;
+import org.yakindu.sct.model.sexec.*;
 import org.yakindu.sct.model.sexec.Call;
 import org.yakindu.sct.model.sexec.Check;
 import org.yakindu.sct.model.sexec.CheckRef;

+ 11 - 7
plugins/org.yakindu.sct.model.sexec/xtend-gen/org/yakindu/sct/model/sexec/transformation/FactoryExtension.java

@@ -7,6 +7,7 @@ import org.eclipse.emf.ecore.util.EcoreUtil;
 import org.eclipse.xtext.naming.IQualifiedNameProvider;
 import org.eclipse.xtext.naming.QualifiedName;
 import org.eclipse.xtext.xbase.lib.CollectionLiterals;
+import org.eclipse.xtext.xbase.lib.ObjectExtensions;
 import org.yakindu.sct.model.sexec.Call;
 import org.yakindu.sct.model.sexec.Check;
 import org.yakindu.sct.model.sexec.CheckRef;
@@ -142,13 +143,16 @@ public class FactoryExtension {
       r = _createExecutionState;
       _createCache_create_5.put(_cacheKey, r);
     }
-    {
-      String _name = state.getName();
-      r.setSimpleName(_name);
-      QualifiedName _fullyQualifiedName = this.qfnProvider.getFullyQualifiedName(state);
-      String _string = _fullyQualifiedName.toString();
-      String _replaceAll = _string.replaceAll(" ", "");
-      r.setName(_replaceAll);
+    boolean _operator_notEquals = ObjectExtensions.operator_notEquals(state, null);
+    if (_operator_notEquals) {
+      {
+        String _name = state.getName();
+        r.setSimpleName(_name);
+        QualifiedName _fullyQualifiedName = this.qfnProvider.getFullyQualifiedName(state);
+        String _string = _fullyQualifiedName.toString();
+        String _replaceAll = _string.replaceAll(" ", "");
+        r.setName(_replaceAll);
+      }
     }
     return r;
   }

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

@@ -95,6 +95,7 @@ public class ModelSequencer {
       this.mapTransitions(sc, ef);
       this.mapLocalReactions(sc, ef);
       this.defineStateVector(ef, sc);
+      this.defineStateEnterSequences(ef, sc);
       this.defineEnterSequence(ef, sc);
       this.defineStateCycles(ef, sc);
       this.retargetDeclRefs(ef);
@@ -1113,6 +1114,76 @@ public class ModelSequencer {
     }
   }
   
+  public void defineStateEnterSequences(final ExecutionFlow flow, final Statechart sc) {
+    EList<Region> _regions = sc.getRegions();
+    for (Region r : _regions) {
+      this.defineStateEnterSequence(r);
+    }
+  }
+  
+  public void defineStateEnterSequence(final Region r) {
+    EList<Vertex> _vertices = r.getVertices();
+    Iterable<State> _filter = IterableExtensions.<State>filter(_vertices, org.yakindu.sct.model.sgraph.State.class);
+    for (State s : _filter) {
+      this.defineStateEnterSequence(s);
+    }
+  }
+  
+  public void defineStateEnterSequence(final State state) {
+    {
+      ExecutionState _create = this.factory.create(state);
+      final ExecutionState execState = _create;
+      SexecFactory _sexecFactory = this.sexecFactory();
+      Sequence _createSequence = _sexecFactory.createSequence();
+      final Sequence seq = _createSequence;
+      seq.setName("enterSequence");
+      String _name = state.getName();
+      String _operator_plus = StringExtensions.operator_plus("Default enter sequence for state ", _name);
+      seq.setComment(_operator_plus);
+      Step _entryAction = execState.getEntryAction();
+      boolean _operator_notEquals = ObjectExtensions.operator_notEquals(_entryAction, null);
+      if (_operator_notEquals) {
+        EList<Step> _steps = seq.getSteps();
+        Step _entryAction_1 = execState.getEntryAction();
+        Call _newCall = this.factory.newCall(_entryAction_1);
+        _steps.add(_newCall);
+      }
+      boolean _isLeaf = execState.isLeaf();
+      if (_isLeaf) {
+        EList<Step> _steps_1 = seq.getSteps();
+        EnterState _newEnterStateStep = this.newEnterStateStep(state);
+        CollectionExtensions.<EnterState>operator_add(_steps_1, _newEnterStateStep);
+      } else {
+        EList<Region> _subRegions = state.getSubRegions();
+        for (Region r : _subRegions) {
+          {
+            this.defineStateEnterSequence(r);
+            Entry _entry = this.entry(r);
+            State _target = this==null?(State)null:this.target(_entry);
+            ExecutionState _create_1 = this.factory==null?(ExecutionState)null:this.factory.create(_target);
+            final ExecutionState entryState = _create_1;
+            boolean _operator_and = false;
+            boolean _operator_notEquals_1 = ObjectExtensions.operator_notEquals(entryState, null);
+            if (!_operator_notEquals_1) {
+              _operator_and = false;
+            } else {
+              Sequence _enterSequence = entryState.getEnterSequence();
+              boolean _operator_notEquals_2 = ObjectExtensions.operator_notEquals(_enterSequence, null);
+              _operator_and = BooleanExtensions.operator_and(_operator_notEquals_1, _operator_notEquals_2);
+            }
+            if (_operator_and) {
+              EList<Step> _steps_2 = seq.getSteps();
+              Sequence _enterSequence_1 = entryState.getEnterSequence();
+              Call _newCall_1 = this.factory.newCall(_enterSequence_1);
+              _steps_2.add(_newCall_1);
+            }
+          }
+        }
+      }
+      execState.setEnterSequence(seq);
+    }
+  }
+  
   public Sequence defineEnterSequence(final ExecutionFlow flow, final Statechart sc) {
     {
       ArrayList<Step> _arrayList = new ArrayList<Step>();
@@ -1135,6 +1206,9 @@ public class ModelSequencer {
       Sequence _createSequence = _sexecFactory.createSequence();
       final Sequence enterSequence = _createSequence;
       enterSequence.setName("enter");
+      String _name = sc.getName();
+      String _operator_plus = StringExtensions.operator_plus("Default enter sequence for statechart ", _name);
+      enterSequence.setComment(_operator_plus);
       final Function1<Step,Boolean> _function = new Function1<Step,Boolean>() {
           public Boolean apply(final Step e) {
             EList<Step> _steps = enterSequence.getSteps();
@@ -1338,10 +1412,19 @@ public class ModelSequencer {
       int _size = _outgoingTransitions_1.size();
       boolean _operator_greaterThan = ComparableExtensions.<Integer>operator_greaterThan(((Integer)_size), ((Integer)0));
       if (_operator_greaterThan) {
-        EList<Transition> _outgoingTransitions_2 = entry.getOutgoingTransitions();
-        Transition _get = _outgoingTransitions_2.get(0);
-        Vertex _target = _get.getTarget();
-        _xifexpression_1 = ((State) _target);
+        State _xblockexpression = null;
+        {
+          EList<Transition> _outgoingTransitions_2 = entry.getOutgoingTransitions();
+          Transition _get = _outgoingTransitions_2.get(0);
+          Vertex _target = _get.getTarget();
+          final Vertex target = _target;
+          State _xifexpression_2 = null;
+          if ((target instanceof org.yakindu.sct.model.sgraph.State)) {
+            _xifexpression_2 = ((State) target);
+          }
+          _xblockexpression = (_xifexpression_2);
+        }
+        _xifexpression_1 = _xblockexpression;
       }
       _xifexpression = _xifexpression_1;
     }

+ 0 - 1
test-plugins/org.yakindu.sct.model.sexec.test/.classpath

@@ -1,6 +1,5 @@
 <?xml version="1.0" encoding="UTF-8"?>
 <classpath>
-	<classpathentry kind="src" path="xtend-gen"/>
 	<classpathentry kind="con" path="org.eclipse.jdt.launching.JRE_CONTAINER/org.eclipse.jdt.internal.debug.ui.launcher.StandardVMType/J2SE-1.5"/>
 	<classpathentry kind="con" path="org.eclipse.pde.core.requiredPlugins"/>
 	<classpathentry kind="src" path="src"/>

+ 11 - 0
test-plugins/org.yakindu.sct.model.sexec.test/src/org/yakindu/sct/model/sexec/transformation/test/AllTests.java

@@ -0,0 +1,11 @@
+package org.yakindu.sct.model.sexec.transformation.test;
+
+import org.junit.runner.RunWith;
+import org.junit.runners.Suite;
+import org.junit.runners.Suite.SuiteClasses;
+
+@RunWith(Suite.class)
+@SuiteClasses({ModelSequencerTest.class, ModelSequencerStateTest.class, ModelSequencerHierarchyTest.class})
+public class AllTests {
+	
+}

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

@@ -0,0 +1,470 @@
+package org.yakindu.sct.model.sexec.transformation.test;
+
+import static org.junit.Assert.assertEquals;
+import static org.junit.Assert.assertNotNull;
+import static org.junit.Assert.assertNull;
+import static org.junit.Assert.assertSame;
+import static org.junit.Assert.assertTrue;
+import static org.yakindu.sct.model.sexec.transformation.test.SCTTestUtil.*;
+
+import org.junit.Before;
+import org.junit.Test;
+import org.yakindu.sct.model.sexec.Call;
+import org.yakindu.sct.model.sexec.ExecutionFlow;
+import org.yakindu.sct.model.sexec.ExecutionState;
+import org.yakindu.sct.model.sexec.Reaction;
+import org.yakindu.sct.model.sexec.Sequence;
+import org.yakindu.sct.model.sexec.transformation.ModelSequencer;
+import org.yakindu.sct.model.sexec.transformation.SequencerModule;
+import org.yakindu.sct.model.sgraph.Region;
+import org.yakindu.sct.model.sgraph.State;
+import org.yakindu.sct.model.sgraph.Statechart;
+import org.yakindu.sct.model.stext.stext.InterfaceScope;
+import org.yakindu.sct.model.stext.stext.Type;
+import org.yakindu.sct.model.stext.stext.VariableDefinition;
+
+import com.google.inject.Guice;
+import com.google.inject.Inject;
+import com.google.inject.Injector;
+
+public class ModelSequencerHierarchyTest {
+
+	@Inject
+	private ModelSequencer sequencer;
+
+	@Before
+	public void setup() {
+		Injector injector = Guice.createInjector(new SequencerModule());
+		injector.injectMembers(this);
+	}
+
+
+	/**
+	 * The transition sequence must contain all exit actions for parent states that will be left by a transition.
+	 */
+	@Test public void testParentEntryDeep() {
+		
+		Statechart sc = _createStatechart("sc"); {  
+			
+			InterfaceScope s_scope = _createInterfaceScope("Interface", sc);
+			VariableDefinition v1 = _createVariableDefinition("v1", Type.INTEGER, s_scope);
+			
+
+			Region r = _createRegion("r", sc); {
+				State s1 = _createState("s1", r); {
+					_createEntryAssignemnt(v1, s1, "1");
+
+					Region r_s1 = _createRegion("r", s1); {
+						State s3 = _createState("s3", r_s1); {
+							_createEntryAssignemnt(v1, s3, "2");
+							
+							Region r_s3 = _createRegion("r", s3); {
+								State s4 = _createState("s4", r_s3);
+								_createEntryAssignemnt(v1, s4, "3");
+
+								State s5 = _createState("s5", r_s3);
+							}
+						}
+					}
+				}		
+				State s2 = _createState("s2", r); {
+					Region r_s1 = _createRegion("r", s2); {
+						_createState("s6", r_s1);
+					}
+				}
+			}
+		}
+	
+		_createTransition(findState(sc, "s6"), findState(sc, "s4"));
+		
+		ExecutionFlow flow = sequencer.transform(sc);
+		
+		
+		ExecutionState _s1 = flow.getStates().get(0);
+		assertEquals("sc.r.s1", _s1.getName());
+		assertNotNull(_s1.getEntryAction());
+
+		ExecutionState _s3 = flow.getStates().get(1);
+		assertEquals("sc.r.s1.r.s3", _s3.getName());
+		assertNotNull(_s3.getEntryAction());
+
+		ExecutionState _s4 = flow.getStates().get(2);
+		assertEquals("sc.r.s1.r.s3.r.s4", _s4.getName());
+		assertNotNull(_s4.getEntryAction());
+		
+		ExecutionState _s6 = flow.getStates().get(5);
+		assertEquals("sc.r.s2.r.s6", _s6.getName());
+		assertNull(_s6.getEntryAction());
+		
+		Reaction _t = _s6.getReactions().get(0);
+		assertTrue(_t.isTransition());
+		
+		Sequence _effect = (Sequence) _t.getEffect();
+		assertEquals(5, _effect.getSteps().size());
+		
+		Call _s4_entryActionCall = (Call) _effect.getSteps().get(4);
+		assertSame( _s4.getEntryAction(), _s4_entryActionCall.getStep());	
+
+		Call _s3_entryActionCall = (Call) _effect.getSteps().get(3);
+		assertSame( _s3.getEntryAction(), _s3_entryActionCall.getStep());	
+
+		Call _s1_entryActionCall = (Call) _effect.getSteps().get(2);
+		assertSame( _s1.getEntryAction(), _s1_entryActionCall.getStep());	
+		
+	}
+	
+	
+	/**
+	 * The transition sequence must contain all exit actions for parent states that will be left by a transition. 
+	 * A parent state may have no exit action.
+	 * 
+	 */
+	@Test public void testParentEntryPartial() {
+		
+		Statechart sc = _createStatechart("sc"); {  
+			
+			InterfaceScope s_scope = _createInterfaceScope("Interface", sc);
+			VariableDefinition v1 = _createVariableDefinition("v1", Type.INTEGER, s_scope);
+			
+
+			Region r = _createRegion("r", sc); {
+				State s1 = _createState("s1", r); {
+					_createEntryAssignemnt(v1, s1, "1");
+
+					Region r_s1 = _createRegion("r", s1); {
+						State s3 = _createState("s3", r_s1); {
+							
+							Region r_s3 = _createRegion("r", s3); {
+								State s4 = _createState("s4", r_s3);
+								_createEntryAssignemnt(v1, s4, "3");
+
+								State s5 = _createState("s5", r_s3);
+							}
+						}
+					}
+				}		
+				State s2 = _createState("s2", r); {
+					Region r_s1 = _createRegion("r", s2); {
+						_createState("s6", r_s1);
+					}
+				}
+			}
+		}
+	
+		_createTransition(findState(sc, "s6"), findState(sc, "s4"));
+		
+		ExecutionFlow flow = sequencer.transform(sc);
+			
+		ExecutionState _s1 = flow.getStates().get(0);
+		assertEquals("sc.r.s1", _s1.getName());
+		assertNotNull(_s1.getEntryAction());
+
+		ExecutionState _s3 = flow.getStates().get(1);
+		assertEquals("sc.r.s1.r.s3", _s3.getName());
+		assertNull(_s3.getEntryAction());
+
+		ExecutionState _s4 = flow.getStates().get(2);
+		assertEquals("sc.r.s1.r.s3.r.s4", _s4.getName());
+		assertNotNull(_s4.getEntryAction());
+		
+		ExecutionState _s6 = flow.getStates().get(5);
+		assertEquals("sc.r.s2.r.s6", _s6.getName());
+		assertNull(_s6.getEntryAction());
+		
+		Reaction _t = _s6.getReactions().get(0);
+		assertTrue(_t.isTransition());
+		
+		Sequence _effect = (Sequence) _t.getEffect();
+		assertEquals(4, _effect.getSteps().size());
+		
+		Call _s4_entryActionCall = (Call) _effect.getSteps().get(3);
+		assertSame( _s4.getEntryAction(), _s4_entryActionCall.getStep());	
+
+		Call _s1_entryActionCall = (Call) _effect.getSteps().get(2);
+		assertSame( _s1.getEntryAction(), _s1_entryActionCall.getStep());	
+	}
+	
+	
+	
+	
+	/**
+	 * Transitions to sibling state must nut invoke parent exit actions.
+	 */
+	@Test public void testParentEntryExclusionForSiblingTransitions() {
+		
+		Statechart sc = _createStatechart("sc"); {  
+			
+			InterfaceScope s_scope = _createInterfaceScope("Interface", sc);
+			VariableDefinition v1 = _createVariableDefinition("v1", Type.INTEGER, s_scope);
+			
+
+			Region r = _createRegion("r", sc); {
+				State s1 = _createState("s1", r); {
+					_createEntryAssignemnt(v1, s1, "1");
+
+					Region r_s1 = _createRegion("r", s1); {
+						State s3 = _createState("s3", r_s1); {
+							_createEntryAssignemnt(v1, s3, "2");
+
+							Region r_s3 = _createRegion("r", s3); {
+								State s4 = _createState("s4", r_s3);
+								_createEntryAssignemnt(v1, s4, "3");
+
+								State s5 = _createState("s5", r_s3);
+							}
+						}
+					}
+				}		
+				State s2 = _createState("s2", r); {
+					Region r_s1 = _createRegion("r", s2); {
+						_createState("s6", r_s1);
+					}
+				}
+			}
+		}
+	
+		_createTransition(findState(sc, "s5"), findState(sc, "s4"));
+		
+		ExecutionFlow flow = sequencer.transform(sc);
+		
+		ExecutionState _s1 = flow.getStates().get(0);
+		assertEquals("sc.r.s1", _s1.getName());
+		assertNotNull(_s1.getEntryAction());
+
+		ExecutionState _s3 = flow.getStates().get(1);
+		assertEquals("sc.r.s1.r.s3", _s3.getName());
+		assertNotNull(_s3.getEntryAction());
+
+		ExecutionState _s4 = flow.getStates().get(2);
+		assertEquals("sc.r.s1.r.s3.r.s4", _s4.getName());
+		assertNotNull(_s4.getEntryAction());
+		
+		ExecutionState _s5 = flow.getStates().get(3);
+		assertEquals("sc.r.s1.r.s3.r.s5", _s5.getName());
+		assertNull(_s5.getEntryAction());
+		
+		Reaction _t = _s5.getReactions().get(0);
+		assertTrue(_t.isTransition());
+		
+		Sequence _effect = (Sequence) _t.getEffect();
+		assertEquals(3, _effect.getSteps().size());
+		
+		Call _s4_entryActionCall = (Call) _effect.getSteps().get(2);
+		assertSame( _s4.getEntryAction(), _s4_entryActionCall.getStep());	
+	}
+
+
+	
+	
+	
+	
+	/**
+	 * The transition sequence must contain all exit actions for parent states that will be left by a transition.
+	 */
+	@Test public void testParentExitDeep() {
+		
+		Statechart sc = _createStatechart("sc"); {  
+			
+			InterfaceScope s_scope = _createInterfaceScope("Interface", sc);
+			VariableDefinition v1 = _createVariableDefinition("v1", Type.INTEGER, s_scope);
+			
+
+			Region r = _createRegion("r", sc); {
+				State s1 = _createState("s1", r); {
+					_createExitAssignemnt(v1, s1, "1");
+
+					Region r_s1 = _createRegion("r", s1); {
+						State s3 = _createState("s3", r_s1); {
+							_createExitAssignemnt(v1, s3, "2");
+							
+							Region r_s3 = _createRegion("r", s3); {
+								State s4 = _createState("s4", r_s3);
+								_createExitAssignemnt(v1, s4, "3");
+
+								State s5 = _createState("s5", r_s3);
+							}
+						}
+					}
+				}		
+				State s2 = _createState("s2", r); {
+					Region r_s1 = _createRegion("r", s2); {
+						_createState("s6", r_s1);
+					}
+				}
+			}
+		}
+	
+		_createTransition(findState(sc, "s4"), findState(sc, "s6"));
+		
+		ExecutionFlow flow = sequencer.transform(sc);
+		
+		
+		ExecutionState _s1 = flow.getStates().get(0);
+		assertEquals("sc.r.s1", _s1.getName());
+		assertNotNull(_s1.getExitAction());
+
+		ExecutionState _s3 = flow.getStates().get(1);
+		assertEquals("sc.r.s1.r.s3", _s3.getName());
+		assertNotNull(_s3.getExitAction());
+
+		ExecutionState _s4 = flow.getStates().get(2);
+		assertEquals("sc.r.s1.r.s3.r.s4", _s4.getName());
+		assertNotNull(_s4.getExitAction());
+		
+		Reaction _t = _s4.getReactions().get(0);
+		assertTrue(_t.isTransition());
+		
+		Sequence _effect = (Sequence) _t.getEffect();
+		assertEquals(5, _effect.getSteps().size());
+		
+		Call _s4_exitActionCall = (Call) _effect.getSteps().get(0);
+		assertSame( _s4.getExitAction(), _s4_exitActionCall.getStep());	
+
+		Call _s3_exitActionCall = (Call) _effect.getSteps().get(1);
+		assertSame( _s3.getExitAction(), _s3_exitActionCall.getStep());	
+
+		Call _s1_exitActionCall = (Call) _effect.getSteps().get(2);
+		assertSame( _s1.getExitAction(), _s1_exitActionCall.getStep());	
+		
+	}
+	
+	
+	/**
+	 * The transition sequence must contain all exit actions for parent states that will be left by a transition. 
+	 * A parent state may have no exit action.
+	 * 
+	 */
+	@Test public void testParentExitPartial() {
+		
+		Statechart sc = _createStatechart("sc"); {  
+			
+			InterfaceScope s_scope = _createInterfaceScope("Interface", sc);
+			VariableDefinition v1 = _createVariableDefinition("v1", Type.INTEGER, s_scope);
+			
+
+			Region r = _createRegion("r", sc); {
+				State s1 = _createState("s1", r); {
+					_createExitAssignemnt(v1, s1, "1");
+
+					Region r_s1 = _createRegion("r", s1); {
+						State s3 = _createState("s3", r_s1); {
+							
+							Region r_s3 = _createRegion("r", s3); {
+								State s4 = _createState("s4", r_s3);
+								_createExitAssignemnt(v1, s4, "3");
+
+								State s5 = _createState("s5", r_s3);
+							}
+						}
+					}
+				}		
+				State s2 = _createState("s2", r); {
+					Region r_s1 = _createRegion("r", s2); {
+						_createState("s6", r_s1);
+					}
+				}
+			}
+		}
+	
+		_createTransition(findState(sc, "s4"), findState(sc, "s6"));
+		
+		ExecutionFlow flow = sequencer.transform(sc);
+		
+		
+		ExecutionState _s1 = flow.getStates().get(0);
+		assertEquals("sc.r.s1", _s1.getName());
+		assertNotNull(_s1.getExitAction());
+
+		ExecutionState _s3 = flow.getStates().get(1);
+		assertEquals("sc.r.s1.r.s3", _s3.getName());
+		assertNull(_s3.getExitAction());
+
+		ExecutionState _s4 = flow.getStates().get(2);
+		assertEquals("sc.r.s1.r.s3.r.s4", _s4.getName());
+		assertNotNull(_s4.getExitAction());
+		
+		Reaction _t = _s4.getReactions().get(0);
+		assertTrue(_t.isTransition());
+		
+		Sequence _effect = (Sequence) _t.getEffect();
+		assertEquals(4, _effect.getSteps().size());
+		
+		Call _s4_exitActionCall = (Call) _effect.getSteps().get(0);
+		assertSame( _s4.getExitAction(), _s4_exitActionCall.getStep());	
+
+		Call _s1_exitActionCall = (Call) _effect.getSteps().get(1);
+		assertSame( _s1.getExitAction(), _s1_exitActionCall.getStep());	
+		
+	}
+	
+
+	
+	/**
+	 * Transitions to sibling state must nut invoke parent exit actions.
+	 */
+	@Test public void testParentExitExclusionForSiblingTransitions() {
+		
+		Statechart sc = _createStatechart("sc"); {  
+			
+			InterfaceScope s_scope = _createInterfaceScope("Interface", sc);
+			VariableDefinition v1 = _createVariableDefinition("v1", Type.INTEGER, s_scope);
+			
+
+			Region r = _createRegion("r", sc); {
+				State s1 = _createState("s1", r); {
+					_createExitAssignemnt(v1, s1, "1");
+
+					Region r_s1 = _createRegion("r", s1); {
+						State s3 = _createState("s3", r_s1); {
+							_createExitAssignemnt(v1, s3, "2");
+
+							Region r_s3 = _createRegion("r", s3); {
+								State s4 = _createState("s4", r_s3);
+								_createExitAssignemnt(v1, s4, "3");
+
+								State s5 = _createState("s5", r_s3);
+							}
+						}
+					}
+				}		
+				State s2 = _createState("s2", r); {
+					Region r_s1 = _createRegion("r", s2); {
+						_createState("s6", r_s1);
+					}
+				}
+			}
+		}
+	
+		_createTransition(findState(sc, "s4"), findState(sc, "s5"));
+		
+		ExecutionFlow flow = sequencer.transform(sc);
+		
+		
+		ExecutionState _s1 = flow.getStates().get(0);
+		assertEquals("sc.r.s1", _s1.getName());
+		assertNotNull(_s1.getExitAction());
+
+		ExecutionState _s3 = flow.getStates().get(1);
+		assertEquals("sc.r.s1.r.s3", _s3.getName());
+		assertNotNull(_s3.getExitAction());
+
+		ExecutionState _s4 = flow.getStates().get(2);
+		assertEquals("sc.r.s1.r.s3.r.s4", _s4.getName());
+		assertNotNull(_s4.getExitAction());
+		
+		Reaction _t = _s4.getReactions().get(0);
+		assertTrue(_t.isTransition());
+		
+		Sequence _effect = (Sequence) _t.getEffect();
+		assertEquals(3, _effect.getSteps().size());
+		
+		Call _s4_exitActionCall = (Call) _effect.getSteps().get(0);
+		assertSame( _s4.getExitAction(), _s4_exitActionCall.getStep());	
+		
+	}
+
+
+	
+	
+
+}

+ 213 - 0
test-plugins/org.yakindu.sct.model.sexec.test/src/org/yakindu/sct/model/sexec/transformation/test/ModelSequencerStateTest.java

@@ -0,0 +1,213 @@
+package org.yakindu.sct.model.sexec.transformation.test;
+
+import static org.junit.Assert.*;
+import static org.yakindu.sct.model.sexec.transformation.test.SCTTestUtil.*;
+
+import org.junit.Before;
+import org.junit.Test;
+import org.yakindu.sct.model.sexec.Call;
+import org.yakindu.sct.model.sexec.EnterState;
+import org.yakindu.sct.model.sexec.ExecutionFlow;
+import org.yakindu.sct.model.sexec.ExecutionState;
+import org.yakindu.sct.model.sexec.transformation.ModelSequencer;
+import org.yakindu.sct.model.sexec.transformation.SequencerModule;
+import org.yakindu.sct.model.sgraph.Entry;
+import org.yakindu.sct.model.sgraph.EntryKind;
+import org.yakindu.sct.model.sgraph.Region;
+import org.yakindu.sct.model.sgraph.Scope;
+import org.yakindu.sct.model.sgraph.State;
+import org.yakindu.sct.model.sgraph.Statechart;
+import org.yakindu.sct.model.stext.stext.AssignmentOperator;
+import org.yakindu.sct.model.stext.stext.LocalReaction;
+import org.yakindu.sct.model.stext.stext.ReactionEffect;
+import org.yakindu.sct.model.stext.stext.Type;
+import org.yakindu.sct.model.stext.stext.VariableDefinition;
+
+import com.google.inject.Guice;
+import com.google.inject.Inject;
+import com.google.inject.Injector;
+
+public class ModelSequencerStateTest {
+
+	
+	@Inject
+	private ModelSequencer sequencer;
+
+	@Before
+	public void setup() {
+		Injector injector = Guice.createInjector(new SequencerModule());
+		injector.injectMembers(this);
+	}
+
+
+	/**
+	 * if a state defines a entry action then the execution state must have a entryAction.
+	 */
+	@Test public void testStateEntryAction() {
+		Statechart sc = _createStatechart("test");
+		Scope scope = _createInterfaceScope("interface", sc);
+		VariableDefinition v1 = _createVariableDefinition("v1", Type.INTEGER, scope);
+		Region r = _createRegion("main", sc);
+		Entry e = _createEntry(EntryKind.INITIAL, null, r);
+		State s1 = _createState("s1", r);
+		State s2 = _createState("s2", r);
+		_createTransition(e, s1);
+		_createTransition(s1, s2);
+		LocalReaction entryAction = _createEntryAction(s2);
+		_createVariableAssignment(v1, AssignmentOperator.ASSIGN, _createValue("42"), (ReactionEffect) entryAction.getEffect());
+		
+		ExecutionFlow flow = sequencer.transform(sc);
+		
+		ExecutionState _s1 = flow.getStates().get(0);
+		ExecutionState _s2 = flow.getStates().get(1);
+		assertEquals(s1.getName(), _s1.getSimpleName());
+		assertEquals(s2.getName(), _s2.getSimpleName());
+		
+		assertNotNull(_s2.getEntryAction());
+		assertNull(_s1.getEntryAction());
+	}
+
+	
+	/**
+	 * entry actions of a substate must not be included in a states entry action list
+	 */
+	@Test public void testSubStateEntryAction() {
+		Statechart sc = _createStatechart("test");
+		Scope scope = _createInterfaceScope("interface", sc);
+		VariableDefinition v1 = _createVariableDefinition("v1", Type.INTEGER, scope);
+		Region r = _createRegion("main", sc);
+//		Entry e = _createEntry(EntryKind.INITIAL, null, r);
+		State s2 = _createState("s2", r);
+		
+		Region s2_r = _createRegion("sub", s2);
+		State s2_1 = _createState("s2_1", s2_r);
+		LocalReaction entryAction = _createEntryAction(s2_1);
+		_createVariableAssignment(v1, AssignmentOperator.ASSIGN, _createValue("42"), (ReactionEffect) entryAction.getEffect());
+		LocalReaction exitAction = _createExitAction(s2_1);
+		_createVariableAssignment(v1, AssignmentOperator.ASSIGN, _createValue("43"), (ReactionEffect) exitAction.getEffect());
+		
+		ExecutionFlow flow = sequencer.transform(sc);
+		
+		ExecutionState _s2 = flow.getStates().get(0);
+		ExecutionState _s2_1 = flow.getStates().get(1);
+		assertEquals(s2.getName(), _s2.getSimpleName());
+		assertEquals(s2_1.getName(), _s2_1.getSimpleName());
+		
+		assertNull(_s2.getEntryAction());
+		assertNotNull(_s2_1.getEntryAction());
+
+		assertNull(_s2.getExitAction());
+		assertNotNull(_s2_1.getExitAction());
+}
+	
+	
+	/**
+	 * if a state defines a exit action then the execution state must have a exitAction.
+	 */
+	@Test public void testStateExitAction() {
+		Statechart sc = _createStatechart("test");
+		Scope scope = _createInterfaceScope("interface", sc);
+		VariableDefinition v1 = _createVariableDefinition("v1", Type.INTEGER, scope);
+		Region r = _createRegion("main", sc);
+		Entry e = _createEntry(EntryKind.INITIAL, null, r);
+		State s1 = _createState("s1", r);
+		State s2 = _createState("s2", r);
+		_createTransition(e, s1);
+		_createTransition(s1, s2);
+		LocalReaction exitAction = _createExitAction(s1);
+		_createVariableAssignment(v1, AssignmentOperator.ASSIGN, _createValue("21"), (ReactionEffect) exitAction.getEffect());
+		
+		ExecutionFlow flow = sequencer.transform(sc);
+		
+		ExecutionState _s1 = flow.getStates().get(0);
+		ExecutionState _s2 = flow.getStates().get(1);
+		assertEquals(s1.getName(), _s1.getSimpleName());
+		assertEquals(s2.getName(), _s2.getSimpleName());
+		
+		assertNotNull(_s1.getExitAction());
+		assertNull(_s2.getExitAction());
+	}
+	
+
+	
+	/**
+	 * A leaf state must have a enter sequence. 
+	 * This enter sequence consists of an entry action call and a state enter step.
+	 */
+	@Test public void testLeafStateEnterSequence() {
+		Statechart sc = _createStatechart("cs");
+		Scope scope = _createInterfaceScope("interface", sc);
+		VariableDefinition v1 = _createVariableDefinition("v1", Type.INTEGER, scope);
+		Region r = _createRegion("r", sc);
+		State s1 = _createState("s1", r);
+		LocalReaction entryAction = _createEntryAction(s1);
+		_createVariableAssignment(v1, AssignmentOperator.ASSIGN, _createValue("42"), (ReactionEffect) entryAction.getEffect());
+		
+		ExecutionFlow flow = sequencer.transform(sc);
+		
+		ExecutionState _s1 = flow.getStates().get(0);
+		assertEquals(s1.getName(), _s1.getSimpleName());
+		
+		assertNotNull(_s1.getEntryAction());
+		assertNotNull(_s1.getEnterSequence());
+		assertEquals(2, _s1.getEnterSequence().getSteps().size());
+		Call entryCall = (Call) _s1.getEnterSequence().getSteps().get(0);
+		assertSame(_s1.getEntryAction(), entryCall.getStep());
+		
+		assertTrue(_s1.getEnterSequence().getSteps().get(1) instanceof EnterState);
+	}
+
+	
+	/**
+	 * A composite state must have a enter sequence. 
+	 * This enter sequence consists of an entry action call and a enter sequence call for each sub region.
+	 */
+	@Test public void testCompositeStateEnterSequence() {
+		Statechart sc = _createStatechart("cs"); {
+			Scope scope = _createInterfaceScope("interface", sc);
+			VariableDefinition v1 = _createVariableDefinition("v1", Type.INTEGER, scope);
+
+			Region r = _createRegion("r", sc); {
+				State s1 = _createState("s1", r); {
+					_createEntryAssignemnt(v1, s1, "1");
+					Region r1_s1 = _createRegion("r1", s1); {
+						Entry e = _createEntry(EntryKind.INITIAL, null, r1_s1);
+						State s2 = _createState("s2", r1_s1);
+						_createTransition(e, s2);
+					}
+					Region r2_s1 = _createRegion("r2", s1); {
+						Entry e = _createEntry(EntryKind.INITIAL, null, r2_s1);
+						State s3 = _createState("s3", r2_s1);
+						_createTransition(e, s3);
+					}
+				}
+			}
+		}
+		
+	
+		ExecutionFlow flow = sequencer.transform(sc);
+		
+		ExecutionState _s1 = flow.getStates().get(0);
+		assertEquals("s1", _s1.getSimpleName());
+		
+		ExecutionState _s2 = flow.getStates().get(1);
+		assertEquals("s2", _s2.getSimpleName());
+		
+		ExecutionState _s3 = flow.getStates().get(2);
+		assertEquals("s3", _s3.getSimpleName());
+		
+		assertNotNull(_s1.getEntryAction());
+		assertNotNull(_s1.getEnterSequence());
+		assertEquals(3, _s1.getEnterSequence().getSteps().size());
+		Call entryCall = (Call) _s1.getEnterSequence().getSteps().get(0);
+		assertSame(_s1.getEntryAction(), entryCall.getStep());
+		
+		Call subEnterCall1 = (Call) _s1.getEnterSequence().getSteps().get(1);
+		assertSame(_s2.getEnterSequence(), subEnterCall1.getStep());
+
+		Call subEnterCall2 = (Call) _s1.getEnterSequence().getSteps().get(2);
+		assertSame(_s3.getEnterSequence(), subEnterCall2.getStep());
+	}
+
+
+}

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

@@ -217,98 +217,9 @@ public class ModelSequencerTest {
 
 		enterState = (EnterState) flow.getEnterSequence().getSteps().get(1);
 		assertEquals(tsc.s3.getName(), enterState.getState().getSimpleName());
-	
 	}
 	
 	
-	/**
-	 * if a state defines a entry action then the execution state must have a entryAction.
-	 */
-	@Test public void testStateEntryAction() {
-		Statechart sc = _createStatechart("test");
-		Scope scope = _createInterfaceScope("interface", sc);
-		VariableDefinition v1 = _createVariableDefinition("v1", Type.INTEGER, scope);
-		Region r = _createRegion("main", sc);
-		Entry e = _createEntry(EntryKind.INITIAL, null, r);
-		State s1 = _createState("s1", r);
-		State s2 = _createState("s2", r);
-		Transition e_t = _createTransition(e, s1);
-		Transition s1_t = _createTransition(s1, s2);
-		LocalReaction entryAction = _createEntryAction(s2);
-		Assignment assign = _createVariableAssignment(v1, AssignmentOperator.ASSIGN, _createValue("42"), (ReactionEffect) entryAction.getEffect());
-		
-		ExecutionFlow flow = sequencer.transform(sc);
-		
-		ExecutionState _s1 = flow.getStates().get(0);
-		ExecutionState _s2 = flow.getStates().get(1);
-		assertEquals(s1.getName(), _s1.getSimpleName());
-		assertEquals(s2.getName(), _s2.getSimpleName());
-		
-		assertNotNull(_s2.getEntryAction());
-		assertNull(_s1.getEntryAction());
-	}
-
-	
-	/**
-	 * entry actions of a substate must not be included in a states entry action list
-	 */
-	@Test public void testSubStateEntryAction() {
-		Statechart sc = _createStatechart("test");
-		Scope scope = _createInterfaceScope("interface", sc);
-		VariableDefinition v1 = _createVariableDefinition("v1", Type.INTEGER, scope);
-		Region r = _createRegion("main", sc);
-//		Entry e = _createEntry(EntryKind.INITIAL, null, r);
-		State s2 = _createState("s2", r);
-		
-		Region s2_r = _createRegion("sub", s2);
-		State s2_1 = _createState("s2_1", s2_r);
-		LocalReaction entryAction = _createEntryAction(s2_1);
-		Assignment assign1 = _createVariableAssignment(v1, AssignmentOperator.ASSIGN, _createValue("42"), (ReactionEffect) entryAction.getEffect());
-		LocalReaction exitAction = _createExitAction(s2_1);
-		Assignment assign2 = _createVariableAssignment(v1, AssignmentOperator.ASSIGN, _createValue("43"), (ReactionEffect) exitAction.getEffect());
-		
-		ExecutionFlow flow = sequencer.transform(sc);
-		
-		ExecutionState _s2 = flow.getStates().get(0);
-		ExecutionState _s2_1 = flow.getStates().get(1);
-		assertEquals(s2.getName(), _s2.getSimpleName());
-		assertEquals(s2_1.getName(), _s2_1.getSimpleName());
-		
-		assertNull(_s2.getEntryAction());
-		assertNotNull(_s2_1.getEntryAction());
-
-		assertNull(_s2.getExitAction());
-		assertNotNull(_s2_1.getExitAction());
-}
-	
-	
-	/**
-	 * if a state defines a exit action then the execution state must have a exitAction.
-	 */
-	@Test public void testStateExitAction() {
-		Statechart sc = _createStatechart("test");
-		Scope scope = _createInterfaceScope("interface", sc);
-		VariableDefinition v1 = _createVariableDefinition("v1", Type.INTEGER, scope);
-		Region r = _createRegion("main", sc);
-		Entry e = _createEntry(EntryKind.INITIAL, null, r);
-		State s1 = _createState("s1", r);
-		State s2 = _createState("s2", r);
-		Transition e_t = _createTransition(e, s1);
-		Transition s1_t = _createTransition(s1, s2);
-		LocalReaction exitAction = _createExitAction(s1);
-		Assignment assign = _createVariableAssignment(v1, AssignmentOperator.ASSIGN, _createValue("21"), (ReactionEffect) exitAction.getEffect());
-		
-		ExecutionFlow flow = sequencer.transform(sc);
-		
-		ExecutionState _s1 = flow.getStates().get(0);
-		ExecutionState _s2 = flow.getStates().get(1);
-		assertEquals(s1.getName(), _s1.getSimpleName());
-		assertEquals(s2.getName(), _s2.getSimpleName());
-		
-		assertNotNull(_s1.getExitAction());
-		assertNull(_s2.getExitAction());
-	}
-	
 	
 	@Test public void testStateReaction_SimpleFlatTSC() {
 		SimpleFlatTSC tsc = new SimpleFlatTSC();
@@ -1085,442 +996,5 @@ public class ModelSequencerTest {
 
 	}
 	
-	
-	
-	/**
-	 * The transition sequence must contain all exit actions for parent states that will be left by a transition.
-	 */
-	@Test public void testParentEntryDeep() {
-		
-		Statechart sc = _createStatechart("sc"); {  
-			
-			InterfaceScope s_scope = _createInterfaceScope("Interface", sc);
-			VariableDefinition v1 = _createVariableDefinition("v1", Type.INTEGER, s_scope);
-			
-
-			Region r = _createRegion("r", sc); {
-				State s1 = _createState("s1", r); {
-					_createEntryAssignemnt(v1, s1, "1");
-
-					Region r_s1 = _createRegion("r", s1); {
-						State s3 = _createState("s3", r_s1); {
-							_createEntryAssignemnt(v1, s3, "2");
-							
-							Region r_s3 = _createRegion("r", s3); {
-								State s4 = _createState("s4", r_s3);
-								_createEntryAssignemnt(v1, s4, "3");
-
-								State s5 = _createState("s5", r_s3);
-							}
-						}
-					}
-				}		
-				State s2 = _createState("s2", r); {
-					Region r_s1 = _createRegion("r", s2); {
-						_createState("s6", r_s1);
-					}
-				}
-			}
-		}
-	
-		_createTransition(findState(sc, "s6"), findState(sc, "s4"));
-		
-		ExecutionFlow flow = sequencer.transform(sc);
-		
-		
-		ExecutionState _s1 = flow.getStates().get(0);
-		assertEquals("sc.r.s1", _s1.getName());
-		assertNotNull(_s1.getEntryAction());
-
-		ExecutionState _s3 = flow.getStates().get(1);
-		assertEquals("sc.r.s1.r.s3", _s3.getName());
-		assertNotNull(_s3.getEntryAction());
-
-		ExecutionState _s4 = flow.getStates().get(2);
-		assertEquals("sc.r.s1.r.s3.r.s4", _s4.getName());
-		assertNotNull(_s4.getEntryAction());
-		
-		ExecutionState _s6 = flow.getStates().get(5);
-		assertEquals("sc.r.s2.r.s6", _s6.getName());
-		assertNull(_s6.getEntryAction());
-		
-		Reaction _t = _s6.getReactions().get(0);
-		assertTrue(_t.isTransition());
-		
-		Sequence _effect = (Sequence) _t.getEffect();
-		assertEquals(5, _effect.getSteps().size());
-		
-		Call _s4_entryActionCall = (Call) _effect.getSteps().get(4);
-		assertSame( _s4.getEntryAction(), _s4_entryActionCall.getStep());	
-
-		Call _s3_entryActionCall = (Call) _effect.getSteps().get(3);
-		assertSame( _s3.getEntryAction(), _s3_entryActionCall.getStep());	
-
-		Call _s1_entryActionCall = (Call) _effect.getSteps().get(2);
-		assertSame( _s1.getEntryAction(), _s1_entryActionCall.getStep());	
-		
-	}
-	
-	
-	/**
-	 * The transition sequence must contain all exit actions for parent states that will be left by a transition. 
-	 * A parent state may have no exit action.
-	 * 
-	 */
-	@Test public void testParentEntryPartial() {
-		
-		Statechart sc = _createStatechart("sc"); {  
-			
-			InterfaceScope s_scope = _createInterfaceScope("Interface", sc);
-			VariableDefinition v1 = _createVariableDefinition("v1", Type.INTEGER, s_scope);
-			
-
-			Region r = _createRegion("r", sc); {
-				State s1 = _createState("s1", r); {
-					_createEntryAssignemnt(v1, s1, "1");
-
-					Region r_s1 = _createRegion("r", s1); {
-						State s3 = _createState("s3", r_s1); {
-							
-							Region r_s3 = _createRegion("r", s3); {
-								State s4 = _createState("s4", r_s3);
-								_createEntryAssignemnt(v1, s4, "3");
-
-								State s5 = _createState("s5", r_s3);
-							}
-						}
-					}
-				}		
-				State s2 = _createState("s2", r); {
-					Region r_s1 = _createRegion("r", s2); {
-						_createState("s6", r_s1);
-					}
-				}
-			}
-		}
-	
-		_createTransition(findState(sc, "s6"), findState(sc, "s4"));
-		
-		ExecutionFlow flow = sequencer.transform(sc);
-			
-		ExecutionState _s1 = flow.getStates().get(0);
-		assertEquals("sc.r.s1", _s1.getName());
-		assertNotNull(_s1.getEntryAction());
-
-		ExecutionState _s3 = flow.getStates().get(1);
-		assertEquals("sc.r.s1.r.s3", _s3.getName());
-		assertNull(_s3.getEntryAction());
-
-		ExecutionState _s4 = flow.getStates().get(2);
-		assertEquals("sc.r.s1.r.s3.r.s4", _s4.getName());
-		assertNotNull(_s4.getEntryAction());
-		
-		ExecutionState _s6 = flow.getStates().get(5);
-		assertEquals("sc.r.s2.r.s6", _s6.getName());
-		assertNull(_s6.getEntryAction());
-		
-		Reaction _t = _s6.getReactions().get(0);
-		assertTrue(_t.isTransition());
-		
-		Sequence _effect = (Sequence) _t.getEffect();
-		assertEquals(4, _effect.getSteps().size());
-		
-		Call _s4_entryActionCall = (Call) _effect.getSteps().get(3);
-		assertSame( _s4.getEntryAction(), _s4_entryActionCall.getStep());	
-
-		Call _s1_entryActionCall = (Call) _effect.getSteps().get(2);
-		assertSame( _s1.getEntryAction(), _s1_entryActionCall.getStep());	
-	}
-	
-	
-	
-	
-	/**
-	 * Transitions to sibling state must nut invoke parent exit actions.
-	 */
-	@Test public void testParentEntryExclusionForSiblingTransitions() {
-		
-		Statechart sc = _createStatechart("sc"); {  
-			
-			InterfaceScope s_scope = _createInterfaceScope("Interface", sc);
-			VariableDefinition v1 = _createVariableDefinition("v1", Type.INTEGER, s_scope);
-			
-
-			Region r = _createRegion("r", sc); {
-				State s1 = _createState("s1", r); {
-					_createEntryAssignemnt(v1, s1, "1");
-
-					Region r_s1 = _createRegion("r", s1); {
-						State s3 = _createState("s3", r_s1); {
-							_createEntryAssignemnt(v1, s3, "2");
-
-							Region r_s3 = _createRegion("r", s3); {
-								State s4 = _createState("s4", r_s3);
-								_createEntryAssignemnt(v1, s4, "3");
-
-								State s5 = _createState("s5", r_s3);
-							}
-						}
-					}
-				}		
-				State s2 = _createState("s2", r); {
-					Region r_s1 = _createRegion("r", s2); {
-						_createState("s6", r_s1);
-					}
-				}
-			}
-		}
-	
-		_createTransition(findState(sc, "s5"), findState(sc, "s4"));
-		
-		ExecutionFlow flow = sequencer.transform(sc);
-		
-		ExecutionState _s1 = flow.getStates().get(0);
-		assertEquals("sc.r.s1", _s1.getName());
-		assertNotNull(_s1.getEntryAction());
-
-		ExecutionState _s3 = flow.getStates().get(1);
-		assertEquals("sc.r.s1.r.s3", _s3.getName());
-		assertNotNull(_s3.getEntryAction());
-
-		ExecutionState _s4 = flow.getStates().get(2);
-		assertEquals("sc.r.s1.r.s3.r.s4", _s4.getName());
-		assertNotNull(_s4.getEntryAction());
-		
-		ExecutionState _s5 = flow.getStates().get(3);
-		assertEquals("sc.r.s1.r.s3.r.s5", _s5.getName());
-		assertNull(_s5.getEntryAction());
-		
-		Reaction _t = _s5.getReactions().get(0);
-		assertTrue(_t.isTransition());
-		
-		Sequence _effect = (Sequence) _t.getEffect();
-		assertEquals(3, _effect.getSteps().size());
-		
-		Call _s4_entryActionCall = (Call) _effect.getSteps().get(2);
-		assertSame( _s4.getEntryAction(), _s4_entryActionCall.getStep());	
-	}
-
-
-	protected void _createExitAssignemnt(VariableDefinition v1, State s1, String value) {
-		LocalReaction exitAction = _createExitAction(s1);
-		_createVariableAssignment(v1, AssignmentOperator.ASSIGN, _createValue(value), (ReactionEffect) exitAction.getEffect());
-	}
-
-
-	
-	
-	/**
-	 * The transition sequence must contain all exit actions for parent states that will be left by a transition.
-	 */
-	@Test public void testParentExitDeep() {
-		
-		Statechart sc = _createStatechart("sc"); {  
-			
-			InterfaceScope s_scope = _createInterfaceScope("Interface", sc);
-			VariableDefinition v1 = _createVariableDefinition("v1", Type.INTEGER, s_scope);
-			
-
-			Region r = _createRegion("r", sc); {
-				State s1 = _createState("s1", r); {
-					_createExitAssignemnt(v1, s1, "1");
-
-					Region r_s1 = _createRegion("r", s1); {
-						State s3 = _createState("s3", r_s1); {
-							_createExitAssignemnt(v1, s3, "2");
-							
-							Region r_s3 = _createRegion("r", s3); {
-								State s4 = _createState("s4", r_s3);
-								_createExitAssignemnt(v1, s4, "3");
-
-								State s5 = _createState("s5", r_s3);
-							}
-						}
-					}
-				}		
-				State s2 = _createState("s2", r); {
-					Region r_s1 = _createRegion("r", s2); {
-						_createState("s6", r_s1);
-					}
-				}
-			}
-		}
-	
-		_createTransition(findState(sc, "s4"), findState(sc, "s6"));
-		
-		ExecutionFlow flow = sequencer.transform(sc);
-		
-		
-		ExecutionState _s1 = flow.getStates().get(0);
-		assertEquals("sc.r.s1", _s1.getName());
-		assertNotNull(_s1.getExitAction());
-
-		ExecutionState _s3 = flow.getStates().get(1);
-		assertEquals("sc.r.s1.r.s3", _s3.getName());
-		assertNotNull(_s3.getExitAction());
-
-		ExecutionState _s4 = flow.getStates().get(2);
-		assertEquals("sc.r.s1.r.s3.r.s4", _s4.getName());
-		assertNotNull(_s4.getExitAction());
-		
-		Reaction _t = _s4.getReactions().get(0);
-		assertTrue(_t.isTransition());
-		
-		Sequence _effect = (Sequence) _t.getEffect();
-		assertEquals(5, _effect.getSteps().size());
-		
-		Call _s4_exitActionCall = (Call) _effect.getSteps().get(0);
-		assertSame( _s4.getExitAction(), _s4_exitActionCall.getStep());	
-
-		Call _s3_exitActionCall = (Call) _effect.getSteps().get(1);
-		assertSame( _s3.getExitAction(), _s3_exitActionCall.getStep());	
-
-		Call _s1_exitActionCall = (Call) _effect.getSteps().get(2);
-		assertSame( _s1.getExitAction(), _s1_exitActionCall.getStep());	
-		
-	}
-	
-	
-	/**
-	 * The transition sequence must contain all exit actions for parent states that will be left by a transition. 
-	 * A parent state may have no exit action.
-	 * 
-	 */
-	@Test public void testParentExitPartial() {
-		
-		Statechart sc = _createStatechart("sc"); {  
-			
-			InterfaceScope s_scope = _createInterfaceScope("Interface", sc);
-			VariableDefinition v1 = _createVariableDefinition("v1", Type.INTEGER, s_scope);
-			
-
-			Region r = _createRegion("r", sc); {
-				State s1 = _createState("s1", r); {
-					_createExitAssignemnt(v1, s1, "1");
-
-					Region r_s1 = _createRegion("r", s1); {
-						State s3 = _createState("s3", r_s1); {
-							
-							Region r_s3 = _createRegion("r", s3); {
-								State s4 = _createState("s4", r_s3);
-								_createExitAssignemnt(v1, s4, "3");
-
-								State s5 = _createState("s5", r_s3);
-							}
-						}
-					}
-				}		
-				State s2 = _createState("s2", r); {
-					Region r_s1 = _createRegion("r", s2); {
-						_createState("s6", r_s1);
-					}
-				}
-			}
-		}
-	
-		_createTransition(findState(sc, "s4"), findState(sc, "s6"));
-		
-		ExecutionFlow flow = sequencer.transform(sc);
-		
-		
-		ExecutionState _s1 = flow.getStates().get(0);
-		assertEquals("sc.r.s1", _s1.getName());
-		assertNotNull(_s1.getExitAction());
-
-		ExecutionState _s3 = flow.getStates().get(1);
-		assertEquals("sc.r.s1.r.s3", _s3.getName());
-		assertNull(_s3.getExitAction());
-
-		ExecutionState _s4 = flow.getStates().get(2);
-		assertEquals("sc.r.s1.r.s3.r.s4", _s4.getName());
-		assertNotNull(_s4.getExitAction());
-		
-		Reaction _t = _s4.getReactions().get(0);
-		assertTrue(_t.isTransition());
-		
-		Sequence _effect = (Sequence) _t.getEffect();
-		assertEquals(4, _effect.getSteps().size());
-		
-		Call _s4_exitActionCall = (Call) _effect.getSteps().get(0);
-		assertSame( _s4.getExitAction(), _s4_exitActionCall.getStep());	
-
-		Call _s1_exitActionCall = (Call) _effect.getSteps().get(1);
-		assertSame( _s1.getExitAction(), _s1_exitActionCall.getStep());	
-		
-	}
-	
-	
-	
-	
-	/**
-	 * Transitions to sibling state must nut invoke parent exit actions.
-	 */
-	@Test public void testParentExitExclusionForSiblingTransitions() {
-		
-		Statechart sc = _createStatechart("sc"); {  
-			
-			InterfaceScope s_scope = _createInterfaceScope("Interface", sc);
-			VariableDefinition v1 = _createVariableDefinition("v1", Type.INTEGER, s_scope);
-			
-
-			Region r = _createRegion("r", sc); {
-				State s1 = _createState("s1", r); {
-					_createExitAssignemnt(v1, s1, "1");
-
-					Region r_s1 = _createRegion("r", s1); {
-						State s3 = _createState("s3", r_s1); {
-							_createExitAssignemnt(v1, s3, "2");
-
-							Region r_s3 = _createRegion("r", s3); {
-								State s4 = _createState("s4", r_s3);
-								_createExitAssignemnt(v1, s4, "3");
-
-								State s5 = _createState("s5", r_s3);
-							}
-						}
-					}
-				}		
-				State s2 = _createState("s2", r); {
-					Region r_s1 = _createRegion("r", s2); {
-						_createState("s6", r_s1);
-					}
-				}
-			}
-		}
-	
-		_createTransition(findState(sc, "s4"), findState(sc, "s5"));
-		
-		ExecutionFlow flow = sequencer.transform(sc);
-		
-		
-		ExecutionState _s1 = flow.getStates().get(0);
-		assertEquals("sc.r.s1", _s1.getName());
-		assertNotNull(_s1.getExitAction());
-
-		ExecutionState _s3 = flow.getStates().get(1);
-		assertEquals("sc.r.s1.r.s3", _s3.getName());
-		assertNotNull(_s3.getExitAction());
-
-		ExecutionState _s4 = flow.getStates().get(2);
-		assertEquals("sc.r.s1.r.s3.r.s4", _s4.getName());
-		assertNotNull(_s4.getExitAction());
-		
-		Reaction _t = _s4.getReactions().get(0);
-		assertTrue(_t.isTransition());
-		
-		Sequence _effect = (Sequence) _t.getEffect();
-		assertEquals(3, _effect.getSteps().size());
-		
-		Call _s4_exitActionCall = (Call) _effect.getSteps().get(0);
-		assertSame( _s4.getExitAction(), _s4_exitActionCall.getStep());	
-		
-	}
-
-
-	protected void _createEntryAssignemnt(VariableDefinition v1, State s1, String value) {
-		LocalReaction entryAction = _createEntryAction(s1);
-		_createVariableAssignment(v1, AssignmentOperator.ASSIGN, _createValue(value), (ReactionEffect) entryAction.getEffect());
-	}
-
 
 }

+ 17 - 0
test-plugins/org.yakindu.sct.model.sexec.test/src/org/yakindu/sct/model/sexec/transformation/test/SCTTestUtil.java

@@ -1,5 +1,10 @@
 package org.yakindu.sct.model.sexec.transformation.test;
 
+import static org.yakindu.sct.model.sexec.transformation.test.SCTTestUtil._createEntryAction;
+import static org.yakindu.sct.model.sexec.transformation.test.SCTTestUtil._createExitAction;
+import static org.yakindu.sct.model.sexec.transformation.test.SCTTestUtil._createValue;
+import static org.yakindu.sct.model.sexec.transformation.test.SCTTestUtil._createVariableAssignment;
+
 import java.util.Collection;
 
 import org.eclipse.emf.ecore.EObject;
@@ -192,6 +197,18 @@ public class SCTTestUtil {
 	}
 	
 	
+	public static void _createExitAssignemnt(VariableDefinition v1, State s1, String value) {
+		LocalReaction exitAction = _createExitAction(s1);
+		_createVariableAssignment(v1, AssignmentOperator.ASSIGN, _createValue(value), (ReactionEffect) exitAction.getEffect());
+	}
+
+
+	public static void _createEntryAssignemnt(VariableDefinition v1, State s1, String value) {
+		LocalReaction entryAction = _createEntryAction(s1);
+		_createVariableAssignment(v1, AssignmentOperator.ASSIGN, _createValue(value), (ReactionEffect) entryAction.getEffect());
+	}
+
+
 
 	
 	public static Assignment _createVariableAssignment(VariableDefinition v, AssignmentOperator op, Expression expression, ReactionEffect e) {