Просмотр исходного кода

Model sequencer now creates enter and exit sequences for all states and includes them in the transition effect.
For the exit sequences new execution flow step type StateSwitch has been introduced.

YAKHMI-270 YAKHMI-271 YAKHMI-272 YAKHMI-275

terfloth@itemis.de 14 лет назад
Родитель
Сommit
8d312c88fe
51 измененных файлов с 2721 добавлено и 3146 удалено
  1. BIN
      plugins/org.yakindu.sct.model.sexec.edit/icons/full/ctool16/CreateExecutionState_entryAction_StateSwitch.gif
  2. BIN
      plugins/org.yakindu.sct.model.sexec.edit/icons/full/ctool16/CreateExecutionState_exitAction_StateSwitch.gif
  3. BIN
      plugins/org.yakindu.sct.model.sexec.edit/icons/full/ctool16/CreateReaction_effect_StateSwitch.gif
  4. BIN
      plugins/org.yakindu.sct.model.sexec.edit/icons/full/ctool16/CreateSequence_steps_StateSwitch.gif
  5. BIN
      plugins/org.yakindu.sct.model.sexec.edit/icons/full/ctool16/CreateStateCase_step_Call.gif
  6. BIN
      plugins/org.yakindu.sct.model.sexec.edit/icons/full/ctool16/CreateStateCase_step_Check.gif
  7. BIN
      plugins/org.yakindu.sct.model.sexec.edit/icons/full/ctool16/CreateStateCase_step_CheckRef.gif
  8. BIN
      plugins/org.yakindu.sct.model.sexec.edit/icons/full/ctool16/CreateStateCase_step_Cycle.gif
  9. BIN
      plugins/org.yakindu.sct.model.sexec.edit/icons/full/ctool16/CreateStateCase_step_EnterState.gif
  10. BIN
      plugins/org.yakindu.sct.model.sexec.edit/icons/full/ctool16/CreateStateCase_step_Execution.gif
  11. BIN
      plugins/org.yakindu.sct.model.sexec.edit/icons/full/ctool16/CreateStateCase_step_ExitState.gif
  12. BIN
      plugins/org.yakindu.sct.model.sexec.edit/icons/full/ctool16/CreateStateCase_step_If.gif
  13. BIN
      plugins/org.yakindu.sct.model.sexec.edit/icons/full/ctool16/CreateStateCase_step_ScheduleTimeEvent.gif
  14. BIN
      plugins/org.yakindu.sct.model.sexec.edit/icons/full/ctool16/CreateStateCase_step_Sequence.gif
  15. BIN
      plugins/org.yakindu.sct.model.sexec.edit/icons/full/ctool16/CreateStateCase_step_StateSwitch.gif
  16. BIN
      plugins/org.yakindu.sct.model.sexec.edit/icons/full/ctool16/CreateStateCase_step_UnscheduleTimeEvent.gif
  17. BIN
      plugins/org.yakindu.sct.model.sexec.edit/icons/full/ctool16/CreateStateSwitch_cases_StateCase.gif
  18. BIN
      plugins/org.yakindu.sct.model.sexec.edit/icons/full/obj16/StateCase.gif
  19. BIN
      plugins/org.yakindu.sct.model.sexec.edit/icons/full/obj16/StateSwitch.gif
  20. 5 0
      plugins/org.yakindu.sct.model.sexec.edit/plugin.properties
  21. 10 0
      plugins/org.yakindu.sct.model.sexec.edit/src/org/yakindu/sct/model/sexec/provider/ExecutionStateItemProvider.java
  22. 5 0
      plugins/org.yakindu.sct.model.sexec.edit/src/org/yakindu/sct/model/sexec/provider/ReactionItemProvider.java
  23. 5 0
      plugins/org.yakindu.sct.model.sexec.edit/src/org/yakindu/sct/model/sexec/provider/SequenceItemProvider.java
  24. 48 0
      plugins/org.yakindu.sct.model.sexec.edit/src/org/yakindu/sct/model/sexec/provider/SexecItemProviderAdapterFactory.java
  25. 250 0
      plugins/org.yakindu.sct.model.sexec.edit/src/org/yakindu/sct/model/sexec/provider/StateCaseItemProvider.java
  26. 160 0
      plugins/org.yakindu.sct.model.sexec.edit/src/org/yakindu/sct/model/sexec/provider/StateSwitchItemProvider.java
  27. 8 0
      plugins/org.yakindu.sct.model.sexec/model/sexec.ecore
  28. 18 0
      plugins/org.yakindu.sct.model.sexec/src/org/yakindu/sct/model/sexec/SexecFactory.java
  29. 181 0
      plugins/org.yakindu.sct.model.sexec/src/org/yakindu/sct/model/sexec/SexecPackage.java
  30. 81 0
      plugins/org.yakindu.sct.model.sexec/src/org/yakindu/sct/model/sexec/StateCase.java
  31. 44 0
      plugins/org.yakindu.sct.model.sexec/src/org/yakindu/sct/model/sexec/StateSwitch.java
  32. 23 0
      plugins/org.yakindu.sct.model.sexec/src/org/yakindu/sct/model/sexec/impl/SexecFactoryImpl.java
  33. 76 0
      plugins/org.yakindu.sct.model.sexec/src/org/yakindu/sct/model/sexec/impl/SexecPackageImpl.java
  34. 240 0
      plugins/org.yakindu.sct.model.sexec/src/org/yakindu/sct/model/sexec/impl/StateCaseImpl.java
  35. 154 0
      plugins/org.yakindu.sct.model.sexec/src/org/yakindu/sct/model/sexec/impl/StateSwitchImpl.java
  36. 83 7
      plugins/org.yakindu.sct.model.sexec/src/org/yakindu/sct/model/sexec/transformation/ModelSequencer.xtend
  37. 37 0
      plugins/org.yakindu.sct.model.sexec/src/org/yakindu/sct/model/sexec/util/SexecAdapterFactory.java
  38. 45 0
      plugins/org.yakindu.sct.model.sexec/src/org/yakindu/sct/model/sexec/util/SexecSwitch.java
  39. 0 291
      plugins/org.yakindu.sct.model.sexec/xtend-gen/org/yakindu/sct/model/sexec/transformation/FactoryExtension.java
  40. 0 1556
      plugins/org.yakindu.sct.model.sexec/xtend-gen/org/yakindu/sct/model/sexec/transformation/ModelSequencer.java
  41. 0 273
      plugins/org.yakindu.sct.model.sexec/xtend-gen/org/yakindu/sct/model/sexec/transformation/StatechartExtensions.java
  42. 7 1
      test-plugins/org.yakindu.sct.model.sexec.test/src/org/yakindu/sct/model/sexec/transformation/test/AllTests.java
  43. 53 2
      test-plugins/org.yakindu.sct.model.sexec.test/src/org/yakindu/sct/model/sexec/transformation/test/Assert.java
  44. 39 87
      test-plugins/org.yakindu.sct.model.sexec.test/src/org/yakindu/sct/model/sexec/transformation/test/ModelSequencerHierarchyTest.java
  45. 59 0
      test-plugins/org.yakindu.sct.model.sexec.test/src/org/yakindu/sct/model/sexec/transformation/test/ModelSequencerSCTest.java
  46. 268 0
      test-plugins/org.yakindu.sct.model.sexec.test/src/org/yakindu/sct/model/sexec/transformation/test/ModelSequencerStateReactionTest.java
  47. 546 35
      test-plugins/org.yakindu.sct.model.sexec.test/src/org/yakindu/sct/model/sexec/transformation/test/ModelSequencerStateTest.java
  48. 159 0
      test-plugins/org.yakindu.sct.model.sexec.test/src/org/yakindu/sct/model/sexec/transformation/test/ModelSequencerStateVectorTest.java
  49. 1 892
      test-plugins/org.yakindu.sct.model.sexec.test/src/org/yakindu/sct/model/sexec/transformation/test/ModelSequencerTest.java
  50. 114 0
      test-plugins/org.yakindu.sct.model.sexec.test/src/org/yakindu/sct/model/sexec/transformation/test/ModelSequencertDeclarationsTest.java
  51. 2 2
      test-plugins/org.yakindu.sct.model.sexec.test/src/org/yakindu/sct/model/sexec/transformation/test/SCTTestUtil.java

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


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


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


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


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


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


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


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


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


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


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


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


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


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


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


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


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


BIN
plugins/org.yakindu.sct.model.sexec.edit/icons/full/obj16/StateCase.gif


BIN
plugins/org.yakindu.sct.model.sexec.edit/icons/full/obj16/StateSwitch.gif


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

@@ -71,3 +71,8 @@ _UI_UnscheduleTimeEvent_timeEvent_feature = Time Event
 _UI_Reaction_transition_feature = Transition
 _UI_ExecutionState_enterSequence_feature = Enter Sequence
 _UI_ExecutionState_exitSequence_feature = Exit Sequence
+_UI_StateSwitch_type = State Switch
+_UI_StateCase_type = State Case
+_UI_StateSwitch_cases_feature = Cases
+_UI_StateCase_step_feature = Step
+_UI_StateCase_state_feature = State

+ 10 - 0
plugins/org.yakindu.sct.model.sexec.edit/src/org/yakindu/sct/model/sexec/provider/ExecutionStateItemProvider.java

@@ -275,6 +275,11 @@ public class ExecutionStateItemProvider
 				(SexecPackage.Literals.EXECUTION_STATE__ENTRY_ACTION,
 				 SexecFactory.eINSTANCE.createUnscheduleTimeEvent()));
 
+		newChildDescriptors.add
+			(createChildParameter
+				(SexecPackage.Literals.EXECUTION_STATE__ENTRY_ACTION,
+				 SexecFactory.eINSTANCE.createStateSwitch()));
+
 		newChildDescriptors.add
 			(createChildParameter
 				(SexecPackage.Literals.EXECUTION_STATE__EXIT_ACTION,
@@ -330,6 +335,11 @@ public class ExecutionStateItemProvider
 				(SexecPackage.Literals.EXECUTION_STATE__EXIT_ACTION,
 				 SexecFactory.eINSTANCE.createUnscheduleTimeEvent()));
 
+		newChildDescriptors.add
+			(createChildParameter
+				(SexecPackage.Literals.EXECUTION_STATE__EXIT_ACTION,
+				 SexecFactory.eINSTANCE.createStateSwitch()));
+
 		newChildDescriptors.add
 			(createChildParameter
 				(SexecPackage.Literals.EXECUTION_STATE__ENTER_SEQUENCE,

+ 5 - 0
plugins/org.yakindu.sct.model.sexec.edit/src/org/yakindu/sct/model/sexec/provider/ReactionItemProvider.java

@@ -242,6 +242,11 @@ public class ReactionItemProvider
 			(createChildParameter
 				(SexecPackage.Literals.REACTION__EFFECT,
 				 SexecFactory.eINSTANCE.createUnscheduleTimeEvent()));
+
+		newChildDescriptors.add
+			(createChildParameter
+				(SexecPackage.Literals.REACTION__EFFECT,
+				 SexecFactory.eINSTANCE.createStateSwitch()));
 	}
 
 	/**

+ 5 - 0
plugins/org.yakindu.sct.model.sexec.edit/src/org/yakindu/sct/model/sexec/provider/SequenceItemProvider.java

@@ -202,6 +202,11 @@ public class SequenceItemProvider
 			(createChildParameter
 				(SexecPackage.Literals.SEQUENCE__STEPS,
 				 SexecFactory.eINSTANCE.createUnscheduleTimeEvent()));
+
+		newChildDescriptors.add
+			(createChildParameter
+				(SexecPackage.Literals.SEQUENCE__STEPS,
+				 SexecFactory.eINSTANCE.createStateSwitch()));
 	}
 
 }

+ 48 - 0
plugins/org.yakindu.sct.model.sexec.edit/src/org/yakindu/sct/model/sexec/provider/SexecItemProviderAdapterFactory.java

@@ -395,6 +395,52 @@ public class SexecItemProviderAdapterFactory extends SexecAdapterFactory impleme
 		return unscheduleTimeEventItemProvider;
 	}
 
+	/**
+	 * This keeps track of the one adapter used for all {@link org.yakindu.sct.model.sexec.StateSwitch} instances.
+	 * <!-- begin-user-doc -->
+	 * <!-- end-user-doc -->
+	 * @generated
+	 */
+	protected StateSwitchItemProvider stateSwitchItemProvider;
+
+	/**
+	 * This creates an adapter for a {@link org.yakindu.sct.model.sexec.StateSwitch}.
+	 * <!-- begin-user-doc -->
+	 * <!-- end-user-doc -->
+	 * @generated
+	 */
+	@Override
+	public Adapter createStateSwitchAdapter() {
+		if (stateSwitchItemProvider == null) {
+			stateSwitchItemProvider = new StateSwitchItemProvider(this);
+		}
+
+		return stateSwitchItemProvider;
+	}
+
+	/**
+	 * This keeps track of the one adapter used for all {@link org.yakindu.sct.model.sexec.StateCase} instances.
+	 * <!-- begin-user-doc -->
+	 * <!-- end-user-doc -->
+	 * @generated
+	 */
+	protected StateCaseItemProvider stateCaseItemProvider;
+
+	/**
+	 * This creates an adapter for a {@link org.yakindu.sct.model.sexec.StateCase}.
+	 * <!-- begin-user-doc -->
+	 * <!-- end-user-doc -->
+	 * @generated
+	 */
+	@Override
+	public Adapter createStateCaseAdapter() {
+		if (stateCaseItemProvider == null) {
+			stateCaseItemProvider = new StateCaseItemProvider(this);
+		}
+
+		return stateCaseItemProvider;
+	}
+
 	/**
 	 * This keeps track of the one adapter used for all {@link org.yakindu.sct.model.sexec.CheckRef} instances.
 	 * <!-- begin-user-doc -->
@@ -580,6 +626,8 @@ public class SexecItemProviderAdapterFactory extends SexecAdapterFactory impleme
 		if (callItemProvider != null) callItemProvider.dispose();
 		if (scheduleTimeEventItemProvider != null) scheduleTimeEventItemProvider.dispose();
 		if (unscheduleTimeEventItemProvider != null) unscheduleTimeEventItemProvider.dispose();
+		if (stateSwitchItemProvider != null) stateSwitchItemProvider.dispose();
+		if (stateCaseItemProvider != null) stateCaseItemProvider.dispose();
 	}
 
 }

+ 250 - 0
plugins/org.yakindu.sct.model.sexec.edit/src/org/yakindu/sct/model/sexec/provider/StateCaseItemProvider.java

@@ -0,0 +1,250 @@
+/**
+ * <copyright>
+ * </copyright>
+ *
+ * $Id$
+ */
+package org.yakindu.sct.model.sexec.provider;
+
+
+import java.util.Collection;
+import java.util.List;
+
+import org.eclipse.emf.common.notify.AdapterFactory;
+import org.eclipse.emf.common.notify.Notification;
+
+import org.eclipse.emf.common.util.ResourceLocator;
+
+import org.eclipse.emf.ecore.EStructuralFeature;
+
+import org.eclipse.emf.edit.provider.ComposeableAdapterFactory;
+import org.eclipse.emf.edit.provider.IEditingDomainItemProvider;
+import org.eclipse.emf.edit.provider.IItemLabelProvider;
+import org.eclipse.emf.edit.provider.IItemPropertyDescriptor;
+import org.eclipse.emf.edit.provider.IItemPropertySource;
+import org.eclipse.emf.edit.provider.IStructuredItemContentProvider;
+import org.eclipse.emf.edit.provider.ITreeItemContentProvider;
+import org.eclipse.emf.edit.provider.ItemProviderAdapter;
+import org.eclipse.emf.edit.provider.ViewerNotification;
+
+import org.yakindu.sct.model.sexec.SexecFactory;
+import org.yakindu.sct.model.sexec.SexecPackage;
+import org.yakindu.sct.model.sexec.StateCase;
+
+/**
+ * This is the item provider adapter for a {@link org.yakindu.sct.model.sexec.StateCase} object.
+ * <!-- begin-user-doc -->
+ * <!-- end-user-doc -->
+ * @generated
+ */
+public class StateCaseItemProvider
+	extends ItemProviderAdapter
+	implements
+		IEditingDomainItemProvider,
+		IStructuredItemContentProvider,
+		ITreeItemContentProvider,
+		IItemLabelProvider,
+		IItemPropertySource {
+	/**
+	 * This constructs an instance from a factory and a notifier.
+	 * <!-- begin-user-doc -->
+	 * <!-- end-user-doc -->
+	 * @generated
+	 */
+	public StateCaseItemProvider(AdapterFactory adapterFactory) {
+		super(adapterFactory);
+	}
+
+	/**
+	 * This returns the property descriptors for the adapted class.
+	 * <!-- begin-user-doc -->
+	 * <!-- end-user-doc -->
+	 * @generated
+	 */
+	@Override
+	public List<IItemPropertyDescriptor> getPropertyDescriptors(Object object) {
+		if (itemPropertyDescriptors == null) {
+			super.getPropertyDescriptors(object);
+
+			addStatePropertyDescriptor(object);
+		}
+		return itemPropertyDescriptors;
+	}
+
+	/**
+	 * This adds a property descriptor for the State feature.
+	 * <!-- begin-user-doc -->
+	 * <!-- end-user-doc -->
+	 * @generated
+	 */
+	protected void addStatePropertyDescriptor(Object object) {
+		itemPropertyDescriptors.add
+			(createItemPropertyDescriptor
+				(((ComposeableAdapterFactory)adapterFactory).getRootAdapterFactory(),
+				 getResourceLocator(),
+				 getString("_UI_StateCase_state_feature"),
+				 getString("_UI_PropertyDescriptor_description", "_UI_StateCase_state_feature", "_UI_StateCase_type"),
+				 SexecPackage.Literals.STATE_CASE__STATE,
+				 true,
+				 false,
+				 true,
+				 null,
+				 null,
+				 null));
+	}
+
+	/**
+	 * This specifies how to implement {@link #getChildren} and is used to deduce an appropriate feature for an
+	 * {@link org.eclipse.emf.edit.command.AddCommand}, {@link org.eclipse.emf.edit.command.RemoveCommand} or
+	 * {@link org.eclipse.emf.edit.command.MoveCommand} in {@link #createCommand}.
+	 * <!-- begin-user-doc -->
+	 * <!-- end-user-doc -->
+	 * @generated
+	 */
+	@Override
+	public Collection<? extends EStructuralFeature> getChildrenFeatures(Object object) {
+		if (childrenFeatures == null) {
+			super.getChildrenFeatures(object);
+			childrenFeatures.add(SexecPackage.Literals.STATE_CASE__STEP);
+		}
+		return childrenFeatures;
+	}
+
+	/**
+	 * <!-- begin-user-doc -->
+	 * <!-- end-user-doc -->
+	 * @generated
+	 */
+	@Override
+	protected EStructuralFeature getChildFeature(Object object, Object child) {
+		// Check the type of the specified child object and return the proper feature to use for
+		// adding (see {@link AddCommand}) it as a child.
+
+		return super.getChildFeature(object, child);
+	}
+
+	/**
+	 * This returns StateCase.gif.
+	 * <!-- begin-user-doc -->
+	 * <!-- end-user-doc -->
+	 * @generated
+	 */
+	@Override
+	public Object getImage(Object object) {
+		return overlayImage(object, getResourceLocator().getImage("full/obj16/StateCase"));
+	}
+
+	/**
+	 * This returns the label text for the adapted class.
+	 * <!-- begin-user-doc -->
+	 * <!-- end-user-doc -->
+	 * @generated
+	 */
+	@Override
+	public String getText(Object object) {
+		return getString("_UI_StateCase_type");
+	}
+
+	/**
+	 * This handles model notifications by calling {@link #updateChildren} to update any cached
+	 * children and by creating a viewer notification, which it passes to {@link #fireNotifyChanged}.
+	 * <!-- begin-user-doc -->
+	 * <!-- end-user-doc -->
+	 * @generated
+	 */
+	@Override
+	public void notifyChanged(Notification notification) {
+		updateChildren(notification);
+
+		switch (notification.getFeatureID(StateCase.class)) {
+			case SexecPackage.STATE_CASE__STEP:
+				fireNotifyChanged(new ViewerNotification(notification, notification.getNotifier(), true, false));
+				return;
+		}
+		super.notifyChanged(notification);
+	}
+
+	/**
+	 * This adds {@link org.eclipse.emf.edit.command.CommandParameter}s describing the children
+	 * that can be created under this object.
+	 * <!-- begin-user-doc -->
+	 * <!-- end-user-doc -->
+	 * @generated
+	 */
+	@Override
+	protected void collectNewChildDescriptors(Collection<Object> newChildDescriptors, Object object) {
+		super.collectNewChildDescriptors(newChildDescriptors, object);
+
+		newChildDescriptors.add
+			(createChildParameter
+				(SexecPackage.Literals.STATE_CASE__STEP,
+				 SexecFactory.eINSTANCE.createSequence()));
+
+		newChildDescriptors.add
+			(createChildParameter
+				(SexecPackage.Literals.STATE_CASE__STEP,
+				 SexecFactory.eINSTANCE.createCycle()));
+
+		newChildDescriptors.add
+			(createChildParameter
+				(SexecPackage.Literals.STATE_CASE__STEP,
+				 SexecFactory.eINSTANCE.createCheck()));
+
+		newChildDescriptors.add
+			(createChildParameter
+				(SexecPackage.Literals.STATE_CASE__STEP,
+				 SexecFactory.eINSTANCE.createCheckRef()));
+
+		newChildDescriptors.add
+			(createChildParameter
+				(SexecPackage.Literals.STATE_CASE__STEP,
+				 SexecFactory.eINSTANCE.createIf()));
+
+		newChildDescriptors.add
+			(createChildParameter
+				(SexecPackage.Literals.STATE_CASE__STEP,
+				 SexecFactory.eINSTANCE.createExecution()));
+
+		newChildDescriptors.add
+			(createChildParameter
+				(SexecPackage.Literals.STATE_CASE__STEP,
+				 SexecFactory.eINSTANCE.createEnterState()));
+
+		newChildDescriptors.add
+			(createChildParameter
+				(SexecPackage.Literals.STATE_CASE__STEP,
+				 SexecFactory.eINSTANCE.createExitState()));
+
+		newChildDescriptors.add
+			(createChildParameter
+				(SexecPackage.Literals.STATE_CASE__STEP,
+				 SexecFactory.eINSTANCE.createCall()));
+
+		newChildDescriptors.add
+			(createChildParameter
+				(SexecPackage.Literals.STATE_CASE__STEP,
+				 SexecFactory.eINSTANCE.createScheduleTimeEvent()));
+
+		newChildDescriptors.add
+			(createChildParameter
+				(SexecPackage.Literals.STATE_CASE__STEP,
+				 SexecFactory.eINSTANCE.createUnscheduleTimeEvent()));
+
+		newChildDescriptors.add
+			(createChildParameter
+				(SexecPackage.Literals.STATE_CASE__STEP,
+				 SexecFactory.eINSTANCE.createStateSwitch()));
+	}
+
+	/**
+	 * Return the resource locator for this item provider's resources.
+	 * <!-- begin-user-doc -->
+	 * <!-- end-user-doc -->
+	 * @generated
+	 */
+	@Override
+	public ResourceLocator getResourceLocator() {
+		return SexecEditPlugin.INSTANCE;
+	}
+
+}

+ 160 - 0
plugins/org.yakindu.sct.model.sexec.edit/src/org/yakindu/sct/model/sexec/provider/StateSwitchItemProvider.java

@@ -0,0 +1,160 @@
+/**
+ * <copyright>
+ * </copyright>
+ *
+ * $Id$
+ */
+package org.yakindu.sct.model.sexec.provider;
+
+
+import java.util.Collection;
+import java.util.List;
+
+import org.eclipse.emf.common.notify.AdapterFactory;
+import org.eclipse.emf.common.notify.Notification;
+
+import org.eclipse.emf.ecore.EStructuralFeature;
+
+import org.eclipse.emf.edit.provider.IEditingDomainItemProvider;
+import org.eclipse.emf.edit.provider.IItemLabelProvider;
+import org.eclipse.emf.edit.provider.IItemPropertyDescriptor;
+import org.eclipse.emf.edit.provider.IItemPropertySource;
+import org.eclipse.emf.edit.provider.IStructuredItemContentProvider;
+import org.eclipse.emf.edit.provider.ITreeItemContentProvider;
+import org.eclipse.emf.edit.provider.ViewerNotification;
+
+import org.yakindu.sct.model.sexec.SexecFactory;
+import org.yakindu.sct.model.sexec.SexecPackage;
+import org.yakindu.sct.model.sexec.StateSwitch;
+
+/**
+ * This is the item provider adapter for a {@link org.yakindu.sct.model.sexec.StateSwitch} object.
+ * <!-- begin-user-doc -->
+ * <!-- end-user-doc -->
+ * @generated
+ */
+public class StateSwitchItemProvider
+	extends StepItemProvider
+	implements
+		IEditingDomainItemProvider,
+		IStructuredItemContentProvider,
+		ITreeItemContentProvider,
+		IItemLabelProvider,
+		IItemPropertySource {
+	/**
+	 * This constructs an instance from a factory and a notifier.
+	 * <!-- begin-user-doc -->
+	 * <!-- end-user-doc -->
+	 * @generated
+	 */
+	public StateSwitchItemProvider(AdapterFactory adapterFactory) {
+		super(adapterFactory);
+	}
+
+	/**
+	 * This returns the property descriptors for the adapted class.
+	 * <!-- begin-user-doc -->
+	 * <!-- end-user-doc -->
+	 * @generated
+	 */
+	@Override
+	public List<IItemPropertyDescriptor> getPropertyDescriptors(Object object) {
+		if (itemPropertyDescriptors == null) {
+			super.getPropertyDescriptors(object);
+
+		}
+		return itemPropertyDescriptors;
+	}
+
+	/**
+	 * This specifies how to implement {@link #getChildren} and is used to deduce an appropriate feature for an
+	 * {@link org.eclipse.emf.edit.command.AddCommand}, {@link org.eclipse.emf.edit.command.RemoveCommand} or
+	 * {@link org.eclipse.emf.edit.command.MoveCommand} in {@link #createCommand}.
+	 * <!-- begin-user-doc -->
+	 * <!-- end-user-doc -->
+	 * @generated
+	 */
+	@Override
+	public Collection<? extends EStructuralFeature> getChildrenFeatures(Object object) {
+		if (childrenFeatures == null) {
+			super.getChildrenFeatures(object);
+			childrenFeatures.add(SexecPackage.Literals.STATE_SWITCH__CASES);
+		}
+		return childrenFeatures;
+	}
+
+	/**
+	 * <!-- begin-user-doc -->
+	 * <!-- end-user-doc -->
+	 * @generated
+	 */
+	@Override
+	protected EStructuralFeature getChildFeature(Object object, Object child) {
+		// Check the type of the specified child object and return the proper feature to use for
+		// adding (see {@link AddCommand}) it as a child.
+
+		return super.getChildFeature(object, child);
+	}
+
+	/**
+	 * This returns StateSwitch.gif.
+	 * <!-- begin-user-doc -->
+	 * <!-- end-user-doc -->
+	 * @generated
+	 */
+	@Override
+	public Object getImage(Object object) {
+		return overlayImage(object, getResourceLocator().getImage("full/obj16/StateSwitch"));
+	}
+
+	/**
+	 * This returns the label text for the adapted class.
+	 * <!-- begin-user-doc -->
+	 * <!-- end-user-doc -->
+	 * @generated
+	 */
+	@Override
+	public String getText(Object object) {
+		String label = ((StateSwitch)object).getName();
+		return label == null || label.length() == 0 ?
+			getString("_UI_StateSwitch_type") :
+			getString("_UI_StateSwitch_type") + " " + label;
+	}
+
+	/**
+	 * This handles model notifications by calling {@link #updateChildren} to update any cached
+	 * children and by creating a viewer notification, which it passes to {@link #fireNotifyChanged}.
+	 * <!-- begin-user-doc -->
+	 * <!-- end-user-doc -->
+	 * @generated
+	 */
+	@Override
+	public void notifyChanged(Notification notification) {
+		updateChildren(notification);
+
+		switch (notification.getFeatureID(StateSwitch.class)) {
+			case SexecPackage.STATE_SWITCH__CASES:
+				fireNotifyChanged(new ViewerNotification(notification, notification.getNotifier(), true, false));
+				return;
+		}
+		super.notifyChanged(notification);
+	}
+
+	/**
+	 * This adds {@link org.eclipse.emf.edit.command.CommandParameter}s describing the children
+	 * that can be created under this object.
+	 * <!-- begin-user-doc -->
+	 * <!-- end-user-doc -->
+	 * @generated
+	 */
+	@Override
+	protected void collectNewChildDescriptors(Collection<Object> newChildDescriptors, Object object) {
+		super.collectNewChildDescriptors(newChildDescriptors, object);
+
+		newChildDescriptors.add
+			(createChildParameter
+				(SexecPackage.Literals.STATE_SWITCH__CASES,
+				 SexecFactory.eINSTANCE.createStateCase()));
+	}
+
+}

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

@@ -94,4 +94,12 @@
   <eClassifiers xsi:type="ecore:EClass" name="UnscheduleTimeEvent" eSuperTypes="#//Step">
     <eStructuralFeatures xsi:type="ecore:EReference" name="timeEvent" eType="#//TimeEvent"/>
   </eClassifiers>
+  <eClassifiers xsi:type="ecore:EClass" name="StateSwitch" eSuperTypes="#//Step">
+    <eStructuralFeatures xsi:type="ecore:EReference" name="cases" upperBound="-1"
+        eType="#//StateCase" containment="true"/>
+  </eClassifiers>
+  <eClassifiers xsi:type="ecore:EClass" name="StateCase">
+    <eStructuralFeatures xsi:type="ecore:EReference" name="state" eType="#//ExecutionState"/>
+    <eStructuralFeatures xsi:type="ecore:EReference" name="step" eType="#//Step" containment="true"/>
+  </eClassifiers>
 </ecore:EPackage>

+ 18 - 0
plugins/org.yakindu.sct.model.sexec/src/org/yakindu/sct/model/sexec/SexecFactory.java

@@ -151,6 +151,24 @@ public interface SexecFactory extends EFactory {
 	 */
 	UnscheduleTimeEvent createUnscheduleTimeEvent();
 
+	/**
+	 * Returns a new object of class '<em>State Switch</em>'.
+	 * <!-- begin-user-doc -->
+	 * <!-- end-user-doc -->
+	 * @return a new object of class '<em>State Switch</em>'.
+	 * @generated
+	 */
+	StateSwitch createStateSwitch();
+
+	/**
+	 * Returns a new object of class '<em>State Case</em>'.
+	 * <!-- begin-user-doc -->
+	 * <!-- end-user-doc -->
+	 * @return a new object of class '<em>State Case</em>'.
+	 * @generated
+	 */
+	StateCase createStateCase();
+
 	/**
 	 * Returns a new object of class '<em>Check Ref</em>'.
 	 * <!-- begin-user-doc -->

+ 181 - 0
plugins/org.yakindu.sct.model.sexec/src/org/yakindu/sct/model/sexec/SexecPackage.java

@@ -979,6 +979,90 @@ public interface SexecPackage extends EPackage {
 	int UNSCHEDULE_TIME_EVENT_FEATURE_COUNT = STEP_FEATURE_COUNT + 1;
 
 
+	/**
+	 * The meta object id for the '{@link org.yakindu.sct.model.sexec.impl.StateSwitchImpl <em>State Switch</em>}' class.
+	 * <!-- begin-user-doc -->
+	 * <!-- end-user-doc -->
+	 * @see org.yakindu.sct.model.sexec.impl.StateSwitchImpl
+	 * @see org.yakindu.sct.model.sexec.impl.SexecPackageImpl#getStateSwitch()
+	 * @generated
+	 */
+	int STATE_SWITCH = 18;
+
+	/**
+	 * The feature id for the '<em><b>Name</b></em>' attribute.
+	 * <!-- begin-user-doc -->
+	 * <!-- end-user-doc -->
+	 * @generated
+	 * @ordered
+	 */
+	int STATE_SWITCH__NAME = STEP__NAME;
+
+	/**
+	 * The feature id for the '<em><b>Comment</b></em>' attribute.
+	 * <!-- begin-user-doc -->
+	 * <!-- end-user-doc -->
+	 * @generated
+	 * @ordered
+	 */
+	int STATE_SWITCH__COMMENT = STEP__COMMENT;
+
+	/**
+	 * The feature id for the '<em><b>Cases</b></em>' containment reference list.
+	 * <!-- begin-user-doc -->
+	 * <!-- end-user-doc -->
+	 * @generated
+	 * @ordered
+	 */
+	int STATE_SWITCH__CASES = STEP_FEATURE_COUNT + 0;
+
+	/**
+	 * The number of structural features of the '<em>State Switch</em>' class.
+	 * <!-- begin-user-doc -->
+	 * <!-- end-user-doc -->
+	 * @generated
+	 * @ordered
+	 */
+	int STATE_SWITCH_FEATURE_COUNT = STEP_FEATURE_COUNT + 1;
+
+	/**
+	 * The meta object id for the '{@link org.yakindu.sct.model.sexec.impl.StateCaseImpl <em>State Case</em>}' class.
+	 * <!-- begin-user-doc -->
+	 * <!-- end-user-doc -->
+	 * @see org.yakindu.sct.model.sexec.impl.StateCaseImpl
+	 * @see org.yakindu.sct.model.sexec.impl.SexecPackageImpl#getStateCase()
+	 * @generated
+	 */
+	int STATE_CASE = 19;
+
+	/**
+	 * The feature id for the '<em><b>State</b></em>' reference.
+	 * <!-- begin-user-doc -->
+	 * <!-- end-user-doc -->
+	 * @generated
+	 * @ordered
+	 */
+	int STATE_CASE__STATE = 0;
+
+	/**
+	 * The feature id for the '<em><b>Step</b></em>' containment reference.
+	 * <!-- begin-user-doc -->
+	 * <!-- end-user-doc -->
+	 * @generated
+	 * @ordered
+	 */
+	int STATE_CASE__STEP = 1;
+
+	/**
+	 * The number of structural features of the '<em>State Case</em>' class.
+	 * <!-- begin-user-doc -->
+	 * <!-- end-user-doc -->
+	 * @generated
+	 * @ordered
+	 */
+	int STATE_CASE_FEATURE_COUNT = 2;
+
+
 	/**
 	 * Returns the meta object for class '{@link org.yakindu.sct.model.sexec.ExecutionFlow <em>Execution Flow</em>}'.
 	 * <!-- begin-user-doc -->
@@ -1448,6 +1532,59 @@ public interface SexecPackage extends EPackage {
 	 */
 	EReference getUnscheduleTimeEvent_TimeEvent();
 
+	/**
+	 * Returns the meta object for class '{@link org.yakindu.sct.model.sexec.StateSwitch <em>State Switch</em>}'.
+	 * <!-- begin-user-doc -->
+	 * <!-- end-user-doc -->
+	 * @return the meta object for class '<em>State Switch</em>'.
+	 * @see org.yakindu.sct.model.sexec.StateSwitch
+	 * @generated
+	 */
+	EClass getStateSwitch();
+
+	/**
+	 * Returns the meta object for the containment reference list '{@link org.yakindu.sct.model.sexec.StateSwitch#getCases <em>Cases</em>}'.
+	 * <!-- begin-user-doc -->
+	 * <!-- end-user-doc -->
+	 * @return the meta object for the containment reference list '<em>Cases</em>'.
+	 * @see org.yakindu.sct.model.sexec.StateSwitch#getCases()
+	 * @see #getStateSwitch()
+	 * @generated
+	 */
+	EReference getStateSwitch_Cases();
+
+	/**
+	 * Returns the meta object for class '{@link org.yakindu.sct.model.sexec.StateCase <em>State Case</em>}'.
+	 * <!-- begin-user-doc -->
+	 * <!-- end-user-doc -->
+	 * @return the meta object for class '<em>State Case</em>'.
+	 * @see org.yakindu.sct.model.sexec.StateCase
+	 * @generated
+	 */
+	EClass getStateCase();
+
+	/**
+	 * Returns the meta object for the reference '{@link org.yakindu.sct.model.sexec.StateCase#getState <em>State</em>}'.
+	 * <!-- begin-user-doc -->
+	 * <!-- end-user-doc -->
+	 * @return the meta object for the reference '<em>State</em>'.
+	 * @see org.yakindu.sct.model.sexec.StateCase#getState()
+	 * @see #getStateCase()
+	 * @generated
+	 */
+	EReference getStateCase_State();
+
+	/**
+	 * Returns the meta object for the containment reference '{@link org.yakindu.sct.model.sexec.StateCase#getStep <em>Step</em>}'.
+	 * <!-- begin-user-doc -->
+	 * <!-- end-user-doc -->
+	 * @return the meta object for the containment reference '<em>Step</em>'.
+	 * @see org.yakindu.sct.model.sexec.StateCase#getStep()
+	 * @see #getStateCase()
+	 * @generated
+	 */
+	EReference getStateCase_Step();
+
 	/**
 	 * Returns the meta object for class '{@link org.yakindu.sct.model.sexec.CheckRef <em>Check Ref</em>}'.
 	 * <!-- begin-user-doc -->
@@ -1926,6 +2063,50 @@ public interface SexecPackage extends EPackage {
 		 */
 		EReference UNSCHEDULE_TIME_EVENT__TIME_EVENT = eINSTANCE.getUnscheduleTimeEvent_TimeEvent();
 
+		/**
+		 * The meta object literal for the '{@link org.yakindu.sct.model.sexec.impl.StateSwitchImpl <em>State Switch</em>}' class.
+		 * <!-- begin-user-doc -->
+		 * <!-- end-user-doc -->
+		 * @see org.yakindu.sct.model.sexec.impl.StateSwitchImpl
+		 * @see org.yakindu.sct.model.sexec.impl.SexecPackageImpl#getStateSwitch()
+		 * @generated
+		 */
+		EClass STATE_SWITCH = eINSTANCE.getStateSwitch();
+
+		/**
+		 * The meta object literal for the '<em><b>Cases</b></em>' containment reference list feature.
+		 * <!-- begin-user-doc -->
+		 * <!-- end-user-doc -->
+		 * @generated
+		 */
+		EReference STATE_SWITCH__CASES = eINSTANCE.getStateSwitch_Cases();
+
+		/**
+		 * The meta object literal for the '{@link org.yakindu.sct.model.sexec.impl.StateCaseImpl <em>State Case</em>}' class.
+		 * <!-- begin-user-doc -->
+		 * <!-- end-user-doc -->
+		 * @see org.yakindu.sct.model.sexec.impl.StateCaseImpl
+		 * @see org.yakindu.sct.model.sexec.impl.SexecPackageImpl#getStateCase()
+		 * @generated
+		 */
+		EClass STATE_CASE = eINSTANCE.getStateCase();
+
+		/**
+		 * The meta object literal for the '<em><b>State</b></em>' reference feature.
+		 * <!-- begin-user-doc -->
+		 * <!-- end-user-doc -->
+		 * @generated
+		 */
+		EReference STATE_CASE__STATE = eINSTANCE.getStateCase_State();
+
+		/**
+		 * The meta object literal for the '<em><b>Step</b></em>' containment reference feature.
+		 * <!-- begin-user-doc -->
+		 * <!-- end-user-doc -->
+		 * @generated
+		 */
+		EReference STATE_CASE__STEP = eINSTANCE.getStateCase_Step();
+
 		/**
 		 * The meta object literal for the '{@link org.yakindu.sct.model.sexec.impl.CheckRefImpl <em>Check Ref</em>}' class.
 		 * <!-- begin-user-doc -->

+ 81 - 0
plugins/org.yakindu.sct.model.sexec/src/org/yakindu/sct/model/sexec/StateCase.java

@@ -0,0 +1,81 @@
+/**
+ * <copyright>
+ * </copyright>
+ *
+ * $Id$
+ */
+package org.yakindu.sct.model.sexec;
+
+import org.eclipse.emf.ecore.EObject;
+
+/**
+ * <!-- begin-user-doc -->
+ * A representation of the model object '<em><b>State Case</b></em>'.
+ * <!-- end-user-doc -->
+ *
+ * <p>
+ * The following features are supported:
+ * <ul>
+ *   <li>{@link org.yakindu.sct.model.sexec.StateCase#getState <em>State</em>}</li>
+ *   <li>{@link org.yakindu.sct.model.sexec.StateCase#getStep <em>Step</em>}</li>
+ * </ul>
+ * </p>
+ *
+ * @see org.yakindu.sct.model.sexec.SexecPackage#getStateCase()
+ * @model
+ * @generated
+ */
+public interface StateCase extends EObject {
+	/**
+	 * Returns the value of the '<em><b>State</b></em>' reference.
+	 * <!-- begin-user-doc -->
+	 * <p>
+	 * If the meaning of the '<em>State</em>' reference isn't clear,
+	 * there really should be more of a description here...
+	 * </p>
+	 * <!-- end-user-doc -->
+	 * @return the value of the '<em>State</em>' reference.
+	 * @see #setState(ExecutionState)
+	 * @see org.yakindu.sct.model.sexec.SexecPackage#getStateCase_State()
+	 * @model
+	 * @generated
+	 */
+	ExecutionState getState();
+
+	/**
+	 * Sets the value of the '{@link org.yakindu.sct.model.sexec.StateCase#getState <em>State</em>}' reference.
+	 * <!-- begin-user-doc -->
+	 * <!-- end-user-doc -->
+	 * @param value the new value of the '<em>State</em>' reference.
+	 * @see #getState()
+	 * @generated
+	 */
+	void setState(ExecutionState value);
+
+	/**
+	 * Returns the value of the '<em><b>Step</b></em>' containment reference.
+	 * <!-- begin-user-doc -->
+	 * <p>
+	 * If the meaning of the '<em>Step</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>Step</em>' containment reference.
+	 * @see #setStep(Step)
+	 * @see org.yakindu.sct.model.sexec.SexecPackage#getStateCase_Step()
+	 * @model containment="true"
+	 * @generated
+	 */
+	Step getStep();
+
+	/**
+	 * Sets the value of the '{@link org.yakindu.sct.model.sexec.StateCase#getStep <em>Step</em>}' containment reference.
+	 * <!-- begin-user-doc -->
+	 * <!-- end-user-doc -->
+	 * @param value the new value of the '<em>Step</em>' containment reference.
+	 * @see #getStep()
+	 * @generated
+	 */
+	void setStep(Step value);
+
+} // StateCase

+ 44 - 0
plugins/org.yakindu.sct.model.sexec/src/org/yakindu/sct/model/sexec/StateSwitch.java

@@ -0,0 +1,44 @@
+/**
+ * <copyright>
+ * </copyright>
+ *
+ * $Id$
+ */
+package org.yakindu.sct.model.sexec;
+
+import org.eclipse.emf.common.util.EList;
+
+/**
+ * <!-- begin-user-doc -->
+ * A representation of the model object '<em><b>State Switch</b></em>'.
+ * <!-- end-user-doc -->
+ *
+ * <p>
+ * The following features are supported:
+ * <ul>
+ *   <li>{@link org.yakindu.sct.model.sexec.StateSwitch#getCases <em>Cases</em>}</li>
+ * </ul>
+ * </p>
+ *
+ * @see org.yakindu.sct.model.sexec.SexecPackage#getStateSwitch()
+ * @model
+ * @generated
+ */
+public interface StateSwitch extends Step {
+	/**
+	 * Returns the value of the '<em><b>Cases</b></em>' containment reference list.
+	 * The list contents are of type {@link org.yakindu.sct.model.sexec.StateCase}.
+	 * <!-- begin-user-doc -->
+	 * <p>
+	 * If the meaning of the '<em>Cases</em>' containment reference list isn't clear,
+	 * there really should be more of a description here...
+	 * </p>
+	 * <!-- end-user-doc -->
+	 * @return the value of the '<em>Cases</em>' containment reference list.
+	 * @see org.yakindu.sct.model.sexec.SexecPackage#getStateSwitch_Cases()
+	 * @model containment="true"
+	 * @generated
+	 */
+	EList<StateCase> getCases();
+
+} // StateSwitch

+ 23 - 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;
@@ -92,6 +93,8 @@ public class SexecFactoryImpl extends EFactoryImpl implements SexecFactory {
 			case SexecPackage.CALL: return createCall();
 			case SexecPackage.SCHEDULE_TIME_EVENT: return createScheduleTimeEvent();
 			case SexecPackage.UNSCHEDULE_TIME_EVENT: return createUnscheduleTimeEvent();
+			case SexecPackage.STATE_SWITCH: return createStateSwitch();
+			case SexecPackage.STATE_CASE: return createStateCase();
 			default:
 				throw new IllegalArgumentException("The class '" + eClass.getName() + "' is not a valid classifier");
 		}
@@ -237,6 +240,26 @@ public class SexecFactoryImpl extends EFactoryImpl implements SexecFactory {
 		return unscheduleTimeEvent;
 	}
 
+	/**
+	 * <!-- begin-user-doc -->
+	 * <!-- end-user-doc -->
+	 * @generated
+	 */
+	public StateSwitch createStateSwitch() {
+		StateSwitchImpl stateSwitch = new StateSwitchImpl();
+		return stateSwitch;
+	}
+
+	/**
+	 * <!-- begin-user-doc -->
+	 * <!-- end-user-doc -->
+	 * @generated
+	 */
+	public StateCase createStateCase() {
+		StateCaseImpl stateCase = new StateCaseImpl();
+		return stateCase;
+	}
+
 	/**
 	 * <!-- begin-user-doc -->
 	 * <!-- end-user-doc -->

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

@@ -27,6 +27,8 @@ import org.yakindu.sct.model.sexec.ScheduleTimeEvent;
 import org.yakindu.sct.model.sexec.Sequence;
 import org.yakindu.sct.model.sexec.SexecFactory;
 import org.yakindu.sct.model.sexec.SexecPackage;
+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.TimeEvent;
@@ -145,6 +147,20 @@ public class SexecPackageImpl extends EPackageImpl implements SexecPackage {
 	 */
 	private EClass unscheduleTimeEventEClass = null;
 
+	/**
+	 * <!-- begin-user-doc -->
+	 * <!-- end-user-doc -->
+	 * @generated
+	 */
+	private EClass stateSwitchEClass = null;
+
+	/**
+	 * <!-- begin-user-doc -->
+	 * <!-- end-user-doc -->
+	 * @generated
+	 */
+	private EClass stateCaseEClass = null;
+
 	/**
 	 * <!-- begin-user-doc -->
 	 * <!-- end-user-doc -->
@@ -626,6 +642,51 @@ public class SexecPackageImpl extends EPackageImpl implements SexecPackage {
 		return (EReference)unscheduleTimeEventEClass.getEStructuralFeatures().get(0);
 	}
 
+	/**
+	 * <!-- begin-user-doc -->
+	 * <!-- end-user-doc -->
+	 * @generated
+	 */
+	public EClass getStateSwitch() {
+		return stateSwitchEClass;
+	}
+
+	/**
+	 * <!-- begin-user-doc -->
+	 * <!-- end-user-doc -->
+	 * @generated
+	 */
+	public EReference getStateSwitch_Cases() {
+		return (EReference)stateSwitchEClass.getEStructuralFeatures().get(0);
+	}
+
+	/**
+	 * <!-- begin-user-doc -->
+	 * <!-- end-user-doc -->
+	 * @generated
+	 */
+	public EClass getStateCase() {
+		return stateCaseEClass;
+	}
+
+	/**
+	 * <!-- begin-user-doc -->
+	 * <!-- end-user-doc -->
+	 * @generated
+	 */
+	public EReference getStateCase_State() {
+		return (EReference)stateCaseEClass.getEStructuralFeatures().get(0);
+	}
+
+	/**
+	 * <!-- begin-user-doc -->
+	 * <!-- end-user-doc -->
+	 * @generated
+	 */
+	public EReference getStateCase_Step() {
+		return (EReference)stateCaseEClass.getEStructuralFeatures().get(1);
+	}
+
 	/**
 	 * <!-- begin-user-doc -->
 	 * <!-- end-user-doc -->
@@ -785,6 +846,13 @@ public class SexecPackageImpl extends EPackageImpl implements SexecPackage {
 
 		unscheduleTimeEventEClass = createEClass(UNSCHEDULE_TIME_EVENT);
 		createEReference(unscheduleTimeEventEClass, UNSCHEDULE_TIME_EVENT__TIME_EVENT);
+
+		stateSwitchEClass = createEClass(STATE_SWITCH);
+		createEReference(stateSwitchEClass, STATE_SWITCH__CASES);
+
+		stateCaseEClass = createEClass(STATE_CASE);
+		createEReference(stateCaseEClass, STATE_CASE__STATE);
+		createEReference(stateCaseEClass, STATE_CASE__STEP);
 	}
 
 	/**
@@ -835,6 +903,7 @@ public class SexecPackageImpl extends EPackageImpl implements SexecPackage {
 		callEClass.getESuperTypes().add(this.getStep());
 		scheduleTimeEventEClass.getESuperTypes().add(this.getStep());
 		unscheduleTimeEventEClass.getESuperTypes().add(this.getStep());
+		stateSwitchEClass.getESuperTypes().add(this.getStep());
 
 		// Initialize classes and features; add operations and parameters
 		initEClass(executionFlowEClass, ExecutionFlow.class, "ExecutionFlow", !IS_ABSTRACT, !IS_INTERFACE, IS_GENERATED_INSTANCE_CLASS);
@@ -906,6 +975,13 @@ public class SexecPackageImpl extends EPackageImpl implements SexecPackage {
 		initEClass(unscheduleTimeEventEClass, UnscheduleTimeEvent.class, "UnscheduleTimeEvent", !IS_ABSTRACT, !IS_INTERFACE, IS_GENERATED_INSTANCE_CLASS);
 		initEReference(getUnscheduleTimeEvent_TimeEvent(), this.getTimeEvent(), null, "timeEvent", null, 0, 1, UnscheduleTimeEvent.class, !IS_TRANSIENT, !IS_VOLATILE, IS_CHANGEABLE, !IS_COMPOSITE, IS_RESOLVE_PROXIES, !IS_UNSETTABLE, IS_UNIQUE, !IS_DERIVED, IS_ORDERED);
 
+		initEClass(stateSwitchEClass, StateSwitch.class, "StateSwitch", !IS_ABSTRACT, !IS_INTERFACE, IS_GENERATED_INSTANCE_CLASS);
+		initEReference(getStateSwitch_Cases(), this.getStateCase(), null, "cases", null, 0, -1, StateSwitch.class, !IS_TRANSIENT, !IS_VOLATILE, IS_CHANGEABLE, IS_COMPOSITE, !IS_RESOLVE_PROXIES, !IS_UNSETTABLE, IS_UNIQUE, !IS_DERIVED, IS_ORDERED);
+
+		initEClass(stateCaseEClass, StateCase.class, "StateCase", !IS_ABSTRACT, !IS_INTERFACE, IS_GENERATED_INSTANCE_CLASS);
+		initEReference(getStateCase_State(), this.getExecutionState(), null, "state", null, 0, 1, StateCase.class, !IS_TRANSIENT, !IS_VOLATILE, IS_CHANGEABLE, !IS_COMPOSITE, IS_RESOLVE_PROXIES, !IS_UNSETTABLE, IS_UNIQUE, !IS_DERIVED, IS_ORDERED);
+		initEReference(getStateCase_Step(), this.getStep(), null, "step", null, 0, 1, StateCase.class, !IS_TRANSIENT, !IS_VOLATILE, IS_CHANGEABLE, IS_COMPOSITE, !IS_RESOLVE_PROXIES, !IS_UNSETTABLE, IS_UNIQUE, !IS_DERIVED, IS_ORDERED);
+
 		// Create resource
 		createResource(eNS_URI);
 	}

+ 240 - 0
plugins/org.yakindu.sct.model.sexec/src/org/yakindu/sct/model/sexec/impl/StateCaseImpl.java

@@ -0,0 +1,240 @@
+/**
+ * <copyright>
+ * </copyright>
+ *
+ * $Id$
+ */
+package org.yakindu.sct.model.sexec.impl;
+
+import org.eclipse.emf.common.notify.Notification;
+import org.eclipse.emf.common.notify.NotificationChain;
+
+import org.eclipse.emf.ecore.EClass;
+import org.eclipse.emf.ecore.InternalEObject;
+
+import org.eclipse.emf.ecore.impl.ENotificationImpl;
+import org.eclipse.emf.ecore.impl.EObjectImpl;
+
+import org.yakindu.sct.model.sexec.ExecutionState;
+import org.yakindu.sct.model.sexec.SexecPackage;
+import org.yakindu.sct.model.sexec.StateCase;
+import org.yakindu.sct.model.sexec.Step;
+
+/**
+ * <!-- begin-user-doc -->
+ * An implementation of the model object '<em><b>State Case</b></em>'.
+ * <!-- end-user-doc -->
+ * <p>
+ * The following features are implemented:
+ * <ul>
+ *   <li>{@link org.yakindu.sct.model.sexec.impl.StateCaseImpl#getState <em>State</em>}</li>
+ *   <li>{@link org.yakindu.sct.model.sexec.impl.StateCaseImpl#getStep <em>Step</em>}</li>
+ * </ul>
+ * </p>
+ *
+ * @generated
+ */
+public class StateCaseImpl extends EObjectImpl implements StateCase {
+	/**
+	 * The cached value of the '{@link #getState() <em>State</em>}' reference.
+	 * <!-- begin-user-doc -->
+	 * <!-- end-user-doc -->
+	 * @see #getState()
+	 * @generated
+	 * @ordered
+	 */
+	protected ExecutionState state;
+	/**
+	 * The cached value of the '{@link #getStep() <em>Step</em>}' containment reference.
+	 * <!-- begin-user-doc -->
+	 * <!-- end-user-doc -->
+	 * @see #getStep()
+	 * @generated
+	 * @ordered
+	 */
+	protected Step step;
+
+	/**
+	 * <!-- begin-user-doc -->
+	 * <!-- end-user-doc -->
+	 * @generated
+	 */
+	protected StateCaseImpl() {
+		super();
+	}
+
+	/**
+	 * <!-- begin-user-doc -->
+	 * <!-- end-user-doc -->
+	 * @generated
+	 */
+	@Override
+	protected EClass eStaticClass() {
+		return SexecPackage.Literals.STATE_CASE;
+	}
+
+	/**
+	 * <!-- begin-user-doc -->
+	 * <!-- end-user-doc -->
+	 * @generated
+	 */
+	public ExecutionState getState() {
+		if (state != null && state.eIsProxy()) {
+			InternalEObject oldState = (InternalEObject)state;
+			state = (ExecutionState)eResolveProxy(oldState);
+			if (state != oldState) {
+				if (eNotificationRequired())
+					eNotify(new ENotificationImpl(this, Notification.RESOLVE, SexecPackage.STATE_CASE__STATE, oldState, state));
+			}
+		}
+		return state;
+	}
+
+	/**
+	 * <!-- begin-user-doc -->
+	 * <!-- end-user-doc -->
+	 * @generated
+	 */
+	public ExecutionState basicGetState() {
+		return state;
+	}
+
+	/**
+	 * <!-- begin-user-doc -->
+	 * <!-- end-user-doc -->
+	 * @generated
+	 */
+	public void setState(ExecutionState newState) {
+		ExecutionState oldState = state;
+		state = newState;
+		if (eNotificationRequired())
+			eNotify(new ENotificationImpl(this, Notification.SET, SexecPackage.STATE_CASE__STATE, oldState, state));
+	}
+
+	/**
+	 * <!-- begin-user-doc -->
+	 * <!-- end-user-doc -->
+	 * @generated
+	 */
+	public Step getStep() {
+		return step;
+	}
+
+	/**
+	 * <!-- begin-user-doc -->
+	 * <!-- end-user-doc -->
+	 * @generated
+	 */
+	public NotificationChain basicSetStep(Step newStep, NotificationChain msgs) {
+		Step oldStep = step;
+		step = newStep;
+		if (eNotificationRequired()) {
+			ENotificationImpl notification = new ENotificationImpl(this, Notification.SET, SexecPackage.STATE_CASE__STEP, oldStep, newStep);
+			if (msgs == null) msgs = notification; else msgs.add(notification);
+		}
+		return msgs;
+	}
+
+	/**
+	 * <!-- begin-user-doc -->
+	 * <!-- end-user-doc -->
+	 * @generated
+	 */
+	public void setStep(Step newStep) {
+		if (newStep != step) {
+			NotificationChain msgs = null;
+			if (step != null)
+				msgs = ((InternalEObject)step).eInverseRemove(this, EOPPOSITE_FEATURE_BASE - SexecPackage.STATE_CASE__STEP, null, msgs);
+			if (newStep != null)
+				msgs = ((InternalEObject)newStep).eInverseAdd(this, EOPPOSITE_FEATURE_BASE - SexecPackage.STATE_CASE__STEP, null, msgs);
+			msgs = basicSetStep(newStep, msgs);
+			if (msgs != null) msgs.dispatch();
+		}
+		else if (eNotificationRequired())
+			eNotify(new ENotificationImpl(this, Notification.SET, SexecPackage.STATE_CASE__STEP, newStep, newStep));
+	}
+
+	/**
+	 * <!-- begin-user-doc -->
+	 * <!-- end-user-doc -->
+	 * @generated
+	 */
+	@Override
+	public NotificationChain eInverseRemove(InternalEObject otherEnd, int featureID, NotificationChain msgs) {
+		switch (featureID) {
+			case SexecPackage.STATE_CASE__STEP:
+				return basicSetStep(null, msgs);
+		}
+		return super.eInverseRemove(otherEnd, featureID, msgs);
+	}
+
+	/**
+	 * <!-- begin-user-doc -->
+	 * <!-- end-user-doc -->
+	 * @generated
+	 */
+	@Override
+	public Object eGet(int featureID, boolean resolve, boolean coreType) {
+		switch (featureID) {
+			case SexecPackage.STATE_CASE__STATE:
+				if (resolve) return getState();
+				return basicGetState();
+			case SexecPackage.STATE_CASE__STEP:
+				return getStep();
+		}
+		return super.eGet(featureID, resolve, coreType);
+	}
+
+	/**
+	 * <!-- begin-user-doc -->
+	 * <!-- end-user-doc -->
+	 * @generated
+	 */
+	@Override
+	public void eSet(int featureID, Object newValue) {
+		switch (featureID) {
+			case SexecPackage.STATE_CASE__STATE:
+				setState((ExecutionState)newValue);
+				return;
+			case SexecPackage.STATE_CASE__STEP:
+				setStep((Step)newValue);
+				return;
+		}
+		super.eSet(featureID, newValue);
+	}
+
+	/**
+	 * <!-- begin-user-doc -->
+	 * <!-- end-user-doc -->
+	 * @generated
+	 */
+	@Override
+	public void eUnset(int featureID) {
+		switch (featureID) {
+			case SexecPackage.STATE_CASE__STATE:
+				setState((ExecutionState)null);
+				return;
+			case SexecPackage.STATE_CASE__STEP:
+				setStep((Step)null);
+				return;
+		}
+		super.eUnset(featureID);
+	}
+
+	/**
+	 * <!-- begin-user-doc -->
+	 * <!-- end-user-doc -->
+	 * @generated
+	 */
+	@Override
+	public boolean eIsSet(int featureID) {
+		switch (featureID) {
+			case SexecPackage.STATE_CASE__STATE:
+				return state != null;
+			case SexecPackage.STATE_CASE__STEP:
+				return step != null;
+		}
+		return super.eIsSet(featureID);
+	}
+
+} //StateCaseImpl

+ 154 - 0
plugins/org.yakindu.sct.model.sexec/src/org/yakindu/sct/model/sexec/impl/StateSwitchImpl.java

@@ -0,0 +1,154 @@
+/**
+ * <copyright>
+ * </copyright>
+ *
+ * $Id$
+ */
+package org.yakindu.sct.model.sexec.impl;
+
+import java.util.Collection;
+
+import org.eclipse.emf.common.notify.NotificationChain;
+
+import org.eclipse.emf.common.util.EList;
+
+import org.eclipse.emf.ecore.EClass;
+import org.eclipse.emf.ecore.InternalEObject;
+
+import org.eclipse.emf.ecore.util.EObjectContainmentEList;
+import org.eclipse.emf.ecore.util.InternalEList;
+
+import org.yakindu.sct.model.sexec.SexecPackage;
+import org.yakindu.sct.model.sexec.StateCase;
+import org.yakindu.sct.model.sexec.StateSwitch;
+
+/**
+ * <!-- begin-user-doc -->
+ * An implementation of the model object '<em><b>State Switch</b></em>'.
+ * <!-- end-user-doc -->
+ * <p>
+ * The following features are implemented:
+ * <ul>
+ *   <li>{@link org.yakindu.sct.model.sexec.impl.StateSwitchImpl#getCases <em>Cases</em>}</li>
+ * </ul>
+ * </p>
+ *
+ * @generated
+ */
+public class StateSwitchImpl extends StepImpl implements StateSwitch {
+	/**
+	 * The cached value of the '{@link #getCases() <em>Cases</em>}' containment reference list.
+	 * <!-- begin-user-doc -->
+	 * <!-- end-user-doc -->
+	 * @see #getCases()
+	 * @generated
+	 * @ordered
+	 */
+	protected EList<StateCase> cases;
+
+	/**
+	 * <!-- begin-user-doc -->
+	 * <!-- end-user-doc -->
+	 * @generated
+	 */
+	protected StateSwitchImpl() {
+		super();
+	}
+
+	/**
+	 * <!-- begin-user-doc -->
+	 * <!-- end-user-doc -->
+	 * @generated
+	 */
+	@Override
+	protected EClass eStaticClass() {
+		return SexecPackage.Literals.STATE_SWITCH;
+	}
+
+	/**
+	 * <!-- begin-user-doc -->
+	 * <!-- end-user-doc -->
+	 * @generated
+	 */
+	public EList<StateCase> getCases() {
+		if (cases == null) {
+			cases = new EObjectContainmentEList<StateCase>(StateCase.class, this, SexecPackage.STATE_SWITCH__CASES);
+		}
+		return cases;
+	}
+
+	/**
+	 * <!-- begin-user-doc -->
+	 * <!-- end-user-doc -->
+	 * @generated
+	 */
+	@Override
+	public NotificationChain eInverseRemove(InternalEObject otherEnd, int featureID, NotificationChain msgs) {
+		switch (featureID) {
+			case SexecPackage.STATE_SWITCH__CASES:
+				return ((InternalEList<?>)getCases()).basicRemove(otherEnd, msgs);
+		}
+		return super.eInverseRemove(otherEnd, featureID, msgs);
+	}
+
+	/**
+	 * <!-- begin-user-doc -->
+	 * <!-- end-user-doc -->
+	 * @generated
+	 */
+	@Override
+	public Object eGet(int featureID, boolean resolve, boolean coreType) {
+		switch (featureID) {
+			case SexecPackage.STATE_SWITCH__CASES:
+				return getCases();
+		}
+		return super.eGet(featureID, resolve, coreType);
+	}
+
+	/**
+	 * <!-- begin-user-doc -->
+	 * <!-- end-user-doc -->
+	 * @generated
+	 */
+	@SuppressWarnings("unchecked")
+	@Override
+	public void eSet(int featureID, Object newValue) {
+		switch (featureID) {
+			case SexecPackage.STATE_SWITCH__CASES:
+				getCases().clear();
+				getCases().addAll((Collection<? extends StateCase>)newValue);
+				return;
+		}
+		super.eSet(featureID, newValue);
+	}
+
+	/**
+	 * <!-- begin-user-doc -->
+	 * <!-- end-user-doc -->
+	 * @generated
+	 */
+	@Override
+	public void eUnset(int featureID) {
+		switch (featureID) {
+			case SexecPackage.STATE_SWITCH__CASES:
+				getCases().clear();
+				return;
+		}
+		super.eUnset(featureID);
+	}
+
+	/**
+	 * <!-- begin-user-doc -->
+	 * <!-- end-user-doc -->
+	 * @generated
+	 */
+	@Override
+	public boolean eIsSet(int featureID) {
+		switch (featureID) {
+			case SexecPackage.STATE_SWITCH__CASES:
+				return cases != null && !cases.isEmpty();
+		}
+		return super.eIsSet(featureID);
+	}
+
+} //StateSwitchImpl

+ 83 - 7
plugins/org.yakindu.sct.model.sexec/src/org/yakindu/sct/model/sexec/transformation/ModelSequencer.xtend

@@ -60,6 +60,7 @@ import org.yakindu.sct.model.stext.stext.TimeUnit
 import org.yakindu.sct.model.stext.stext.MultiplicativeOperator
 import org.yakindu.sct.model.stext.stext.NumericalMultiplyDivideExpression
 import com.sun.org.apache.xerces.internal.dom.ParentNode$UserDataRecord
+import org.yakindu.sct.model.sexec.StateSwitch
 
 class ModelSequencer {
 	
@@ -79,13 +80,18 @@ class ModelSequencer {
 		sc.mapScopes(ef)
 		sc.mapStates(ef)
 		sc.mapTimeEvents(ef)
-		sc.mapTransitions(ef)
-		sc.mapLocalReactions(ef)
+		// sc.mapTransitions(ef)
+		// sc.mapLocalReactions(ef)
 		
 		// derive all additional information that is necessary for the execution
 		ef.defineStateVector(sc)
 		ef.defineStateEnterSequences(sc)
+		ef.defineStateExitSequences(sc)
 		ef.defineEnterSequence(sc)
+		
+		sc.mapTransitions(ef)
+		sc.mapLocalReactions(ef)
+		
 		ef.defineStateCycles(sc)
 		
 		// retarget declaration refs
@@ -239,22 +245,31 @@ class ModelSequencer {
 	def Sequence mapToEffect(Transition t) {
 		val sequence = sexecFactory.createSequence 
 
+		// define exit behavior of transition
+		if (t.source != null && t.source instanceof State) {
+			sequence.steps.add((t.source as State).create.exitSequence.newCall)	
+		}
+
 		t.exitStates().fold(sequence, [seq, state | {
-			if (state.create.exitAction != null) seq.steps.add(state.create.exitAction.newCall)
+			if (state != t.source // since we call the exit sequence of the source state we have to exclude it's exit action here
+				&& state.create.exitAction != null
+			) seq.steps.add(state.create.exitAction.newCall)
 			seq
 		}])
 		
-		if (t.source != null) sequence.steps.add(newExitStateStep(t.source as State))
+//		if (t.source != null) sequence.steps.add(newExitStateStep(t.source as State))
 		
+		// map transition actions
 		if (t.effect != null) sequence.steps.add(t.effect.mapEffect)		
 
+		// define entry behavior of the transition
 		t.entryStates().reverse.fold(sequence, [seq, state | {
-			if (state.create.entryAction != null) seq.steps.add(state.create.entryAction.newCall)
+			if (state != t.target // since we call the entry sequence of the target state we have to exclude it here
+				&& state.create.entryAction != null
+			) seq.steps.add(state.create.entryAction.newCall)
 			seq
 		}])
 		
-		//TODO: make sure target state entry action is not called twice !!
-
 		if (t.target != null && t.target instanceof State) {
 			sequence.steps.add((t.target as State).create.enterSequence.newCall)	
 		}
@@ -574,6 +589,67 @@ class ModelSequencer {
 	}
 	
 	
+	
+	/**
+	 * Defines the exit sequences of all states
+	 */
+	def void defineStateExitSequences(ExecutionFlow flow, Statechart sc) {
+		
+		// iterate over all regions
+		for ( r : sc.regions) defineStateExitSequence(r)
+	}
+	
+
+	def void defineStateExitSequence(Region r) {
+		
+		// process all states of a region
+		for ( s : r.vertices.filter(typeof(State))) defineStateExitSequence(s)
+	}
+	
+	
+	def void defineStateExitSequence(State state) {
+		
+		val execState = state.create
+		val seq = sexecFactory.createSequence
+		seq.name = "exitSequence"
+		seq.comment = "Default exit sequence for state " + state.name
+
+		if ( execState.leaf ) {
+			
+			seq.steps += state.newExitStateStep
+					
+		} else {
+	
+			for ( r : state.subRegions ) {
+				defineStateExitSequence(r)
+				
+				val StateSwitch sSwitch = sexecFactory.createStateSwitch
+				
+				for ( s : r.states ) {
+					if (s.create.exitSequence != null) sSwitch.cases.add(s.create.newCase(s.create.exitSequence.newCall))
+				}
+				seq.steps.add(sSwitch);
+			} 
+		}
+
+		if (execState.exitAction != null) seq.steps.add(execState.exitAction.newCall)
+		execState.exitSequence = seq
+	}
+	
+	
+	def newCase(ExecutionState it, Step step) {
+		val sCase = sexecFactory.createStateCase
+		sCase.state = it
+		sCase.step = step
+		return sCase
+	}
+	
+	
+	def states(Region it) {
+		it.vertices.filter( typeof(State) )
+	}
+	
+	
 	def defineEnterSequence(ExecutionFlow flow, Statechart sc) {
 
 		val enterSequence = sexecFactory.createSequence

+ 37 - 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;
@@ -162,6 +163,14 @@ public class SexecAdapterFactory extends AdapterFactoryImpl {
 				return createUnscheduleTimeEventAdapter();
 			}
 			@Override
+			public Adapter caseStateSwitch(StateSwitch object) {
+				return createStateSwitchAdapter();
+			}
+			@Override
+			public Adapter caseStateCase(StateCase object) {
+				return createStateCaseAdapter();
+			}
+			@Override
 			public Adapter caseScopedElement(ScopedElement object) {
 				return createScopedElementAdapter();
 			}
@@ -407,6 +416,34 @@ public class SexecAdapterFactory extends AdapterFactoryImpl {
 		return null;
 	}
 
+	/**
+	 * Creates a new adapter for an object of class '{@link org.yakindu.sct.model.sexec.StateSwitch <em>State Switch</em>}'.
+	 * <!-- begin-user-doc -->
+	 * This default implementation returns null so that we can easily ignore cases;
+	 * it's useful to ignore a case when inheritance will catch all the cases anyway.
+	 * <!-- end-user-doc -->
+	 * @return the new adapter.
+	 * @see org.yakindu.sct.model.sexec.StateSwitch
+	 * @generated
+	 */
+	public Adapter createStateSwitchAdapter() {
+		return null;
+	}
+
+	/**
+	 * Creates a new adapter for an object of class '{@link org.yakindu.sct.model.sexec.StateCase <em>State Case</em>}'.
+	 * <!-- begin-user-doc -->
+	 * This default implementation returns null so that we can easily ignore cases;
+	 * it's useful to ignore a case when inheritance will catch all the cases anyway.
+	 * <!-- end-user-doc -->
+	 * @return the new adapter.
+	 * @see org.yakindu.sct.model.sexec.StateCase
+	 * @generated
+	 */
+	public Adapter createStateCaseAdapter() {
+		return null;
+	}
+
 	/**
 	 * Creates a new adapter for an object of class '{@link org.yakindu.sct.model.sexec.CheckRef <em>Check Ref</em>}'.
 	 * <!-- begin-user-doc -->

+ 45 - 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;
@@ -229,6 +230,20 @@ public class SexecSwitch<T> extends Switch<T> {
 				if (result == null) result = defaultCase(theEObject);
 				return result;
 			}
+			case SexecPackage.STATE_SWITCH: {
+				StateSwitch stateSwitch = (StateSwitch)theEObject;
+				T result = caseStateSwitch(stateSwitch);
+				if (result == null) result = caseStep(stateSwitch);
+				if (result == null) result = caseNamedElement(stateSwitch);
+				if (result == null) result = defaultCase(theEObject);
+				return result;
+			}
+			case SexecPackage.STATE_CASE: {
+				StateCase stateCase = (StateCase)theEObject;
+				T result = caseStateCase(stateCase);
+				if (result == null) result = defaultCase(theEObject);
+				return result;
+			}
 			default: return defaultCase(theEObject);
 		}
 	}
@@ -458,6 +473,36 @@ public class SexecSwitch<T> extends Switch<T> {
 		return null;
 	}
 
+	/**
+	 * Returns the result of interpreting the object as an instance of '<em>State Switch</em>'.
+	 * <!-- begin-user-doc -->
+	 * This implementation returns null;
+	 * returning a non-null result will terminate the switch.
+	 * <!-- end-user-doc -->
+	 * @param object the target of the switch.
+	 * @return the result of interpreting the object as an instance of '<em>State Switch</em>'.
+	 * @see #doSwitch(org.eclipse.emf.ecore.EObject) doSwitch(EObject)
+	 * @generated
+	 */
+	public T caseStateSwitch(StateSwitch object) {
+		return null;
+	}
+
+	/**
+	 * Returns the result of interpreting the object as an instance of '<em>State Case</em>'.
+	 * <!-- begin-user-doc -->
+	 * This implementation returns null;
+	 * returning a non-null result will terminate the switch.
+	 * <!-- end-user-doc -->
+	 * @param object the target of the switch.
+	 * @return the result of interpreting the object as an instance of '<em>State Case</em>'.
+	 * @see #doSwitch(org.eclipse.emf.ecore.EObject) doSwitch(EObject)
+	 * @generated
+	 */
+	public T caseStateCase(StateCase object) {
+		return null;
+	}
+
 	/**
 	 * Returns the result of interpreting the object as an instance of '<em>Check Ref</em>'.
 	 * <!-- begin-user-doc -->

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

@@ -1,291 +0,0 @@
-package org.yakindu.sct.model.sexec.transformation;
-
-import com.google.inject.Inject;
-import java.util.ArrayList;
-import java.util.HashMap;
-import org.eclipse.emf.ecore.util.EcoreUtil;
-import org.eclipse.xtext.naming.IQualifiedNameProvider;
-import org.eclipse.xtext.naming.QualifiedName;
-import org.eclipse.xtext.xbase.lib.CollectionLiterals;
-import org.eclipse.xtext.xbase.lib.ObjectExtensions;
-import org.yakindu.sct.model.sexec.Call;
-import org.yakindu.sct.model.sexec.Check;
-import org.yakindu.sct.model.sexec.CheckRef;
-import org.yakindu.sct.model.sexec.ExecutionFlow;
-import org.yakindu.sct.model.sexec.ExecutionState;
-import org.yakindu.sct.model.sexec.ScheduleTimeEvent;
-import org.yakindu.sct.model.sexec.SexecFactory;
-import org.yakindu.sct.model.sexec.Step;
-import org.yakindu.sct.model.sexec.TimeEvent;
-import org.yakindu.sct.model.sexec.UnscheduleTimeEvent;
-import org.yakindu.sct.model.sexec.transformation.StatechartExtensions;
-import org.yakindu.sct.model.sgraph.Reaction;
-import org.yakindu.sct.model.sgraph.Scope;
-import org.yakindu.sct.model.sgraph.State;
-import org.yakindu.sct.model.sgraph.Statechart;
-import org.yakindu.sct.model.sgraph.Statement;
-import org.yakindu.sct.model.sgraph.Transition;
-import org.yakindu.sct.model.stext.stext.EventDefinition;
-import org.yakindu.sct.model.stext.stext.InterfaceScope;
-import org.yakindu.sct.model.stext.stext.InternalScope;
-import org.yakindu.sct.model.stext.stext.LocalReaction;
-import org.yakindu.sct.model.stext.stext.ReactionTrigger;
-import org.yakindu.sct.model.stext.stext.StextFactory;
-import org.yakindu.sct.model.stext.stext.VariableDefinition;
-
-@SuppressWarnings("all")
-public class FactoryExtension {
-  
-  @Inject
-  private IQualifiedNameProvider qfnProvider;
-  
-  @Inject
-  private StatechartExtensions sce;
-  
-  private final HashMap<ArrayList<?>,ExecutionFlow> _createCache_create = new HashMap<ArrayList<?>,ExecutionFlow>();
-  
-  public ExecutionFlow create(final Statechart statechart) {
-    final ArrayList<?>_cacheKey = CollectionLiterals.newArrayList(statechart);
-    ExecutionFlow r;
-    synchronized (_createCache_create) {
-      if (_createCache_create.containsKey(_cacheKey)) {
-        return _createCache_create.get(_cacheKey);
-      }
-      SexecFactory _sexecFactory = this.sexecFactory();
-      ExecutionFlow _createExecutionFlow = _sexecFactory.createExecutionFlow();
-      r = _createExecutionFlow;
-      _createCache_create.put(_cacheKey, r);
-    }
-    String _name = statechart.getName();
-    r.setName(_name);
-    return r;
-  }
-  
-  private final HashMap<ArrayList<?>,InterfaceScope> _createCache_create_1 = new HashMap<ArrayList<?>,InterfaceScope>();
-  
-  protected Scope _create(final InterfaceScope scope) {
-    final ArrayList<?>_cacheKey = CollectionLiterals.newArrayList(scope);
-    InterfaceScope r;
-    synchronized (_createCache_create_1) {
-      if (_createCache_create_1.containsKey(_cacheKey)) {
-        return _createCache_create_1.get(_cacheKey);
-      }
-      StextFactory _stextFactory = this.stextFactory();
-      InterfaceScope _createInterfaceScope = _stextFactory.createInterfaceScope();
-      r = _createInterfaceScope;
-      _createCache_create_1.put(_cacheKey, r);
-    }
-    String _name = scope.getName();
-    r.setName(_name);
-    return r;
-  }
-  
-  private final HashMap<ArrayList<?>,InternalScope> _createCache_create_2 = new HashMap<ArrayList<?>,InternalScope>();
-  
-  protected Scope _create(final InternalScope scope) {
-    final ArrayList<?>_cacheKey = CollectionLiterals.newArrayList(scope);
-    InternalScope r;
-    synchronized (_createCache_create_2) {
-      if (_createCache_create_2.containsKey(_cacheKey)) {
-        return _createCache_create_2.get(_cacheKey);
-      }
-      StextFactory _stextFactory = this.stextFactory();
-      InternalScope _createInternalScope = _stextFactory.createInternalScope();
-      r = _createInternalScope;
-      _createCache_create_2.put(_cacheKey, r);
-    }
-    return r;
-  }
-  
-  private final HashMap<ArrayList<?>,EventDefinition> _createCache_create_3 = new HashMap<ArrayList<?>,EventDefinition>();
-  
-  public EventDefinition create(final EventDefinition event) {
-    final ArrayList<?>_cacheKey = CollectionLiterals.newArrayList(event);
-    EventDefinition r;
-    synchronized (_createCache_create_3) {
-      if (_createCache_create_3.containsKey(_cacheKey)) {
-        return _createCache_create_3.get(_cacheKey);
-      }
-      EventDefinition _copy = EcoreUtil.<EventDefinition>copy(event);
-      r = _copy;
-      _createCache_create_3.put(_cacheKey, r);
-    }
-    return r;
-  }
-  
-  private final HashMap<ArrayList<?>,VariableDefinition> _createCache_create_4 = new HashMap<ArrayList<?>,VariableDefinition>();
-  
-  public VariableDefinition create(final VariableDefinition v) {
-    final ArrayList<?>_cacheKey = CollectionLiterals.newArrayList(v);
-    VariableDefinition r;
-    synchronized (_createCache_create_4) {
-      if (_createCache_create_4.containsKey(_cacheKey)) {
-        return _createCache_create_4.get(_cacheKey);
-      }
-      VariableDefinition _copy = EcoreUtil.<VariableDefinition>copy(v);
-      r = _copy;
-      _createCache_create_4.put(_cacheKey, r);
-    }
-    return r;
-  }
-  
-  private final HashMap<ArrayList<?>,ExecutionState> _createCache_create_5 = new HashMap<ArrayList<?>,ExecutionState>();
-  
-  public ExecutionState create(final State state) {
-    final ArrayList<?>_cacheKey = CollectionLiterals.newArrayList(state);
-    ExecutionState r;
-    synchronized (_createCache_create_5) {
-      if (_createCache_create_5.containsKey(_cacheKey)) {
-        return _createCache_create_5.get(_cacheKey);
-      }
-      SexecFactory _sexecFactory = this.sexecFactory();
-      ExecutionState _createExecutionState = _sexecFactory.createExecutionState();
-      r = _createExecutionState;
-      _createCache_create_5.put(_cacheKey, r);
-    }
-    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;
-  }
-  
-  private final HashMap<ArrayList<?>,Check> _createCache_createCheck = new HashMap<ArrayList<?>,Check>();
-  
-  public Check createCheck(final ReactionTrigger tr) {
-    final ArrayList<?>_cacheKey = CollectionLiterals.newArrayList(tr);
-    Check r;
-    synchronized (_createCache_createCheck) {
-      if (_createCache_createCheck.containsKey(_cacheKey)) {
-        return _createCache_createCheck.get(_cacheKey);
-      }
-      SexecFactory _sexecFactory = this.sexecFactory();
-      Check _createCheck = _sexecFactory.createCheck();
-      r = _createCheck;
-      _createCache_createCheck.put(_cacheKey, r);
-    }
-    Reaction _reaction = this.sce.reaction(tr);
-    String _id = this.sce.id(_reaction);
-    r.setName(_id);
-    return r;
-  }
-  
-  private final HashMap<ArrayList<?>,org.yakindu.sct.model.sexec.Reaction> _createCache_create_6 = new HashMap<ArrayList<?>,org.yakindu.sct.model.sexec.Reaction>();
-  
-  public org.yakindu.sct.model.sexec.Reaction create(final Transition tr) {
-    final ArrayList<?>_cacheKey = CollectionLiterals.newArrayList(tr);
-    org.yakindu.sct.model.sexec.Reaction r;
-    synchronized (_createCache_create_6) {
-      if (_createCache_create_6.containsKey(_cacheKey)) {
-        return _createCache_create_6.get(_cacheKey);
-      }
-      SexecFactory _sexecFactory = this.sexecFactory();
-      org.yakindu.sct.model.sexec.Reaction _createReaction = _sexecFactory.createReaction();
-      r = _createReaction;
-      _createCache_create_6.put(_cacheKey, r);
-    }
-    {
-      String _id = this.sce.id(tr);
-      r.setName(_id);
-      r.setTransition(true);
-    }
-    return r;
-  }
-  
-  private final HashMap<ArrayList<?>,org.yakindu.sct.model.sexec.Reaction> _createCache_create_7 = new HashMap<ArrayList<?>,org.yakindu.sct.model.sexec.Reaction>();
-  
-  public org.yakindu.sct.model.sexec.Reaction create(final LocalReaction lr) {
-    final ArrayList<?>_cacheKey = CollectionLiterals.newArrayList(lr);
-    org.yakindu.sct.model.sexec.Reaction r;
-    synchronized (_createCache_create_7) {
-      if (_createCache_create_7.containsKey(_cacheKey)) {
-        return _createCache_create_7.get(_cacheKey);
-      }
-      SexecFactory _sexecFactory = this.sexecFactory();
-      org.yakindu.sct.model.sexec.Reaction _createReaction = _sexecFactory.createReaction();
-      r = _createReaction;
-      _createCache_create_7.put(_cacheKey, r);
-    }
-    {
-      String _id = this.sce.id(lr);
-      r.setName(_id);
-      r.setTransition(false);
-    }
-    return r;
-  }
-  
-  public CheckRef newRef(final Check check) {
-    CheckRef _xblockexpression = null;
-    {
-      SexecFactory _sexecFactory = this.sexecFactory();
-      CheckRef _createCheckRef = _sexecFactory.createCheckRef();
-      final CheckRef r = _createCheckRef;
-      r.setCheck(check);
-      _xblockexpression = (r);
-    }
-    return _xblockexpression;
-  }
-  
-  public Call newCall(final Step step) {
-    Call _xblockexpression = null;
-    {
-      SexecFactory _sexecFactory = this.sexecFactory();
-      Call _createCall = _sexecFactory.createCall();
-      final Call r = _createCall;
-      r.setStep(step);
-      _xblockexpression = (r);
-    }
-    return _xblockexpression;
-  }
-  
-  public ScheduleTimeEvent newScheduleTimeEvent(final TimeEvent te, final Statement timeValue) {
-    ScheduleTimeEvent _xblockexpression = null;
-    {
-      SexecFactory _sexecFactory = this.sexecFactory();
-      ScheduleTimeEvent _createScheduleTimeEvent = _sexecFactory.createScheduleTimeEvent();
-      final ScheduleTimeEvent r = _createScheduleTimeEvent;
-      r.setTimeEvent(te);
-      r.setTimeValue(timeValue);
-      _xblockexpression = (r);
-    }
-    return _xblockexpression;
-  }
-  
-  public UnscheduleTimeEvent newUnscheduleTimeEvent(final TimeEvent te) {
-    UnscheduleTimeEvent _xblockexpression = null;
-    {
-      SexecFactory _sexecFactory = this.sexecFactory();
-      UnscheduleTimeEvent _createUnscheduleTimeEvent = _sexecFactory.createUnscheduleTimeEvent();
-      final UnscheduleTimeEvent r = _createUnscheduleTimeEvent;
-      r.setTimeEvent(te);
-      _xblockexpression = (r);
-    }
-    return _xblockexpression;
-  }
-  
-  public SexecFactory sexecFactory() {
-    return SexecFactory.eINSTANCE;
-  }
-  
-  public StextFactory stextFactory() {
-    return StextFactory.eINSTANCE;
-  }
-  
-  public Scope create(final Scope scope) {
-    if ((scope instanceof InterfaceScope)) {
-      return _create((InterfaceScope)scope);
-    } else if ((scope instanceof InternalScope)) {
-      return _create((InternalScope)scope);
-    } else {
-      throw new IllegalArgumentException("Unhandled parameter types: " +
-        java.util.Arrays.<Object>asList(scope).toString());
-    }
-  }
-}

Разница между файлами не показана из-за своего большого размера
+ 0 - 1556
plugins/org.yakindu.sct.model.sexec/xtend-gen/org/yakindu/sct/model/sexec/transformation/ModelSequencer.java


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

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

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

@@ -5,7 +5,13 @@ import org.junit.runners.Suite;
 import org.junit.runners.Suite.SuiteClasses;
 
 @RunWith(Suite.class)
-@SuiteClasses({ModelSequencerTest.class, ModelSequencerStateTest.class, ModelSequencerHierarchyTest.class})
+@SuiteClasses({
+	ModelSequencerSCTest.class,
+	ModelSequencertDeclarationsTest.class,
+	ModelSequencerStateTest.class,
+	ModelSequencerStateReactionTest.class,
+	ModelSequencerHierarchyTest.class,
+	ModelSequencerStateVectorTest.class})
 public class AllTests {
 	
 }

+ 53 - 2
test-plugins/org.yakindu.sct.model.sexec.test/src/org/yakindu/sct/model/sexec/transformation/test/Assert.java

@@ -1,18 +1,69 @@
 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.assertSame;
+import static org.junit.Assert.assertTrue;
+import static org.junit.Assert.fail;
+
+import java.util.ArrayList;
+import java.util.Arrays;
+import java.util.List;
 
 import org.yakindu.sct.model.sexec.Call;
+import org.yakindu.sct.model.sexec.ExecutionState;
 import org.yakindu.sct.model.sexec.Sequence;
+import org.yakindu.sct.model.sexec.StateCase;
+import org.yakindu.sct.model.sexec.StateSwitch;
 import org.yakindu.sct.model.sexec.Step;
 
 
 public class Assert {
 
 	public static void assertCall(Sequence seq, int pos, Step target) {
-		Call call = (Call) seq.getSteps().get(pos);
-		assertSame(target, call.getStep());		
+		assertCall(seq.getSteps().get(pos), target);
 	}
 	
+	
+	public static void assertCall(Step step, Step target) {
+		assertNotNull("Step is null", step);
+		assertNotNull("No target specified", target);
+		assertTrue("Step is no Call (was " + step.getClass().getName() +")", step instanceof Call);
+		
+		assertSame(target, ((Call)step).getStep());
+	}
+
+
+	public static StateCase assertedStateCase(Step step, ExecutionState state) {
+
+		assertNotNull("Step is null", step);
+		assertNotNull("No state specified", state);
+		assertTrue("Step is no StateSwitch (was " + step.getClass().getName() +")", step instanceof StateSwitch);
+
+		for ( StateCase sCase : ((StateSwitch)step).getCases()) {
+			if ( sCase.getState() == state ) return sCase;
+		}
+		
+		fail("No case for state '" + state.getSimpleName() + "' exists.");
+		return null;
+	}
+
+
+	public static void assertStateSwitch(Step step, ExecutionState ... states ) {
+		
+		assertNotNull("Step is null", step);
+		assertTrue("Step is no StateSwitch (was " + step.getClass().getName() +")", step instanceof StateSwitch);
+		
+		List<ExecutionState> stateList = Arrays.asList(states);
+		List<ExecutionState> stateCases = new ArrayList<ExecutionState>();
+		
+		for (StateCase aCase : ((StateSwitch)step).getCases()) {
+			stateCases.add(aCase.getState());
+		}
+		
+		assertEquals("StateSwitch cases do not match!", stateList, stateCases);
+	}
+
+
 
 }

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

@@ -1,29 +1,13 @@
 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._createEntryAssignemnt;
-import static org.yakindu.sct.model.sexec.transformation.test.SCTTestUtil._createExitAssignemnt;
-import static org.yakindu.sct.model.sexec.transformation.test.SCTTestUtil._createInterfaceScope;
-import static org.yakindu.sct.model.sexec.transformation.test.SCTTestUtil._createRegion;
-import static org.yakindu.sct.model.sexec.transformation.test.SCTTestUtil._createState;
-import static org.yakindu.sct.model.sexec.transformation.test.SCTTestUtil._createStatechart;
-import static org.yakindu.sct.model.sexec.transformation.test.SCTTestUtil._createTransition;
-import static org.yakindu.sct.model.sexec.transformation.test.SCTTestUtil._createVariableDefinition;
-import static org.yakindu.sct.model.sexec.transformation.test.SCTTestUtil.findState;
-
-import org.junit.Before;
+import static org.junit.Assert.*;
+import static org.yakindu.sct.model.sexec.transformation.test.SCTTestUtil.*;
+
 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;
@@ -31,20 +15,8 @@ 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);
-	}
+ 
+public class ModelSequencerHierarchyTest extends ModelSequencerTest {
 
 
 	/**
@@ -60,15 +32,15 @@ public class ModelSequencerHierarchyTest {
 
 			Region r = _createRegion("r", sc); {
 				State s1 = _createState("s1", r); {
-					_createEntryAssignemnt(v1, s1, "1");
+					_createEntryAssignment(v1, s1, "1");
 
 					Region r_s1 = _createRegion("r", s1); {
 						State s3 = _createState("s3", r_s1); {
-							_createEntryAssignemnt(v1, s3, "2");
+							_createEntryAssignment(v1, s3, "2");
 							
 							Region r_s3 = _createRegion("r", s3); {
 								State s4 = _createState("s4", r_s3);
-								_createEntryAssignemnt(v1, s4, "3");
+								_createEntryAssignment(v1, s4, "3");
 
 								State s5 = _createState("s5", r_s3);
 							}
@@ -108,16 +80,11 @@ public class ModelSequencerHierarchyTest {
 		assertTrue(_t.isTransition());
 		
 		Sequence _effect = (Sequence) _t.getEffect();
-		assertEquals(5, _effect.getSteps().size());
+		assertEquals(4, _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());	
+		assertCall(_effect, 3, _s4.getEnterSequence());
+		assertCall(_effect, 2, _s3.getEntryAction());		
+		assertCall(_effect, 1, _s1.getEntryAction());
 		
 	}
 	
@@ -137,14 +104,14 @@ public class ModelSequencerHierarchyTest {
 
 			Region r = _createRegion("r", sc); {
 				State s1 = _createState("s1", r); {
-					_createEntryAssignemnt(v1, s1, "1");
+					_createEntryAssignment(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");
+								_createEntryAssignment(v1, s4, "3");
 
 								State s5 = _createState("s5", r_s3);
 							}
@@ -183,13 +150,10 @@ public class ModelSequencerHierarchyTest {
 		assertTrue(_t.isTransition());
 		
 		Sequence _effect = (Sequence) _t.getEffect();
-		assertEquals(4, _effect.getSteps().size());
+		assertEquals(3, _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());	
+		assertCall(_effect, 2, _s4.getEnterSequence());
+		assertCall(_effect,  1, _s1.getEntryAction());
 	}
 	
 	
@@ -208,15 +172,15 @@ public class ModelSequencerHierarchyTest {
 
 			Region r = _createRegion("r", sc); {
 				State s1 = _createState("s1", r); {
-					_createEntryAssignemnt(v1, s1, "1");
+					_createEntryAssignment(v1, s1, "1");
 
 					Region r_s1 = _createRegion("r", s1); {
 						State s3 = _createState("s3", r_s1); {
-							_createEntryAssignemnt(v1, s3, "2");
+							_createEntryAssignment(v1, s3, "2");
 
 							Region r_s3 = _createRegion("r", s3); {
 								State s4 = _createState("s4", r_s3);
-								_createEntryAssignemnt(v1, s4, "3");
+								_createEntryAssignment(v1, s4, "3");
 
 								State s5 = _createState("s5", r_s3);
 							}
@@ -255,10 +219,9 @@ public class ModelSequencerHierarchyTest {
 		assertTrue(_t.isTransition());
 		
 		Sequence _effect = (Sequence) _t.getEffect();
-		assertEquals(3, _effect.getSteps().size());
+		assertEquals(2, _effect.getSteps().size());
 		
-		Call _s4_entryActionCall = (Call) _effect.getSteps().get(2);
-		assertSame( _s4.getEntryAction(), _s4_entryActionCall.getStep());	
+		assertCall(_effect, 1, _s4.getEnterSequence());	
 	}
 
 
@@ -279,15 +242,15 @@ public class ModelSequencerHierarchyTest {
 
 			Region r = _createRegion("r", sc); {
 				State s1 = _createState("s1", r); {
-					_createExitAssignemnt(v1, s1, "1");
+					_createExitAssignment(v1, s1, "1");
 
 					Region r_s1 = _createRegion("r", s1); {
 						State s3 = _createState("s3", r_s1); {
-							_createExitAssignemnt(v1, s3, "2");
+							_createExitAssignment(v1, s3, "2");
 							
 							Region r_s3 = _createRegion("r", s3); {
 								State s4 = _createState("s4", r_s3);
-								_createExitAssignemnt(v1, s4, "3");
+								_createExitAssignment(v1, s4, "3");
 
 								State s5 = _createState("s5", r_s3);
 							}
@@ -323,17 +286,11 @@ public class ModelSequencerHierarchyTest {
 		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());	
+		assertEquals(4, _effect.getSteps().size());
 		
+		assertCall(_effect, 0, _s4.getExitSequence());
+		assertCall(_effect, 1, _s3.getExitAction());
+		assertCall(_effect, 2, _s1.getExitAction());
 	}
 	
 	
@@ -352,14 +309,14 @@ public class ModelSequencerHierarchyTest {
 
 			Region r = _createRegion("r", sc); {
 				State s1 = _createState("s1", r); {
-					_createExitAssignemnt(v1, s1, "1");
+					_createExitAssignment(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");
+								_createExitAssignment(v1, s4, "3");
 
 								State s5 = _createState("s5", r_s3);
 							}
@@ -395,14 +352,10 @@ public class ModelSequencerHierarchyTest {
 		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());	
+		assertEquals(3, _effect.getSteps().size());
 		
+		assertCall(_effect, 0, _s4.getExitSequence());
+		assertCall(_effect, 1, _s1.getExitAction());
 	}
 	
 
@@ -420,15 +373,15 @@ public class ModelSequencerHierarchyTest {
 
 			Region r = _createRegion("r", sc); {
 				State s1 = _createState("s1", r); {
-					_createExitAssignemnt(v1, s1, "1");
+					_createExitAssignment(v1, s1, "1");
 
 					Region r_s1 = _createRegion("r", s1); {
 						State s3 = _createState("s3", r_s1); {
-							_createExitAssignemnt(v1, s3, "2");
+							_createExitAssignment(v1, s3, "2");
 
 							Region r_s3 = _createRegion("r", s3); {
 								State s4 = _createState("s4", r_s3);
-								_createExitAssignemnt(v1, s4, "3");
+								_createExitAssignment(v1, s4, "3");
 
 								State s5 = _createState("s5", r_s3);
 							}
@@ -464,10 +417,9 @@ public class ModelSequencerHierarchyTest {
 		assertTrue(_t.isTransition());
 		
 		Sequence _effect = (Sequence) _t.getEffect();
-		assertEquals(3, _effect.getSteps().size());
+		assertEquals(2, _effect.getSteps().size());
 		
-		Call _s4_exitActionCall = (Call) _effect.getSteps().get(0);
-		assertSame( _s4.getExitAction(), _s4_exitActionCall.getStep());	
+		assertCall(_effect, 0, _s4.getExitSequence());
 		
 	}
 

+ 59 - 0
test-plugins/org.yakindu.sct.model.sexec.test/src/org/yakindu/sct/model/sexec/transformation/test/ModelSequencerSCTest.java

@@ -0,0 +1,59 @@
+package org.yakindu.sct.model.sexec.transformation.test;
+
+import static org.junit.Assert.assertEquals;
+import static org.junit.Assert.assertNotNull;
+import static org.yakindu.sct.model.sexec.transformation.test.SCTTestUtil._createStatechart;
+
+import org.junit.Test;
+import org.yakindu.sct.model.sexec.ExecutionFlow;
+import org.yakindu.sct.model.sexec.transformation.test.SCTTestUtil.OrthogonalFlatTSC;
+import org.yakindu.sct.model.sexec.transformation.test.SCTTestUtil.SimpleFlatTSC;
+import org.yakindu.sct.model.sgraph.Statechart;
+
+public class ModelSequencerSCTest extends ModelSequencerTest {
+
+	/**
+	 * The name of the execution flow must be equal to the statechart name.
+	 */
+	@Test
+	public void testFlowName() {
+		Statechart sc = _createStatechart("Test");
+		assertEquals(sc.getName(), sequencer.transform(sc).getName());
+	}
+
+	/**
+	 * In the simplest case the a state without an actions will be entered.
+	 */
+	@Test
+	public void testSCEnterSequence_SimpleFlatTSC() {
+		SimpleFlatTSC tsc = new SimpleFlatTSC();
+
+		ExecutionFlow flow = sequencer.transform(tsc.sc);
+
+		assertNotNull(flow.getEnterSequence());
+		assertEquals(1, flow.getEnterSequence().getSteps().size());
+
+		assertCall(flow.getEnterSequence(), 0, flow.getStates().get(0)
+				.getEnterSequence());
+	}
+
+	/**
+	 * For each top level region a EnterState step must be performed.
+	 */
+	@Test
+	public void testSCEnterSequence_OrthogonalFlatTSC() {
+		OrthogonalFlatTSC tsc = new OrthogonalFlatTSC();
+
+		ExecutionFlow flow = sequencer.transform(tsc.sc);
+
+		assertNotNull(flow.getEnterSequence());
+		assertEquals(2, flow.getEnterSequence().getSteps().size());
+
+		assertCall(flow.getEnterSequence(), 0, flow.getStates().get(0)
+				.getEnterSequence());
+		assertCall(flow.getEnterSequence(), 1, flow.getStates().get(2)
+				.getEnterSequence());
+
+	}
+
+}

+ 268 - 0
test-plugins/org.yakindu.sct.model.sexec.test/src/org/yakindu/sct/model/sexec/transformation/test/ModelSequencerStateReactionTest.java

@@ -0,0 +1,268 @@
+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.assertSame;
+import static org.junit.Assert.assertTrue;
+import static org.yakindu.sct.model.sexec.transformation.test.SCTTestUtil._createEventDefinition;
+import static org.yakindu.sct.model.sexec.transformation.test.SCTTestUtil._createInterfaceScope;
+import static org.yakindu.sct.model.sexec.transformation.test.SCTTestUtil._createReactionTrigger;
+import static org.yakindu.sct.model.sexec.transformation.test.SCTTestUtil._createRegion;
+import static org.yakindu.sct.model.sexec.transformation.test.SCTTestUtil._createRegularEventSpec;
+import static org.yakindu.sct.model.sexec.transformation.test.SCTTestUtil._createState;
+import static org.yakindu.sct.model.sexec.transformation.test.SCTTestUtil._createStatechart;
+import static org.yakindu.sct.model.sexec.transformation.test.SCTTestUtil._createTimeEventSpec;
+import static org.yakindu.sct.model.sexec.transformation.test.SCTTestUtil._createTimeTriggeredReaction;
+import static org.yakindu.sct.model.sexec.transformation.test.SCTTestUtil._createTransition;
+import static org.yakindu.sct.model.sexec.transformation.test.SCTTestUtil._createValue;
+import static org.yakindu.sct.model.sexec.transformation.test.SCTTestUtil._createVariableAssignment;
+import static org.yakindu.sct.model.sexec.transformation.test.SCTTestUtil._createVariableDefinition;
+
+import org.junit.Test;
+import org.yakindu.sct.model.sexec.ExecutionFlow;
+import org.yakindu.sct.model.sexec.ExecutionState;
+import org.yakindu.sct.model.sexec.If;
+import org.yakindu.sct.model.sexec.Reaction;
+import org.yakindu.sct.model.sexec.ScheduleTimeEvent;
+import org.yakindu.sct.model.sexec.Sequence;
+import org.yakindu.sct.model.sexec.TimeEvent;
+import org.yakindu.sct.model.sexec.UnscheduleTimeEvent;
+import org.yakindu.sct.model.sgraph.Region;
+import org.yakindu.sct.model.sgraph.SGraphFactory;
+import org.yakindu.sct.model.sgraph.Scope;
+import org.yakindu.sct.model.sgraph.State;
+import org.yakindu.sct.model.sgraph.Statechart;
+import org.yakindu.sct.model.sgraph.Statement;
+import org.yakindu.sct.model.sgraph.Transition;
+import org.yakindu.sct.model.stext.stext.Assignment;
+import org.yakindu.sct.model.stext.stext.AssignmentOperator;
+import org.yakindu.sct.model.stext.stext.ElementReferenceExpression;
+import org.yakindu.sct.model.stext.stext.EventDefinition;
+import org.yakindu.sct.model.stext.stext.LocalReaction;
+import org.yakindu.sct.model.stext.stext.LogicalAndExpression;
+import org.yakindu.sct.model.stext.stext.LogicalOrExpression;
+import org.yakindu.sct.model.stext.stext.MultiplicativeOperator;
+import org.yakindu.sct.model.stext.stext.NumericalMultiplyDivideExpression;
+import org.yakindu.sct.model.stext.stext.PrimitiveValueExpression;
+import org.yakindu.sct.model.stext.stext.ReactionEffect;
+import org.yakindu.sct.model.stext.stext.ReactionTrigger;
+import org.yakindu.sct.model.stext.stext.TimeEventType;
+import org.yakindu.sct.model.stext.stext.TimeUnit;
+import org.yakindu.sct.model.stext.stext.Type;
+import org.yakindu.sct.model.stext.stext.VariableDefinition;
+
+public class ModelSequencerStateReactionTest extends ModelSequencerTest {
+
+	/**
+	 * Single trigger events of a Reaction Trigger will be converted into a single condition 
+	 * that consists of a ElementReferenceExpression to the corresponding event definition.
+	 */
+	@Test public void testSingleRegularEventTriggerCondition() {
+
+		EventDefinition e1 = _createEventDefinition("e1", null);
+		ReactionTrigger tr1 = _createReactionTrigger(null);
+		_createRegularEventSpec(e1, tr1);
+
+		Statement s = sequencer.buildCondition(tr1);
+
+		assertTrue(s instanceof ElementReferenceExpression);
+	}
+
+
+	/**
+	 * Multiple trigger events of a ReactionTrigger will be converted to a condition 
+	 * that consists of a ElementReferenceExpressions connected by LogicalOrExpressions.
+	 * 
+	 * e1, e1 -> e1 || e2
+	 * 
+	 */
+	@Test public void testMultipleRegularEventTriggerCondition() {
+
+		EventDefinition e1 = _createEventDefinition("e1", null);
+		EventDefinition e2 = _createEventDefinition("e2", null);
+
+		ReactionTrigger tr1 = _createReactionTrigger(null);
+		_createRegularEventSpec(e1, tr1);
+		_createRegularEventSpec(e2, tr1);
+
+		Statement s = sequencer.buildCondition(tr1);
+
+		assertTrue(s instanceof LogicalOrExpression);
+		assertTrue(((LogicalOrExpression) s).getLeftOperand() instanceof ElementReferenceExpression);
+		assertTrue(((LogicalOrExpression) s).getRightOperand() instanceof ElementReferenceExpression);
+	}
+
+	
+	@Test public void testTransitionCheckSequenceWithoutGuard() {
+
+		EventDefinition e1 = _createEventDefinition("e1", null);
+		EventDefinition e2 = _createEventDefinition("e2", null);
+
+		ReactionTrigger tr1 = _createReactionTrigger(null);
+		_createRegularEventSpec(e1, tr1);
+		_createRegularEventSpec(e2, tr1);
+
+		Transition t = SGraphFactory.eINSTANCE.createTransition();
+		t.setTrigger(tr1);
+
+		Reaction reaction = sequencer.mapTransition(t);
+
+		assertTrue(reaction.getCheck().getCondition() instanceof LogicalOrExpression);
+		assertTrue(((LogicalOrExpression) reaction.getCheck().getCondition()).getLeftOperand() instanceof ElementReferenceExpression);
+		assertTrue(((LogicalOrExpression) reaction.getCheck().getCondition()).getRightOperand() instanceof ElementReferenceExpression);
+
+		assertEquals(e1.getName(),
+				((ElementReferenceExpression)((LogicalOrExpression) reaction.getCheck().getCondition()).getLeftOperand()).getValue().getName());
+		assertEquals(e2.getName(),
+				((ElementReferenceExpression)((LogicalOrExpression) reaction.getCheck().getCondition()).getRightOperand()).getValue().getName());
+	}
+
+	
+	@Test public void testTransitionCheckSequenceWithGuard() {
+
+		EventDefinition e1 = _createEventDefinition("e1", null);
+		EventDefinition e2 = _createEventDefinition("e2", null);
+
+		ReactionTrigger tr1 = _createReactionTrigger(null);
+		_createRegularEventSpec(e1, tr1);
+		_createRegularEventSpec(e2, tr1);
+
+		PrimitiveValueExpression exp = _createValue("false");
+		tr1.setGuardExpression(exp);
+
+		Transition t = SGraphFactory.eINSTANCE.createTransition();
+		t.setTrigger(tr1);
+
+		Reaction reaction = sequencer.mapTransition(t);
+
+		// now check the expression structure ...
+		
+		// the root is an and condition with the trigger check as the first (left) part and the guard as the right (second) part.
+		LogicalAndExpression and = (LogicalAndExpression) reaction.getCheck().getCondition();
+		LogicalOrExpression triggerCheck = (LogicalOrExpression) and.getLeftOperand();
+		PrimitiveValueExpression guardCheck = (PrimitiveValueExpression) and.getRightOperand();
+		
+		assertTrue(triggerCheck.getLeftOperand() instanceof ElementReferenceExpression);
+		assertTrue(triggerCheck.getRightOperand() instanceof ElementReferenceExpression);
+		assertEquals(e1.getName(),
+				((ElementReferenceExpression) triggerCheck.getLeftOperand()).getValue().getName());
+		assertEquals(e2.getName(),
+				((ElementReferenceExpression) triggerCheck.getRightOperand()).getValue().getName());
+		
+		assertEquals(exp.getValue(), guardCheck.getValue());
+	}
+
+	
+	@Test public void testTransitionCheckSequenceWithoutTrigger() {
+
+		ReactionTrigger tr1 = _createReactionTrigger(null);
+		PrimitiveValueExpression exp = _createValue("false");
+		tr1.setGuardExpression(exp);
+
+		Transition t = SGraphFactory.eINSTANCE.createTransition();
+		t.setTrigger(tr1);
+
+		Reaction reaction = sequencer.mapTransition(t);
+
+		// now check the expression structure ...
+		
+		// the root is an and condition with the trigger check as the first (left) part and the guard as the right (second) part.
+		PrimitiveValueExpression guard = (PrimitiveValueExpression) reaction.getCheck().getCondition();
+		assertEquals(exp.getValue(), guard.getValue());
+	}
+
+	
+
+	
+	/**
+	 * If a time trigger is defined for a transition then an event must be introduced into the execution flow.
+	 */
+	@Test public void testSingleTransitionTimeTrigger() {
+		
+		Statechart sc = _createStatechart("test");
+		Scope scope = _createInterfaceScope("interface", sc);
+		VariableDefinition v1 = _createVariableDefinition("v1", Type.INTEGER, scope);
+		Region r = _createRegion("main", sc);
+		State s= _createState("s", r);
+
+		Transition t = _createTransition(s, s);
+		ReactionTrigger tr1 = _createReactionTrigger(t);
+		_createTimeEventSpec(TimeEventType.AFTER, 1, TimeUnit.SECOND, tr1);
+
+		Assignment assign = _createVariableAssignment(v1, AssignmentOperator.ASSIGN, _createValue("42"), (ReactionEffect) t.getEffect());
+		
+		ExecutionFlow flow = sequencer.transform(sc);
+		
+		// assert definition of time event
+		Scope timerScope = flow.getScopes().get(1);
+		assertTrue(timerScope.getDeclarations().get(0) instanceof TimeEvent);
+		
+		TimeEvent te = (TimeEvent) timerScope.getDeclarations().get(0);
+		
+		// assert that the reaction check checks the time event
+		assertEquals(1, flow.getStates().size());
+		ExecutionState _s = flow.getStates().get(0);
+		assertEquals(s.getName(), _s.getSimpleName());
+		If _if = (If) flow.getStates().get(0).getCycle().getSteps().get(0);
+
+		ElementReferenceExpression _ere = (ElementReferenceExpression) _if.getCheck().getCondition();
+		assertSame(te, _ere.getValue());
+		
+		// assert the scheduling of the time event during state entry
+		assertNotNull(_s.getEntryAction());
+		Sequence entryAction = (Sequence) _s.getEntryAction();
+		ScheduleTimeEvent ste = (ScheduleTimeEvent) entryAction.getSteps().get(0);
+		assertSame(te, ste.getTimeEvent());
+		NumericalMultiplyDivideExpression multiply = (NumericalMultiplyDivideExpression) ste.getTimeValue();
+		assertEquals("1", ((PrimitiveValueExpression)multiply.getLeftOperand()).getValue());
+		assertEquals("1000", ((PrimitiveValueExpression)multiply.getRightOperand()).getValue());
+		assertEquals(MultiplicativeOperator.MUL, multiply.getOperator());
+						
+		// assert the unscheduling of the time events during state exit
+		assertNotNull(_s.getExitAction());
+		Sequence exitAction = (Sequence) _s.getExitAction();
+		UnscheduleTimeEvent ute = (UnscheduleTimeEvent) exitAction.getSteps().get(0);
+		assertSame(te, ute.getTimeEvent());
+	}
+
+	/**
+	 * 
+	 */
+	@Test public void testSingleLocalTimeTrigger() {
+		
+		Statechart sc = _createStatechart("test");
+		Scope scope = _createInterfaceScope("interface", sc);
+		VariableDefinition v1 = _createVariableDefinition("v1", Type.INTEGER, scope);
+		Region r = _createRegion("main", sc);
+		State s= _createState("s", r);
+
+		LocalReaction timeTriggeredReaction = _createTimeTriggeredReaction(s, TimeEventType.AFTER, 2, TimeUnit.MILLISECOND);
+		Assignment assign = _createVariableAssignment(v1, AssignmentOperator.ASSIGN, _createValue("42"), (ReactionEffect) timeTriggeredReaction.getEffect());
+		
+		ExecutionFlow flow = sequencer.transform(sc);
+		
+		Scope timerScope = flow.getScopes().get(1);
+		assertTrue(timerScope.getDeclarations().get(0) instanceof TimeEvent);
+		
+		TimeEvent te = (TimeEvent) timerScope.getDeclarations().get(0);
+		
+		// assert that the reaction check checks the time event
+		ExecutionState _s = flow.getStates().get(0);
+
+		// assert the scheduling of the time event during state entry
+		assertNotNull(_s.getEntryAction());
+		Sequence entryAction = (Sequence) _s.getEntryAction();
+		ScheduleTimeEvent ste = (ScheduleTimeEvent) entryAction.getSteps().get(0);
+		assertSame(te, ste.getTimeEvent());
+		PrimitiveValueExpression value = (PrimitiveValueExpression) ste.getTimeValue();
+		assertEquals("2", value.getValue());
+		assertNotNull(_s.getExitAction());
+		Sequence exitAction = (Sequence) _s.getExitAction();
+		UnscheduleTimeEvent ute = (UnscheduleTimeEvent) exitAction.getSteps().get(0);
+		assertSame(te, ute.getTimeEvent());
+
+	}
+	
+
+	
+}

+ 546 - 35
test-plugins/org.yakindu.sct.model.sexec.test/src/org/yakindu/sct/model/sexec/transformation/test/ModelSequencerStateTest.java

@@ -1,57 +1,45 @@
 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.assertTrue;
-import static org.yakindu.sct.model.sexec.transformation.test.SCTTestUtil._createEntry;
-import static org.yakindu.sct.model.sexec.transformation.test.SCTTestUtil._createEntryAction;
-import static org.yakindu.sct.model.sexec.transformation.test.SCTTestUtil._createEntryAssignemnt;
-import static org.yakindu.sct.model.sexec.transformation.test.SCTTestUtil._createExitAction;
-import static org.yakindu.sct.model.sexec.transformation.test.SCTTestUtil._createInterfaceScope;
-import static org.yakindu.sct.model.sexec.transformation.test.SCTTestUtil._createRegion;
-import static org.yakindu.sct.model.sexec.transformation.test.SCTTestUtil._createState;
-import static org.yakindu.sct.model.sexec.transformation.test.SCTTestUtil._createStatechart;
-import static org.yakindu.sct.model.sexec.transformation.test.SCTTestUtil._createTransition;
-import static org.yakindu.sct.model.sexec.transformation.test.SCTTestUtil._createValue;
-import static org.yakindu.sct.model.sexec.transformation.test.SCTTestUtil._createVariableAssignment;
-import static org.yakindu.sct.model.sexec.transformation.test.SCTTestUtil._createVariableDefinition;
-
-import org.junit.Before;
+import static org.junit.Assert.*;
+import static org.yakindu.sct.model.sexec.transformation.test.SCTTestUtil.*;
+
 import org.junit.Test;
+import org.yakindu.sct.model.sexec.Call;
 import org.yakindu.sct.model.sexec.EnterState;
+import org.yakindu.sct.model.sexec.Execution;
 import org.yakindu.sct.model.sexec.ExecutionFlow;
 import org.yakindu.sct.model.sexec.ExecutionState;
-import org.yakindu.sct.model.sexec.transformation.ModelSequencer;
-import org.yakindu.sct.model.sexec.transformation.SequencerModule;
+import org.yakindu.sct.model.sexec.ExitState;
+import org.yakindu.sct.model.sexec.If;
+import org.yakindu.sct.model.sexec.Reaction;
+import org.yakindu.sct.model.sexec.Sequence;
+import org.yakindu.sct.model.sexec.transformation.test.SCTTestUtil.MinimalTSC;
+import org.yakindu.sct.model.sexec.transformation.test.SCTTestUtil.OrthogonalFlatTSC;
+import org.yakindu.sct.model.sexec.transformation.test.SCTTestUtil.SimpleFlatTSC;
 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.Assignment;
 import org.yakindu.sct.model.stext.stext.AssignmentOperator;
+import org.yakindu.sct.model.stext.stext.ElementReferenceExpression;
 import org.yakindu.sct.model.stext.stext.LocalReaction;
+import org.yakindu.sct.model.stext.stext.LogicalAndExpression;
+import org.yakindu.sct.model.stext.stext.LogicalRelationExpression;
+import org.yakindu.sct.model.stext.stext.PrimitiveValueExpression;
 import org.yakindu.sct.model.stext.stext.ReactionEffect;
+import org.yakindu.sct.model.stext.stext.ReactionTrigger;
+import org.yakindu.sct.model.stext.stext.RelationalOperator;
+import org.yakindu.sct.model.stext.stext.StextFactory;
 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 extends Assert {
+public class ModelSequencerStateTest extends ModelSequencerTest {
 
 	
-	@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.
@@ -84,7 +72,7 @@ public class ModelSequencerStateTest extends Assert {
 	/**
 	 * entry actions of a substate must not be included in a states entry action list
 	 */
-	@Test public void testSubStateEntryAction() {
+	@Test public void testSubStateEntryActionExclusion() {
 		Statechart sc = _createStatechart("test");
 		Scope scope = _createInterfaceScope("interface", sc);
 		VariableDefinition v1 = _createVariableDefinition("v1", Type.INTEGER, scope);
@@ -182,7 +170,7 @@ public class ModelSequencerStateTest extends Assert {
 
 			Region r = _createRegion("r", sc); {
 				State s1 = _createState("s1", r); {
-					_createEntryAssignemnt(v1, s1, "1");
+					_createEntryAssignment(v1, s1, "1");
 					Region r1_s1 = _createRegion("r1", s1); {
 						Entry e = _createEntry(EntryKind.INITIAL, null, r1_s1);
 						State s2 = _createState("s2", r1_s1);
@@ -219,4 +207,527 @@ public class ModelSequencerStateTest extends Assert {
 	}
 
 
+	
+	
+	/**
+	 * A leaf state must have a exit sequence. 
+	 * This exit sequence consists of an exit action call and a state exit step.
+	 */
+	@Test public void testLeafStateExitSequence() {
+		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 = _createExitAction(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.getExitAction());
+		assertNotNull(_s1.getExitSequence());
+		assertEquals(2, _s1.getExitSequence().getSteps().size());
+
+		assertTrue(_s1.getExitSequence().getSteps().get(0) instanceof ExitState);
+
+		assertCall(_s1.getExitSequence(), 1, _s1.getExitAction());
+				
+	}
+
+	
+	/**
+	 * A composite state must have a exit sequence. 
+	 * This exit sequence consists of an exit action call and a exit sequence call for each sub region.
+	 */
+	@Test public void testCompositeStateExitSequence() {
+		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); {
+					_createExitAssignment(v1, s1, "1");
+					Region r1_s1 = _createRegion("r1", s1); {
+						Entry e = _createEntry(EntryKind.INITIAL, null, r1_s1);
+						State s2 = _createState("s2", r1_s1);
+						State s3 = _createState("s3", r1_s1);
+						_createTransition(e, s2);
+						_createTransition(s2, s3);
+					}
+					Region r2_s1 = _createRegion("r2", s1); {
+						Entry e = _createEntry(EntryKind.INITIAL, null, r2_s1);
+						State s4 = _createState("s4", r2_s1);
+						State s5 = _createState("s5", r2_s1);
+						State s6 = _createState("s6", r2_s1);
+						_createTransition(e, s4);
+					}
+				}
+			}
+		}
+		
+	
+		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());
+		
+		ExecutionState _s4 = flow.getStates().get(3);
+		assertEquals("s4", _s4.getSimpleName());
+		
+		ExecutionState _s5 = flow.getStates().get(4);
+		assertEquals("s5", _s5.getSimpleName());
+		
+		ExecutionState _s6 = flow.getStates().get(5);
+		assertEquals("s6", _s6.getSimpleName());
+		
+		assertNotNull(_s1.getExitAction());
+		assertNotNull(_s1.getExitSequence());
+		assertEquals(3, _s1.getExitSequence().getSteps().size());
+		
+		assertStateSwitch(_s1.getExitSequence().getSteps().get(0), _s2, _s3);
+		assertCall( assertedStateCase(_s1.getExitSequence().getSteps().get(0), _s2).getStep(), _s2.getExitSequence());
+		assertCall( assertedStateCase(_s1.getExitSequence().getSteps().get(0), _s3).getStep(), _s3.getExitSequence());
+		
+		assertStateSwitch(_s1.getExitSequence().getSteps().get(1), _s4, _s5, _s6);
+		assertCall( assertedStateCase(_s1.getExitSequence().getSteps().get(1), _s4).getStep(), _s4.getExitSequence());
+		assertCall( assertedStateCase(_s1.getExitSequence().getSteps().get(1), _s5).getStep(), _s5.getExitSequence());
+		assertCall( assertedStateCase(_s1.getExitSequence().getSteps().get(1), _s6).getStep(), _s6.getExitSequence());
+
+		assertCall(_s1.getExitSequence(), 2, _s1.getExitAction());
+
+	}
+
+
+	
+
+	@Test public void testStateReaction_SimpleFlatTSC() {
+		SimpleFlatTSC tsc = new SimpleFlatTSC();
+		
+		ExecutionFlow flow = sequencer.transform(tsc.sc);
+
+		// test state with one outgoing transition
+		ExecutionState s1 = flow.getStates().get(0);
+		ExecutionState s2 = flow.getStates().get(1);
+		assertEquals(tsc.s1.getName(), s1.getSimpleName());
+		assertEquals(tsc.s2.getName(), s2.getSimpleName());
+
+		assertEquals(1, s1.getReactions().size());
+		Reaction reaction = s1.getReactions().get(0);
+
+		assertNotNull(reaction.getCheck());
+		
+		assertNotNull(reaction.getEffect());
+		Sequence seq = (Sequence) reaction.getEffect();
+
+		assertCall( seq, 0, s1.getExitSequence());
+		assertCall( seq, 1, s2.getEnterSequence());		
+	}
+	
+	
+	/**
+	 * The transition action must be part of the reaction effect sequence
+	 */
+	@Test public void testStateReaction_WithTransitionAction() {
+		SimpleFlatTSC tsc = new SimpleFlatTSC();
+		VariableDefinition v1 = _createVariableDefinition("v1", Type.INTEGER, tsc.s_scope);
+		ReactionEffect effect = _createReactionEffect(tsc.t1);
+		Assignment assign = _createVariableAssignment(v1, AssignmentOperator.ASSIGN, _createValue("42"), effect); 
+		
+		ExecutionFlow flow = sequencer.transform(tsc.sc);
+
+		// test state with one outgoing transition
+		ExecutionState s1 = flow.getStates().get(0);
+		ExecutionState s2 = flow.getStates().get(1);
+		assertEquals(tsc.s1.getName(), s1.getSimpleName());
+		assertEquals(tsc.s2.getName(), s2.getSimpleName());
+
+		assertEquals(1, s1.getReactions().size());
+		Reaction reaction = s1.getReactions().get(0);
+
+		assertNotNull(reaction.getCheck());
+		
+		assertNotNull(reaction.getEffect());
+		Sequence seq = (Sequence) reaction.getEffect();
+		
+		assertCall(seq, 0, s1.getExitSequence());
+		
+		assertTrue(seq.getSteps().get(1) instanceof Sequence);		
+		Execution _exec = (Execution) ((Sequence)seq.getSteps().get(1)).getSteps().get(0);
+		Assignment _assign = (Assignment) _exec.getStatement();
+		assertNotSame(_assign, assign);
+		assertNotSame(_assign.getVarRef(), assign.getVarRef());
+		assertNotSame(_assign.getVarRef(), v1);
+		
+		assertCall( seq, 2, s2.getEnterSequence());
+	}
+
+		
+	
+	/**
+	 * The exit action must be part of the reaction effect sequence
+	 */
+	@Test public void testStateReaction_WithExitAction() {
+		SimpleFlatTSC tsc = new SimpleFlatTSC();
+
+		VariableDefinition v1 = _createVariableDefinition("v1", Type.INTEGER, tsc.s_scope);
+		LocalReaction exitAction = _createExitAction(tsc.s1);
+		Assignment assign = _createVariableAssignment(v1, AssignmentOperator.ASSIGN, _createValue("21"), (ReactionEffect) exitAction.getEffect());
+
+		ExecutionFlow flow = sequencer.transform(tsc.sc);
+		
+		
+		// test state with one outgoing transition
+		ExecutionState _s1 = flow.getStates().get(0);
+		ExecutionState _s2 = flow.getStates().get(1);
+		assertEquals(tsc.s1.getName(), _s1.getSimpleName());
+		assertEquals(tsc.s2.getName(), _s2.getSimpleName());
+
+		assertEquals(1, _s1.getReactions().size());
+		Reaction reaction = _s1.getReactions().get(0);
+
+		assertNotNull(reaction.getCheck());
+		
+		assertNotNull(reaction.getEffect());
+		Sequence seq = (Sequence) reaction.getEffect();
+
+		assertCall(seq, 0, _s1.getExitSequence());
+		assertCall(_s1.getExitSequence(), 1, _s1.getExitAction());			
+	}
+	
+	
+	/**
+	 * The exit action must be part of the reaction effect sequence
+	 */
+	@Test public void testStateReaction_WithEntryAction() {
+		SimpleFlatTSC tsc = new SimpleFlatTSC();
+
+		VariableDefinition v1 = _createVariableDefinition("v1", Type.INTEGER, tsc.s_scope);
+		LocalReaction entryAction = _createEntryAction(tsc.s2);
+		Assignment assign = _createVariableAssignment(v1, AssignmentOperator.ASSIGN, _createValue("21"), (ReactionEffect) entryAction.getEffect());
+
+		
+		ExecutionFlow flow = sequencer.transform(tsc.sc);
+		
+		
+		// test state with one outgoing transition
+		ExecutionState _s1 = flow.getStates().get(0);
+		ExecutionState _s2 = flow.getStates().get(1);
+		assertEquals(tsc.s1.getName(), _s1.getSimpleName());
+		assertEquals(tsc.s2.getName(), _s2.getSimpleName());
+
+		assertEquals(1, _s1.getReactions().size());
+		Reaction reaction = _s1.getReactions().get(0);
+
+		assertNotNull(reaction.getCheck());
+		
+		assertNotNull(reaction.getEffect());
+		Sequence seq = (Sequence) reaction.getEffect();
+		assertEquals(2,	seq.getSteps().size());
+
+
+		assertCall(seq, 0, _s1.getExitSequence());
+		assertCall(seq, 1, _s2.getEnterSequence());
+		assertCall(_s2.getEnterSequence(), 0, _s2.getEntryAction());
+	}
+	
+
+	@Test public void testStateCycle() {
+		OrthogonalFlatTSC tsc = new OrthogonalFlatTSC();
+		
+		ExecutionFlow flow = sequencer.transform(tsc.sc);
+
+		// test state with one outgoing transition
+		ExecutionState s1 = flow.getStates().get(0);
+		ExecutionState s2 = flow.getStates().get(1);
+		assertEquals(tsc.s1.getName(), s1.getSimpleName());
+		assertEquals(tsc.s2.getName(), s2.getSimpleName());
+		assertNotNull(s1.getCycle());
+		
+		If _if = (If) s1.getCycle().getSteps().get(0);
+		assertNotNull(_if.getThenStep());
+		assertTrue(_if.getThenStep() instanceof Call);
+		assertNull(_if.getElseStep());
+
+		Call seq = (Call) _if.getThenStep();
+		assertEquals(s1.getReactions().get(0).getEffect(), seq.getStep());
+		
+//		assertTrue(seq.getSteps().get(0) instanceof ExitState);
+//		assertEquals(s1, ((ExitState)seq.getSteps().get(0)).getState());
+//		assertTrue(seq.getSteps().get(1) instanceof EnterState);
+//		assertEquals(s2, ((EnterState)seq.getSteps().get(1)).getState());
+//
+		
+		// test state with two outgoing transitions
+		ExecutionState s3 = flow.getStates().get(2);
+		assertEquals(tsc.s3.getName(), s3.getSimpleName());
+		assertNotNull(s3.getCycle());
+		
+		_if = (If) s3.getCycle().getSteps().get(0);
+		assertNotNull(_if.getThenStep());
+		assertTrue(_if.getThenStep() instanceof Call);
+		assertNotNull(_if.getElseStep());
+		assertTrue(_if.getElseStep() instanceof If);
+
+
+	}
+	
+
+	@Test public void testStateCycle_WithLocalReactions() {
+		SimpleFlatTSC tsc = new SimpleFlatTSC();
+
+		VariableDefinition v1 = _createVariableDefinition("v1", Type.INTEGER, tsc.s_scope);
+
+		// the first local reaction conforms to "e1 / x=42;" 
+		LocalReaction lr1 = _createLocalReaction(tsc.s1, null);
+		_createRegularEventSpec(tsc.e1, (ReactionTrigger) lr1.getTrigger());
+		ReactionEffect lr1_eff = _createReactionEffect(lr1);
+		Assignment assign1 = _createVariableAssignment(v1, AssignmentOperator.ASSIGN, _createValue("42"), lr1_eff); 
+
+		// the secont local reaction conforms to "e1 [x==42] / x=0;" 
+		LocalReaction lr2 = _createLocalReaction(tsc.s1, null);
+		_createRegularEventSpec(tsc.e1, (ReactionTrigger) lr2.getTrigger());
+		LogicalRelationExpression lr2_equals = StextFactory.eINSTANCE.createLogicalRelationExpression();
+		lr2_equals.setOperator(RelationalOperator.EQUALS);
+		ElementReferenceExpression lr2_varRef = StextFactory.eINSTANCE.createElementReferenceExpression();
+		lr2_varRef.setValue(v1);
+		PrimitiveValueExpression lr2_value = _createValue("42");
+		lr2_equals.setLeftOperand(lr2_varRef);
+		lr2_equals.setRightOperand(lr2_value);
+		((ReactionTrigger) lr2.getTrigger()).setGuardExpression(lr2_equals);
+		ReactionEffect lr2_eff = _createReactionEffect(lr2);
+		Assignment assign2 = _createVariableAssignment(v1, AssignmentOperator.ASSIGN, _createValue("0"), lr2_eff); 
+
+		// the third local reaction conforms to: "[x==0] / x=1;"
+		LocalReaction lr3 = _createLocalReaction(tsc.s1, null);
+		LogicalRelationExpression lr3_equals = StextFactory.eINSTANCE.createLogicalRelationExpression();
+		lr3_equals.setOperator(RelationalOperator.EQUALS);
+		ElementReferenceExpression lr3_varRef = StextFactory.eINSTANCE.createElementReferenceExpression();
+		lr3_varRef.setValue(v1);
+		PrimitiveValueExpression lr3_value = _createValue("0");
+		lr3_equals.setLeftOperand(lr3_varRef);
+		lr3_equals.setRightOperand(lr3_value);
+		((ReactionTrigger) lr3.getTrigger()).setGuardExpression(lr3_equals);
+		ReactionEffect lr3_eff = _createReactionEffect(lr3);
+		Assignment assign3 = _createVariableAssignment(v1, AssignmentOperator.ASSIGN, _createValue("1"), lr3_eff); 
+		
+		
+		ExecutionFlow flow = sequencer.transform(tsc.sc);
+
+		// test state with one outgoing transition
+		ExecutionState s1 = flow.getStates().get(0);
+		ExecutionState s2 = flow.getStates().get(1);
+		assertEquals(tsc.s1.getName(), s1.getSimpleName());
+		assertEquals(tsc.s2.getName(), s2.getSimpleName());
+		
+		assertEquals(4, s1.getReactions().size());
+		
+		assertNotNull(s1.getCycle());
+		
+		If _if = (If) s1.getCycle().getSteps().get(0);
+		assertNotNull(_if.getThenStep());
+		assertTrue(_if.getThenStep() instanceof Call);
+		assertNotNull(_if.getElseStep());
+
+		Sequence _seq = (Sequence) _if.getElseStep();
+		assertEquals(3, _seq.getSteps().size());
+		
+		// check first local reaction
+		If _lr1 = (If) _seq.getSteps().get(0);
+		assertTrue(_lr1.getCheck().getCondition() instanceof ElementReferenceExpression);
+		assertSame(s1.getReactions().get(1).getCheck().getCondition(), _lr1.getCheck().getCondition() );
+		Call _lr1_eff_call = (Call) _lr1.getThenStep();
+		assertSame(s1.getReactions().get(1).getEffect(), _lr1_eff_call.getStep() );
+		
+		// check second local reaction
+		If _lr2 = (If) _seq.getSteps().get(1);
+		assertTrue(_lr2.getCheck().getCondition() instanceof LogicalAndExpression);
+		assertSame(s1.getReactions().get(2).getCheck().getCondition(), _lr2.getCheck().getCondition() );
+		Call _lr2_eff_call = (Call) _lr2.getThenStep();
+		assertSame(s1.getReactions().get(2).getEffect(), _lr2_eff_call.getStep() );
+
+		// check the third local reaction
+		If _lr3 = (If) _seq.getSteps().get(2);
+		assertTrue(_lr3.getCheck().getCondition() instanceof LogicalRelationExpression);
+		assertSame(s1.getReactions().get(3).getCheck().getCondition(), _lr3.getCheck().getCondition() );
+		Call _lr3_eff_call = (Call) _lr3.getThenStep();
+		assertSame(s1.getReactions().get(3).getEffect(), _lr3_eff_call.getStep() );
+						
+	}
+	
+	
+	/**
+	 * The cycle sequence of a state that only consists of local reactions includes sequential processing of the 
+	 * local reactions.
+	 */
+	@Test public void testStateCycle_WithLocalReactionsOnly() {
+		MinimalTSC tsc = new MinimalTSC();
+
+		VariableDefinition v1 = _createVariableDefinition("v1", Type.INTEGER, tsc.s_scope);
+
+		// the first local reaction conforms to "e1 / x=42;" 
+		LocalReaction lr1 = _createLocalReaction(tsc.s1, null);
+		_createRegularEventSpec(tsc.e1, (ReactionTrigger) lr1.getTrigger());
+		ReactionEffect lr1_eff = _createReactionEffect(lr1);
+		Assignment assign1 = _createVariableAssignment(v1, AssignmentOperator.ASSIGN, _createValue("42"), lr1_eff); 
+
+		// the secont local reaction conforms to "e1 [x==42] / x=0;" 
+		LocalReaction lr2 = _createLocalReaction(tsc.s1, null);
+		_createRegularEventSpec(tsc.e1, (ReactionTrigger) lr2.getTrigger());
+		LogicalRelationExpression lr2_equals = StextFactory.eINSTANCE.createLogicalRelationExpression();
+		lr2_equals.setOperator(RelationalOperator.EQUALS);
+		ElementReferenceExpression lr2_varRef = StextFactory.eINSTANCE.createElementReferenceExpression();
+		lr2_varRef.setValue(v1);
+		PrimitiveValueExpression lr2_value = _createValue("42");
+		lr2_equals.setLeftOperand(lr2_varRef);
+		lr2_equals.setRightOperand(lr2_value);
+		((ReactionTrigger) lr2.getTrigger()).setGuardExpression(lr2_equals);
+		ReactionEffect lr2_eff = _createReactionEffect(lr2);
+		Assignment assign2 = _createVariableAssignment(v1, AssignmentOperator.ASSIGN, _createValue("0"), lr2_eff); 
+
+		// the third local reaction conforms to: "[x==0] / x=1;"
+		LocalReaction lr3 = _createLocalReaction(tsc.s1, null);
+		LogicalRelationExpression lr3_equals = StextFactory.eINSTANCE.createLogicalRelationExpression();
+		lr3_equals.setOperator(RelationalOperator.EQUALS);
+		ElementReferenceExpression lr3_varRef = StextFactory.eINSTANCE.createElementReferenceExpression();
+		lr3_varRef.setValue(v1);
+		PrimitiveValueExpression lr3_value = _createValue("0");
+		lr3_equals.setLeftOperand(lr3_varRef);
+		lr3_equals.setRightOperand(lr3_value);
+		((ReactionTrigger) lr3.getTrigger()).setGuardExpression(lr3_equals);
+		ReactionEffect lr3_eff = _createReactionEffect(lr3);
+		Assignment assign3 = _createVariableAssignment(v1, AssignmentOperator.ASSIGN, _createValue("1"), lr3_eff); 
+		
+		
+		ExecutionFlow flow = sequencer.transform(tsc.sc);
+
+		// test state with one outgoing transition
+		ExecutionState s1 = flow.getStates().get(0);
+		assertEquals(tsc.s1.getName(), s1.getSimpleName());
+		
+		assertEquals(3, s1.getReactions().size());
+		
+		assertNotNull(s1.getCycle());
+		
+
+		Sequence _seq = (Sequence) s1.getCycle().getSteps().get(0);
+		assertEquals(3, _seq.getSteps().size());
+		
+		// check first local reaction
+		If _lr1 = (If) _seq.getSteps().get(0);
+		assertTrue(_lr1.getCheck().getCondition() instanceof ElementReferenceExpression);
+		assertSame(s1.getReactions().get(0).getCheck().getCondition(), _lr1.getCheck().getCondition() );
+		Call _lr1_eff_call = (Call) _lr1.getThenStep();
+		assertSame(s1.getReactions().get(0).getEffect(), _lr1_eff_call.getStep() );
+		
+		// check second local reaction
+		If _lr2 = (If) _seq.getSteps().get(1);
+		assertTrue(_lr2.getCheck().getCondition() instanceof LogicalAndExpression);
+		assertSame(s1.getReactions().get(1).getCheck().getCondition(), _lr2.getCheck().getCondition() );
+		Call _lr2_eff_call = (Call) _lr2.getThenStep();
+		assertSame(s1.getReactions().get(1).getEffect(), _lr2_eff_call.getStep() );
+
+		// check the third local reaction
+		If _lr3 = (If) _seq.getSteps().get(2);
+		assertTrue(_lr3.getCheck().getCondition() instanceof LogicalRelationExpression);
+		assertSame(s1.getReactions().get(2).getCheck().getCondition(), _lr3.getCheck().getCondition() );
+		Call _lr3_eff_call = (Call) _lr3.getThenStep();
+		assertSame(s1.getReactions().get(2).getEffect(), _lr3_eff_call.getStep() );
+		
+					
+	}
+
+	/** Entry action behaviors are not directly part of the states cycle steps */
+	@Test public void testStateCycle_EntryActionExclusion() {
+		MinimalTSC tsc = new MinimalTSC();
+
+		VariableDefinition v1 = _createVariableDefinition("v1", Type.INTEGER, tsc.s_scope);
+
+		// add a simple entry action: "entry / x=42;" 
+		LocalReaction lr = _createEntryAction(tsc.s1);
+		ReactionEffect lr_eff = _createReactionEffect(lr);
+		Assignment assign1 = _createVariableAssignment(v1, AssignmentOperator.ASSIGN, _createValue("42"), lr_eff); 
+
+		
+		// TRANSFORM
+		ExecutionFlow flow = sequencer.transform(tsc.sc);
+
+		
+		// test state with one outgoing transition
+		ExecutionState s1 = flow.getStates().get(0);
+		
+		assertEquals(0, s1.getReactions().size());		
+		assertNotNull(s1.getCycle());
+		assertEquals(0, s1.getCycle().getSteps().size());		
+	}
+
+	
+	/** Exit action behaviors are not directly part of the states cycle steps */
+	@Test public void testStateCycle_ExitActionExclusion() {
+		MinimalTSC tsc = new MinimalTSC();
+
+		VariableDefinition v1 = _createVariableDefinition("v1", Type.INTEGER, tsc.s_scope);
+
+		// add a simple entry action: "entry / x=42;" 
+		LocalReaction lr = _createExitAction(tsc.s1);
+		ReactionEffect lr_eff = _createReactionEffect(lr);
+		Assignment assign1 = _createVariableAssignment(v1, AssignmentOperator.ASSIGN, _createValue("42"), lr_eff); 
+
+		
+		// TRANSFORM
+		ExecutionFlow flow = sequencer.transform(tsc.sc);
+
+		
+		// test state with one outgoing transition
+		ExecutionState s1 = flow.getStates().get(0);
+		
+		assertEquals(0, s1.getReactions().size());		
+		assertNotNull(s1.getCycle());
+		assertEquals(0, s1.getCycle().getSteps().size());		
+	}
+
+
+	/** Local reactions that define regular and entry triggers side by side must also be part of the cycle steps. */
+	@Test public void testStateCycle_LocalReactionWithMixedRegularAndEntryTrigger() {
+		MinimalTSC tsc = new MinimalTSC();
+
+		VariableDefinition v1 = _createVariableDefinition("v1", Type.INTEGER, tsc.s_scope);
+
+		// add a simple entry action: "entry / x=42;" 
+		LocalReaction lr = _createEntryAction(tsc.s1);
+		_createRegularEventSpec(tsc.e1, (ReactionTrigger) lr.getTrigger());
+		ReactionEffect lr_eff = _createReactionEffect(lr);
+		Assignment assign1 = _createVariableAssignment(v1, AssignmentOperator.ASSIGN, _createValue("42"), lr_eff); 
+
+		
+		// TRANSFORM
+		ExecutionFlow flow = sequencer.transform(tsc.sc);
+
+		
+		// test state with one outgoing transition
+		ExecutionState s1 = flow.getStates().get(0);
+		
+		assertEquals(1, s1.getReactions().size());		
+		assertNotNull(s1.getCycle());
+		assertEquals(1, s1.getCycle().getSteps().size());	
+	
+		Sequence _seq = (Sequence) s1.getCycle().getSteps().get(0);
+		
+		If _lr1 = (If) _seq.getSteps().get(0);
+		assertTrue(_lr1.getCheck().getCondition() instanceof ElementReferenceExpression);
+		assertSame(s1.getReactions().get(0).getCheck().getCondition(), _lr1.getCheck().getCondition() );
+		Call _lr1_eff_call = (Call) _lr1.getThenStep();
+		assertSame(s1.getReactions().get(0).getEffect(), _lr1_eff_call.getStep() );
+
+	}
+
+	
 }

+ 159 - 0
test-plugins/org.yakindu.sct.model.sexec.test/src/org/yakindu/sct/model/sexec/transformation/test/ModelSequencerStateVectorTest.java

@@ -0,0 +1,159 @@
+package org.yakindu.sct.model.sexec.transformation.test;
+
+import static org.junit.Assert.assertEquals;
+import static org.junit.Assert.assertNotNull;
+import static org.yakindu.sct.model.sexec.transformation.test.SCTTestUtil._createEntry;
+import static org.yakindu.sct.model.sexec.transformation.test.SCTTestUtil._createRegion;
+import static org.yakindu.sct.model.sexec.transformation.test.SCTTestUtil._createState;
+import static org.yakindu.sct.model.sexec.transformation.test.SCTTestUtil._createStatechart;
+import static org.yakindu.sct.model.sexec.transformation.test.SCTTestUtil._createTransition;
+
+import org.junit.Test;
+import org.yakindu.sct.model.sexec.ExecutionFlow;
+import org.yakindu.sct.model.sexec.transformation.test.SCTTestUtil.OrthogonalFlatTSC;
+import org.yakindu.sct.model.sexec.transformation.test.SCTTestUtil.SimpleFlatTSC;
+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.State;
+import org.yakindu.sct.model.sgraph.Statechart;
+
+public class ModelSequencerStateVectorTest extends ModelSequencerTest {
+
+	
+
+	/**
+	 * The state vector descriptor of the ExecutionFlow must have an offset of 0 and a size that is 
+	 * the maximum orthogonality of the statechart.
+	 */
+	@Test public void testSCStateVectorFlatNonOrthopgonal() {
+		SimpleFlatTSC tsc = new SimpleFlatTSC();
+		
+		ExecutionFlow flow = sequencer.transform(tsc.sc);
+		
+		assertNotNull(flow.getStateVector());
+		assertEquals(1, flow.getStateVector().getSize());
+		assertEquals(0, flow.getStateVector().getOffset());
+	}
+
+	/**
+	 * The state vector descriptor of the ExecutionFlow must have an offset of 0 and a size that is 
+	 * the maximum orthogonality of the statechart.
+	 */
+	@Test public void testSCStateVectorFlatOrthopgonal() {
+		OrthogonalFlatTSC tsc = new OrthogonalFlatTSC();
+		
+		ExecutionFlow flow = sequencer.transform(tsc.sc);
+		
+		assertNotNull(flow.getStateVector());
+		assertEquals(2, flow.getStateVector().getSize());
+		assertEquals(0, flow.getStateVector().getOffset());
+	}
+
+	
+	/**
+	 * The state vector descriptor of the ExecutionFlow must have an offset of 0 and a size that is 
+	 * the maximum orthogonality of the statechart.
+	 */
+	@Test public void testSCStateVectorDeepNonOrthopgonal() {
+		Statechart sc = _createStatechart("test");
+		Region r = _createRegion("sc_r", sc);
+		State s1 = _createState("s1", r);
+		State s2 = _createState("s2", r);
+		Region s2_r = _createRegion("s2_r", s2);
+		State s2_1 = _createState("s2_1", s2_r);
+		State s2_2 = _createState("s2_2", s2_r);
+		Region s2_1_r = _createRegion("s2_1_r", s2_1);
+		State s2_1_1 = _createState("s2_1_1", s2_1_r);
+		State s2_1_2 = _createState("s2_1_2", s2_1_r);
+
+		ExecutionFlow flow = sequencer.transform(sc);
+		
+		assertNotNull(flow.getStateVector());
+		assertEquals(1, flow.getStateVector().getSize());
+		assertEquals(0, flow.getStateVector().getOffset());
+	}
+
+	
+	/**
+	 * The state vector descriptor of the ExecutionFlow must have an offset of 0 and a size that is 
+	 * the maximum orthogonality of the statechart.
+	 */
+	@Test public void testSCStateVectorDeepOrthopgonal() {
+		Statechart sc = _createStatechart("test");
+		
+		{  // first top region 
+			Region r = _createRegion("sc_r1", sc);
+			State s1 = _createState("s1", r);
+			State s2 = _createState("s2", r);
+			{ // first sub region 
+				Region s2_r = _createRegion("s2_r", s2);
+				State s2_1 = _createState("s2_1", s2_r);
+				State s2_2 = _createState("s2_2", s2_r);
+				{ // first sub sub region
+					Region s2_1_r = _createRegion("s2_1_r", s2_1);
+					State s2_1_1 = _createState("s2_1_1", s2_1_r);
+					State s2_1_2 = _createState("s2_1_2", s2_1_r);
+				}
+				{ // second sub sub region
+					Region s2_2_r = _createRegion("s2_1_r2", s2_1);
+					State s2_1_3 = _createState("s2_1_3", s2_2_r);
+					State s2_1_4 = _createState("s2_2_4", s2_2_r);
+				}
+			}
+		}
+		{  // second top region 
+			Region r = _createRegion("sc_r2", sc);
+			State s1 = _createState("r2_s1", r);
+			State s2 = _createState("r2_s2", r);
+		}
+
+
+		ExecutionFlow flow = sequencer.transform(sc);
+		
+		assertNotNull(flow.getStateVector());
+		assertEquals(3, flow.getStateVector().getSize());
+		assertEquals(0, flow.getStateVector().getOffset());
+	}
+
+	
+	/**
+	 * The state vector descriptor of the ExecutionFlow must have an offset of 0 and a size that is 
+	 * the maximum orthogonality of the statechart.
+	 */
+	@Test public void testSCStateVectorEmptyRegion() {
+		Statechart sc = _createStatechart("test");
+		
+		{  // first top region 
+			Region r = _createRegion("sc_r1", sc);
+		}
+	
+		ExecutionFlow flow = sequencer.transform(sc);
+		
+		assertNotNull(flow.getStateVector());
+		assertEquals(0, flow.getStateVector().getSize());
+		assertEquals(0, flow.getStateVector().getOffset());
+	}
+
+	/**
+	 * The state vector descriptor of the ExecutionFlow must have an offset of 0 and a size that is 
+	 * the maximum orthogonality of the statechart.
+	 */
+	@Test public void testSCStateVectorPseudoStates() {
+		Statechart sc = _createStatechart("test");
+		
+		{  // first top region 
+			Region r = _createRegion("sc_r1", sc);
+			Entry e = _createEntry(EntryKind.INITIAL, null, r);
+			Entry s = _createEntry(null, "s", r);
+			_createTransition(e, s);
+		}
+	
+		ExecutionFlow flow = sequencer.transform(sc);
+		
+		assertNotNull(flow.getStateVector());
+		assertEquals(0, flow.getStateVector().getSize());
+		assertEquals(0, flow.getStateVector().getOffset());
+	}
+	
+}

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

@@ -90,7 +90,7 @@ import com.google.inject.Injector;
 public class ModelSequencerTest extends Assert {
 
 	@Inject
-	private ModelSequencer sequencer;
+	protected ModelSequencer sequencer;
 
 	@Before
 	public void setup() {
@@ -98,900 +98,9 @@ public class ModelSequencerTest extends Assert {
 		injector.injectMembers(this);
 	}
 
-		
-	/**
-	 * The name of the execution flow must be equal to the statechart name.
-	 */
-	@Test public void testFlowName() {
-		Statechart sc = _createStatechart("Test");
-		assertEquals(sc.getName(), sequencer.transform(sc).getName());
-	}
-	
-	
-	/**
-	 * The event refs used in the trigger condition must refer to the event declarations in the flow model 
-	 * and not the sc source model.
-	 */
-	@Test public void testTriggerEventDeclarationIntegrity() {
-
-		Statechart sc = _createStatechart("test");
-		InterfaceScope s_scope = _createInterfaceScope("Interface", sc);
-		EventDefinition e1 = _createEventDefinition("e1", s_scope);
-		Region r = _createRegion("main", sc);
-		State s1 = _createState("S1", r);
-		State s2 = _createState("S2", r);
-		Transition t = _createTransition(s1, s2);
-		ReactionTrigger tr1 = _createReactionTrigger(t);
-		_createRegularEventSpec(e1, tr1);
-
-		ExecutionFlow flow = sequencer.transform(sc);
-
-		EventDefinition _e1 = (EventDefinition) flow.getScopes().get(0).getDeclarations().get(0); 
-		assertNotSame(e1, _e1);
-		assertEquals(e1.getName(), _e1.getName());
-		
-		assertEquals(2, flow.getStates().size());
-		assertEquals(s1.getName(), flow.getStates().get(0).getSimpleName());
-		If _if = (If) flow.getStates().get(0).getCycle().getSteps().get(0);
-
-		ElementReferenceExpression _ere = (ElementReferenceExpression) _if.getCheck().getCondition();
-		assertSame(_e1, _ere.getValue());
-	}
-
-
-	/** 
-	 * the scope name must be mapped.
-	 */
-	@Test public void testScopeName() {
-		InterfaceScope scope = _createInterfaceScope("abc", null);
-		assertEquals(scope.getName(), ((InterfaceScope) sequencer.map(scope)).getName());
-	}
-	
-	/** 
-	 * An InternalScope must be mapped to an InternalScope.
-	 */
-	@Test public void testMapEmptyInternalScope() {
-		InternalScope scope = _createInternalScope(null);
-		Scope _scope = sequencer.map(scope);
-		
-		assertTrue(_scope instanceof InternalScope);
-	}
-	
-	
-	@Test
-	public void testMapScope() {
-
-		InterfaceScope scope = _createInterfaceScope(null, null);
-		EventDefinition e1 = _createEventDefinition("e1", scope);
-		EventDefinition e2 = _createEventDefinition("e2", scope);
-		VariableDefinition v1 = _createVariableDefinition("v1", Type.INTEGER, scope);
-		
-		Scope _scope = sequencer.map(scope);
-
-		assertTrue(_scope instanceof InterfaceScope);
-		assertEquals(3, _scope.getDeclarations().size());
-		
-		
-		for ( int i =0; i<_scope.getDeclarations().size(); i++) {			
-			Declaration s_decl = scope.getDeclarations().get(i);
-			Declaration r_decl = _scope.getDeclarations().get(i);
-			
-			assertNotSame(s_decl, r_decl);	
-			assertEquals(s_decl.getName(), r_decl.getName());	
-			assertEquals(s_decl.getClass(), r_decl.getClass());	
-		}
-	}
-	
-	
-	/**
-	 * In the simplest case the a state without an actions will be entered.
-	 */
-	@Test public void testSCEnterSequence_SimpleFlatTSC() {
-		SimpleFlatTSC tsc = new SimpleFlatTSC();
-		
-		ExecutionFlow flow = sequencer.transform(tsc.sc);
-		
-		assertNotNull(flow.getEnterSequence());
-		assertEquals(1, flow.getEnterSequence().getSteps().size());
-		
-		assertCall(flow.getEnterSequence(), 0, flow.getStates().get(0).getEnterSequence());
-	}
-	
-	
 	
-	
-	/**
-	 * For each top level region a EnterState step must be performed.
-	 */
-	@Test public void testSCEnterSequence_OrthogonalFlatTSC() {
-		OrthogonalFlatTSC tsc = new OrthogonalFlatTSC();
-		
-		ExecutionFlow flow = sequencer.transform(tsc.sc);
-		
-		assertNotNull(flow.getEnterSequence());
-		assertEquals(2, flow.getEnterSequence().getSteps().size());
-
-		assertCall(flow.getEnterSequence(), 0, flow.getStates().get(0).getEnterSequence());
-		assertCall(flow.getEnterSequence(), 1, flow.getStates().get(2).getEnterSequence());
-
-	}
-	
-	
-	
-	@Test public void testStateReaction_SimpleFlatTSC() {
-		SimpleFlatTSC tsc = new SimpleFlatTSC();
-		
-		ExecutionFlow flow = sequencer.transform(tsc.sc);
-
-		// test state with one outgoing transition
-		ExecutionState s1 = flow.getStates().get(0);
-		ExecutionState s2 = flow.getStates().get(1);
-		assertEquals(tsc.s1.getName(), s1.getSimpleName());
-		assertEquals(tsc.s2.getName(), s2.getSimpleName());
-
-		assertEquals(1, s1.getReactions().size());
-		Reaction reaction = s1.getReactions().get(0);
-
-		assertNotNull(reaction.getCheck());
-		
-		assertNotNull(reaction.getEffect());
-		Sequence seq = (Sequence) reaction.getEffect();
-		assertTrue(seq.getSteps().get(0) instanceof ExitState);
-		assertEquals(s1, ((ExitState)seq.getSteps().get(0)).getState());
-		assertTrue(seq.getSteps().get(1) instanceof EnterState);
-		assertEquals(s2, ((EnterState)seq.getSteps().get(1)).getState());
-		
-	}
-	
-	/**
-	 * The transition action must be part of the reaction effect sequence
-	 */
-	@Test public void testStateReaction_WithTransitionAction() {
-		SimpleFlatTSC tsc = new SimpleFlatTSC();
-		VariableDefinition v1 = _createVariableDefinition("v1", Type.INTEGER, tsc.s_scope);
-		ReactionEffect effect = _createReactionEffect(tsc.t1);
-		Assignment assign = _createVariableAssignment(v1, AssignmentOperator.ASSIGN, _createValue("42"), effect); 
-		
-		ExecutionFlow flow = sequencer.transform(tsc.sc);
-
-		// test state with one outgoing transition
-		ExecutionState s1 = flow.getStates().get(0);
-		ExecutionState s2 = flow.getStates().get(1);
-		assertEquals(tsc.s1.getName(), s1.getSimpleName());
-		assertEquals(tsc.s2.getName(), s2.getSimpleName());
-
-		assertEquals(1, s1.getReactions().size());
-		Reaction reaction = s1.getReactions().get(0);
-
-		assertNotNull(reaction.getCheck());
-		
-		assertNotNull(reaction.getEffect());
-		Sequence seq = (Sequence) reaction.getEffect();
-		
-		assertTrue(seq.getSteps().get(0) instanceof ExitState);
-		assertEquals(s1, ((ExitState)seq.getSteps().get(0)).getState());
-		assertTrue(seq.getSteps().get(1) instanceof Sequence);		
-		Execution _exec = (Execution) ((Sequence)seq.getSteps().get(1)).getSteps().get(0);
-		Assignment _assign = (Assignment) _exec.getStatement();
-		assertNotSame(_assign, assign);
-		assertNotSame(_assign.getVarRef(), assign.getVarRef());
-		assertNotSame(_assign.getVarRef(), v1);
-		
-		assertTrue(seq.getSteps().get(2) instanceof EnterState);
-		assertEquals(s2, ((EnterState)seq.getSteps().get(2)).getState());
-	}
-
-		
-	
-	/**
-	 * The exit action must be part of the reaction effect sequence
-	 */
-	@Test public void testStateReaction_WithExitAction() {
-		SimpleFlatTSC tsc = new SimpleFlatTSC();
-
-		VariableDefinition v1 = _createVariableDefinition("v1", Type.INTEGER, tsc.s_scope);
-		LocalReaction exitAction = _createExitAction(tsc.s1);
-		Assignment assign = _createVariableAssignment(v1, AssignmentOperator.ASSIGN, _createValue("21"), (ReactionEffect) exitAction.getEffect());
-
-		ExecutionFlow flow = sequencer.transform(tsc.sc);
-		
-		
-		// test state with one outgoing transition
-		ExecutionState _s1 = flow.getStates().get(0);
-		ExecutionState _s2 = flow.getStates().get(1);
-		assertEquals(tsc.s1.getName(), _s1.getSimpleName());
-		assertEquals(tsc.s2.getName(), _s2.getSimpleName());
-
-		assertEquals(1, _s1.getReactions().size());
-		Reaction reaction = _s1.getReactions().get(0);
-
-		assertNotNull(reaction.getCheck());
-		
-		assertNotNull(reaction.getEffect());
-		Sequence seq = (Sequence) reaction.getEffect();
 
-		Call _exitActionCall = (Call) seq.getSteps().get(0);
-		assertSame( _s1.getExitAction(), _exitActionCall.getStep());	
-
-		assertTrue(seq.getSteps().get(1) instanceof ExitState);
-		assertEquals(_s1, ((ExitState)seq.getSteps().get(1)).getState());
-		
-	}
-	
-	/**
-	 * The exit action must be part of the reaction effect sequence
-	 */
-	@Test public void testStateReaction_WithEntryAction() {
-		SimpleFlatTSC tsc = new SimpleFlatTSC();
-
-		VariableDefinition v1 = _createVariableDefinition("v1", Type.INTEGER, tsc.s_scope);
-		LocalReaction entryAction = _createEntryAction(tsc.s2);
-		Assignment assign = _createVariableAssignment(v1, AssignmentOperator.ASSIGN, _createValue("21"), (ReactionEffect) entryAction.getEffect());
-
-		
-		ExecutionFlow flow = sequencer.transform(tsc.sc);
-		
-		
-		// test state with one outgoing transition
-		ExecutionState _s1 = flow.getStates().get(0);
-		ExecutionState _s2 = flow.getStates().get(1);
-		assertEquals(tsc.s1.getName(), _s1.getSimpleName());
-		assertEquals(tsc.s2.getName(), _s2.getSimpleName());
-
-		assertEquals(1, _s1.getReactions().size());
-		Reaction reaction = _s1.getReactions().get(0);
-
-		assertNotNull(reaction.getCheck());
-		
-		assertNotNull(reaction.getEffect());
-		Sequence seq = (Sequence) reaction.getEffect();
-
-		assertTrue(seq.getSteps().get(0) instanceof ExitState);
-		assertEquals(_s1, ((ExitState)seq.getSteps().get(0)).getState());
-
-		assertTrue(seq.getSteps().get(1) instanceof EnterState);
-		assertEquals(_s2, ((EnterState)seq.getSteps().get(1)).getState());
-
-		Call _entryActionCall = (Call) seq.getSteps().get(2);
-		assertSame( _s2.getEntryAction(), _entryActionCall.getStep());	
-	}
-	
-
-	@Test public void testStateCycle() {
-		OrthogonalFlatTSC tsc = new OrthogonalFlatTSC();
-		
-		ExecutionFlow flow = sequencer.transform(tsc.sc);
-
-		// test state with one outgoing transition
-		ExecutionState s1 = flow.getStates().get(0);
-		ExecutionState s2 = flow.getStates().get(1);
-		assertEquals(tsc.s1.getName(), s1.getSimpleName());
-		assertEquals(tsc.s2.getName(), s2.getSimpleName());
-		assertNotNull(s1.getCycle());
-		
-		If _if = (If) s1.getCycle().getSteps().get(0);
-		assertNotNull(_if.getThenStep());
-		assertTrue(_if.getThenStep() instanceof Call);
-		assertNull(_if.getElseStep());
-
-		Call seq = (Call) _if.getThenStep();
-		assertEquals(s1.getReactions().get(0).getEffect(), seq.getStep());
-		
-//		assertTrue(seq.getSteps().get(0) instanceof ExitState);
-//		assertEquals(s1, ((ExitState)seq.getSteps().get(0)).getState());
-//		assertTrue(seq.getSteps().get(1) instanceof EnterState);
-//		assertEquals(s2, ((EnterState)seq.getSteps().get(1)).getState());
-//
-		
-		// test state with two outgoing transitions
-		ExecutionState s3 = flow.getStates().get(2);
-		assertEquals(tsc.s3.getName(), s3.getSimpleName());
-		assertNotNull(s3.getCycle());
-		
-		_if = (If) s3.getCycle().getSteps().get(0);
-		assertNotNull(_if.getThenStep());
-		assertTrue(_if.getThenStep() instanceof Call);
-		assertNotNull(_if.getElseStep());
-		assertTrue(_if.getElseStep() instanceof If);
-
-
-	}
-	
-
-	@Test public void testStateCycle_WithLocalReactions() {
-		SimpleFlatTSC tsc = new SimpleFlatTSC();
-
-		VariableDefinition v1 = _createVariableDefinition("v1", Type.INTEGER, tsc.s_scope);
-
-		// the first local reaction conforms to "e1 / x=42;" 
-		LocalReaction lr1 = _createLocalReaction(tsc.s1, null);
-		_createRegularEventSpec(tsc.e1, (ReactionTrigger) lr1.getTrigger());
-		ReactionEffect lr1_eff = _createReactionEffect(lr1);
-		Assignment assign1 = _createVariableAssignment(v1, AssignmentOperator.ASSIGN, _createValue("42"), lr1_eff); 
-
-		// the secont local reaction conforms to "e1 [x==42] / x=0;" 
-		LocalReaction lr2 = _createLocalReaction(tsc.s1, null);
-		_createRegularEventSpec(tsc.e1, (ReactionTrigger) lr2.getTrigger());
-		LogicalRelationExpression lr2_equals = StextFactory.eINSTANCE.createLogicalRelationExpression();
-		lr2_equals.setOperator(RelationalOperator.EQUALS);
-		ElementReferenceExpression lr2_varRef = StextFactory.eINSTANCE.createElementReferenceExpression();
-		lr2_varRef.setValue(v1);
-		PrimitiveValueExpression lr2_value = _createValue("42");
-		lr2_equals.setLeftOperand(lr2_varRef);
-		lr2_equals.setRightOperand(lr2_value);
-		((ReactionTrigger) lr2.getTrigger()).setGuardExpression(lr2_equals);
-		ReactionEffect lr2_eff = _createReactionEffect(lr2);
-		Assignment assign2 = _createVariableAssignment(v1, AssignmentOperator.ASSIGN, _createValue("0"), lr2_eff); 
-
-		// the third local reaction conforms to: "[x==0] / x=1;"
-		LocalReaction lr3 = _createLocalReaction(tsc.s1, null);
-		LogicalRelationExpression lr3_equals = StextFactory.eINSTANCE.createLogicalRelationExpression();
-		lr3_equals.setOperator(RelationalOperator.EQUALS);
-		ElementReferenceExpression lr3_varRef = StextFactory.eINSTANCE.createElementReferenceExpression();
-		lr3_varRef.setValue(v1);
-		PrimitiveValueExpression lr3_value = _createValue("0");
-		lr3_equals.setLeftOperand(lr3_varRef);
-		lr3_equals.setRightOperand(lr3_value);
-		((ReactionTrigger) lr3.getTrigger()).setGuardExpression(lr3_equals);
-		ReactionEffect lr3_eff = _createReactionEffect(lr3);
-		Assignment assign3 = _createVariableAssignment(v1, AssignmentOperator.ASSIGN, _createValue("1"), lr3_eff); 
-		
-		
-		ExecutionFlow flow = sequencer.transform(tsc.sc);
-
-		// test state with one outgoing transition
-		ExecutionState s1 = flow.getStates().get(0);
-		ExecutionState s2 = flow.getStates().get(1);
-		assertEquals(tsc.s1.getName(), s1.getSimpleName());
-		assertEquals(tsc.s2.getName(), s2.getSimpleName());
-		
-		assertEquals(4, s1.getReactions().size());
-		
-		assertNotNull(s1.getCycle());
-		
-		If _if = (If) s1.getCycle().getSteps().get(0);
-		assertNotNull(_if.getThenStep());
-		assertTrue(_if.getThenStep() instanceof Call);
-		assertNotNull(_if.getElseStep());
-
-		Sequence _seq = (Sequence) _if.getElseStep();
-		assertEquals(3, _seq.getSteps().size());
-		
-		// check first local reaction
-		If _lr1 = (If) _seq.getSteps().get(0);
-		assertTrue(_lr1.getCheck().getCondition() instanceof ElementReferenceExpression);
-		assertSame(s1.getReactions().get(1).getCheck().getCondition(), _lr1.getCheck().getCondition() );
-		Call _lr1_eff_call = (Call) _lr1.getThenStep();
-		assertSame(s1.getReactions().get(1).getEffect(), _lr1_eff_call.getStep() );
-		
-		// check second local reaction
-		If _lr2 = (If) _seq.getSteps().get(1);
-		assertTrue(_lr2.getCheck().getCondition() instanceof LogicalAndExpression);
-		assertSame(s1.getReactions().get(2).getCheck().getCondition(), _lr2.getCheck().getCondition() );
-		Call _lr2_eff_call = (Call) _lr2.getThenStep();
-		assertSame(s1.getReactions().get(2).getEffect(), _lr2_eff_call.getStep() );
-
-		// check the third local reaction
-		If _lr3 = (If) _seq.getSteps().get(2);
-		assertTrue(_lr3.getCheck().getCondition() instanceof LogicalRelationExpression);
-		assertSame(s1.getReactions().get(3).getCheck().getCondition(), _lr3.getCheck().getCondition() );
-		Call _lr3_eff_call = (Call) _lr3.getThenStep();
-		assertSame(s1.getReactions().get(3).getEffect(), _lr3_eff_call.getStep() );
-						
-	}
-	
-	
-	/**
-	 * The cycle sequence of a state that only consists of local reactions includes sequential processing of the 
-	 * local reactions.
-	 */
-	@Test public void testStateCycle_WithLocalReactionsOnly() {
-		MinimalTSC tsc = new MinimalTSC();
-
-		VariableDefinition v1 = _createVariableDefinition("v1", Type.INTEGER, tsc.s_scope);
-
-		// the first local reaction conforms to "e1 / x=42;" 
-		LocalReaction lr1 = _createLocalReaction(tsc.s1, null);
-		_createRegularEventSpec(tsc.e1, (ReactionTrigger) lr1.getTrigger());
-		ReactionEffect lr1_eff = _createReactionEffect(lr1);
-		Assignment assign1 = _createVariableAssignment(v1, AssignmentOperator.ASSIGN, _createValue("42"), lr1_eff); 
-
-		// the secont local reaction conforms to "e1 [x==42] / x=0;" 
-		LocalReaction lr2 = _createLocalReaction(tsc.s1, null);
-		_createRegularEventSpec(tsc.e1, (ReactionTrigger) lr2.getTrigger());
-		LogicalRelationExpression lr2_equals = StextFactory.eINSTANCE.createLogicalRelationExpression();
-		lr2_equals.setOperator(RelationalOperator.EQUALS);
-		ElementReferenceExpression lr2_varRef = StextFactory.eINSTANCE.createElementReferenceExpression();
-		lr2_varRef.setValue(v1);
-		PrimitiveValueExpression lr2_value = _createValue("42");
-		lr2_equals.setLeftOperand(lr2_varRef);
-		lr2_equals.setRightOperand(lr2_value);
-		((ReactionTrigger) lr2.getTrigger()).setGuardExpression(lr2_equals);
-		ReactionEffect lr2_eff = _createReactionEffect(lr2);
-		Assignment assign2 = _createVariableAssignment(v1, AssignmentOperator.ASSIGN, _createValue("0"), lr2_eff); 
-
-		// the third local reaction conforms to: "[x==0] / x=1;"
-		LocalReaction lr3 = _createLocalReaction(tsc.s1, null);
-		LogicalRelationExpression lr3_equals = StextFactory.eINSTANCE.createLogicalRelationExpression();
-		lr3_equals.setOperator(RelationalOperator.EQUALS);
-		ElementReferenceExpression lr3_varRef = StextFactory.eINSTANCE.createElementReferenceExpression();
-		lr3_varRef.setValue(v1);
-		PrimitiveValueExpression lr3_value = _createValue("0");
-		lr3_equals.setLeftOperand(lr3_varRef);
-		lr3_equals.setRightOperand(lr3_value);
-		((ReactionTrigger) lr3.getTrigger()).setGuardExpression(lr3_equals);
-		ReactionEffect lr3_eff = _createReactionEffect(lr3);
-		Assignment assign3 = _createVariableAssignment(v1, AssignmentOperator.ASSIGN, _createValue("1"), lr3_eff); 
-		
-		
-		ExecutionFlow flow = sequencer.transform(tsc.sc);
-
-		// test state with one outgoing transition
-		ExecutionState s1 = flow.getStates().get(0);
-		assertEquals(tsc.s1.getName(), s1.getSimpleName());
-		
-		assertEquals(3, s1.getReactions().size());
-		
-		assertNotNull(s1.getCycle());
-		
-
-		Sequence _seq = (Sequence) s1.getCycle().getSteps().get(0);
-		assertEquals(3, _seq.getSteps().size());
-		
-		// check first local reaction
-		If _lr1 = (If) _seq.getSteps().get(0);
-		assertTrue(_lr1.getCheck().getCondition() instanceof ElementReferenceExpression);
-		assertSame(s1.getReactions().get(0).getCheck().getCondition(), _lr1.getCheck().getCondition() );
-		Call _lr1_eff_call = (Call) _lr1.getThenStep();
-		assertSame(s1.getReactions().get(0).getEffect(), _lr1_eff_call.getStep() );
-		
-		// check second local reaction
-		If _lr2 = (If) _seq.getSteps().get(1);
-		assertTrue(_lr2.getCheck().getCondition() instanceof LogicalAndExpression);
-		assertSame(s1.getReactions().get(1).getCheck().getCondition(), _lr2.getCheck().getCondition() );
-		Call _lr2_eff_call = (Call) _lr2.getThenStep();
-		assertSame(s1.getReactions().get(1).getEffect(), _lr2_eff_call.getStep() );
-
-		// check the third local reaction
-		If _lr3 = (If) _seq.getSteps().get(2);
-		assertTrue(_lr3.getCheck().getCondition() instanceof LogicalRelationExpression);
-		assertSame(s1.getReactions().get(2).getCheck().getCondition(), _lr3.getCheck().getCondition() );
-		Call _lr3_eff_call = (Call) _lr3.getThenStep();
-		assertSame(s1.getReactions().get(2).getEffect(), _lr3_eff_call.getStep() );
-		
-					
-	}
-
-	/** Entry action behaviors are not directly part of the states cycle steps */
-	@Test public void testStateCycle_EntryActionExclusion() {
-		MinimalTSC tsc = new MinimalTSC();
-
-		VariableDefinition v1 = _createVariableDefinition("v1", Type.INTEGER, tsc.s_scope);
-
-		// add a simple entry action: "entry / x=42;" 
-		LocalReaction lr = _createEntryAction(tsc.s1);
-		ReactionEffect lr_eff = _createReactionEffect(lr);
-		Assignment assign1 = _createVariableAssignment(v1, AssignmentOperator.ASSIGN, _createValue("42"), lr_eff); 
-
-		
-		// TRANSFORM
-		ExecutionFlow flow = sequencer.transform(tsc.sc);
-
-		
-		// test state with one outgoing transition
-		ExecutionState s1 = flow.getStates().get(0);
-		
-		assertEquals(0, s1.getReactions().size());		
-		assertNotNull(s1.getCycle());
-		assertEquals(0, s1.getCycle().getSteps().size());		
-	}
 
 	
-	/** Exit action behaviors are not directly part of the states cycle steps */
-	@Test public void testStateCycle_ExitActionExclusion() {
-		MinimalTSC tsc = new MinimalTSC();
-
-		VariableDefinition v1 = _createVariableDefinition("v1", Type.INTEGER, tsc.s_scope);
-
-		// add a simple entry action: "entry / x=42;" 
-		LocalReaction lr = _createExitAction(tsc.s1);
-		ReactionEffect lr_eff = _createReactionEffect(lr);
-		Assignment assign1 = _createVariableAssignment(v1, AssignmentOperator.ASSIGN, _createValue("42"), lr_eff); 
-
-		
-		// TRANSFORM
-		ExecutionFlow flow = sequencer.transform(tsc.sc);
-
-		
-		// test state with one outgoing transition
-		ExecutionState s1 = flow.getStates().get(0);
-		
-		assertEquals(0, s1.getReactions().size());		
-		assertNotNull(s1.getCycle());
-		assertEquals(0, s1.getCycle().getSteps().size());		
-	}
-
-
-	/** Local reactions that define regular and entry triggers side by side must also be part of the cycle steps. */
-	@Test public void testStateCycle_LocalReactionWithMixedRegularAndEntryTrigger() {
-		MinimalTSC tsc = new MinimalTSC();
-
-		VariableDefinition v1 = _createVariableDefinition("v1", Type.INTEGER, tsc.s_scope);
-
-		// add a simple entry action: "entry / x=42;" 
-		LocalReaction lr = _createEntryAction(tsc.s1);
-		_createRegularEventSpec(tsc.e1, (ReactionTrigger) lr.getTrigger());
-		ReactionEffect lr_eff = _createReactionEffect(lr);
-		Assignment assign1 = _createVariableAssignment(v1, AssignmentOperator.ASSIGN, _createValue("42"), lr_eff); 
-
-		
-		// TRANSFORM
-		ExecutionFlow flow = sequencer.transform(tsc.sc);
-
-		
-		// test state with one outgoing transition
-		ExecutionState s1 = flow.getStates().get(0);
-		
-		assertEquals(1, s1.getReactions().size());		
-		assertNotNull(s1.getCycle());
-		assertEquals(1, s1.getCycle().getSteps().size());	
-	
-		Sequence _seq = (Sequence) s1.getCycle().getSteps().get(0);
-		
-		If _lr1 = (If) _seq.getSteps().get(0);
-		assertTrue(_lr1.getCheck().getCondition() instanceof ElementReferenceExpression);
-		assertSame(s1.getReactions().get(0).getCheck().getCondition(), _lr1.getCheck().getCondition() );
-		Call _lr1_eff_call = (Call) _lr1.getThenStep();
-		assertSame(s1.getReactions().get(0).getEffect(), _lr1_eff_call.getStep() );
-
-	}
-
-	
-
-	
-	/**
-	 * Single trigger events of a Reaction Trigger will be converted into a single condition 
-	 * that consists of a ElementReferenceExpression to the corresponding event definition.
-	 */
-	@Test public void testSingleRegularEventTriggerCondition() {
-
-		EventDefinition e1 = _createEventDefinition("e1", null);
-		ReactionTrigger tr1 = _createReactionTrigger(null);
-		_createRegularEventSpec(e1, tr1);
-
-		Statement s = sequencer.buildCondition(tr1);
-
-		assertTrue(s instanceof ElementReferenceExpression);
-	}
-
-
-	/**
-	 * Multiple trigger events of a ReactionTrigger will be converted to a condition 
-	 * that consists of a ElementReferenceExpressions connected by LogicalOrExpressions.
-	 * 
-	 * e1, e1 -> e1 || e2
-	 * 
-	 */
-	@Test public void testMultipleRegularEventTriggerCondition() {
-
-		EventDefinition e1 = _createEventDefinition("e1", null);
-		EventDefinition e2 = _createEventDefinition("e2", null);
-
-		ReactionTrigger tr1 = _createReactionTrigger(null);
-		_createRegularEventSpec(e1, tr1);
-		_createRegularEventSpec(e2, tr1);
-
-		Statement s = sequencer.buildCondition(tr1);
-
-		assertTrue(s instanceof LogicalOrExpression);
-		assertTrue(((LogicalOrExpression) s).getLeftOperand() instanceof ElementReferenceExpression);
-		assertTrue(((LogicalOrExpression) s).getRightOperand() instanceof ElementReferenceExpression);
-	}
-
-	
-	@Test public void testTransitionCheckSequenceWithoutGuard() {
-
-		EventDefinition e1 = _createEventDefinition("e1", null);
-		EventDefinition e2 = _createEventDefinition("e2", null);
-
-		ReactionTrigger tr1 = _createReactionTrigger(null);
-		_createRegularEventSpec(e1, tr1);
-		_createRegularEventSpec(e2, tr1);
-
-		Transition t = SGraphFactory.eINSTANCE.createTransition();
-		t.setTrigger(tr1);
-
-		Reaction reaction = sequencer.mapTransition(t);
-
-		assertTrue(reaction.getCheck().getCondition() instanceof LogicalOrExpression);
-		assertTrue(((LogicalOrExpression) reaction.getCheck().getCondition()).getLeftOperand() instanceof ElementReferenceExpression);
-		assertTrue(((LogicalOrExpression) reaction.getCheck().getCondition()).getRightOperand() instanceof ElementReferenceExpression);
-
-		assertEquals(e1.getName(),
-				((ElementReferenceExpression)((LogicalOrExpression) reaction.getCheck().getCondition()).getLeftOperand()).getValue().getName());
-		assertEquals(e2.getName(),
-				((ElementReferenceExpression)((LogicalOrExpression) reaction.getCheck().getCondition()).getRightOperand()).getValue().getName());
-	}
-
-	
-	@Test public void testTransitionCheckSequenceWithGuard() {
-
-		EventDefinition e1 = _createEventDefinition("e1", null);
-		EventDefinition e2 = _createEventDefinition("e2", null);
-
-		ReactionTrigger tr1 = _createReactionTrigger(null);
-		_createRegularEventSpec(e1, tr1);
-		_createRegularEventSpec(e2, tr1);
-
-		PrimitiveValueExpression exp = _createValue("false");
-		tr1.setGuardExpression(exp);
-
-		Transition t = SGraphFactory.eINSTANCE.createTransition();
-		t.setTrigger(tr1);
-
-		Reaction reaction = sequencer.mapTransition(t);
-
-		// now check the expression structure ...
-		
-		// the root is an and condition with the trigger check as the first (left) part and the guard as the right (second) part.
-		LogicalAndExpression and = (LogicalAndExpression) reaction.getCheck().getCondition();
-		LogicalOrExpression triggerCheck = (LogicalOrExpression) and.getLeftOperand();
-		PrimitiveValueExpression guardCheck = (PrimitiveValueExpression) and.getRightOperand();
-		
-		assertTrue(triggerCheck.getLeftOperand() instanceof ElementReferenceExpression);
-		assertTrue(triggerCheck.getRightOperand() instanceof ElementReferenceExpression);
-		assertEquals(e1.getName(),
-				((ElementReferenceExpression) triggerCheck.getLeftOperand()).getValue().getName());
-		assertEquals(e2.getName(),
-				((ElementReferenceExpression) triggerCheck.getRightOperand()).getValue().getName());
-		
-		assertEquals(exp.getValue(), guardCheck.getValue());
-	}
-
-	
-	@Test public void testTransitionCheckSequenceWithoutTrigger() {
-
-		ReactionTrigger tr1 = _createReactionTrigger(null);
-		PrimitiveValueExpression exp = _createValue("false");
-		tr1.setGuardExpression(exp);
-
-		Transition t = SGraphFactory.eINSTANCE.createTransition();
-		t.setTrigger(tr1);
-
-		Reaction reaction = sequencer.mapTransition(t);
-
-		// now check the expression structure ...
-		
-		// the root is an and condition with the trigger check as the first (left) part and the guard as the right (second) part.
-		PrimitiveValueExpression guard = (PrimitiveValueExpression) reaction.getCheck().getCondition();
-		assertEquals(exp.getValue(), guard.getValue());
-	}
-
-	
-
-	/**
-	 * The state vector descriptor of the ExecutionFlow must have an offset of 0 and a size that is 
-	 * the maximum orthogonality of the statechart.
-	 */
-	@Test public void testSCStateVectorFlatNonOrthopgonal() {
-		SimpleFlatTSC tsc = new SimpleFlatTSC();
-		
-		ExecutionFlow flow = sequencer.transform(tsc.sc);
-		
-		assertNotNull(flow.getStateVector());
-		assertEquals(1, flow.getStateVector().getSize());
-		assertEquals(0, flow.getStateVector().getOffset());
-	}
-
-	/**
-	 * The state vector descriptor of the ExecutionFlow must have an offset of 0 and a size that is 
-	 * the maximum orthogonality of the statechart.
-	 */
-	@Test public void testSCStateVectorFlatOrthopgonal() {
-		OrthogonalFlatTSC tsc = new OrthogonalFlatTSC();
-		
-		ExecutionFlow flow = sequencer.transform(tsc.sc);
-		
-		assertNotNull(flow.getStateVector());
-		assertEquals(2, flow.getStateVector().getSize());
-		assertEquals(0, flow.getStateVector().getOffset());
-	}
-
-	
-	/**
-	 * The state vector descriptor of the ExecutionFlow must have an offset of 0 and a size that is 
-	 * the maximum orthogonality of the statechart.
-	 */
-	@Test public void testSCStateVectorDeepNonOrthopgonal() {
-		Statechart sc = _createStatechart("test");
-		Region r = _createRegion("sc_r", sc);
-		State s1 = _createState("s1", r);
-		State s2 = _createState("s2", r);
-		Region s2_r = _createRegion("s2_r", s2);
-		State s2_1 = _createState("s2_1", s2_r);
-		State s2_2 = _createState("s2_2", s2_r);
-		Region s2_1_r = _createRegion("s2_1_r", s2_1);
-		State s2_1_1 = _createState("s2_1_1", s2_1_r);
-		State s2_1_2 = _createState("s2_1_2", s2_1_r);
-
-		ExecutionFlow flow = sequencer.transform(sc);
-		
-		assertNotNull(flow.getStateVector());
-		assertEquals(1, flow.getStateVector().getSize());
-		assertEquals(0, flow.getStateVector().getOffset());
-	}
-
-	
-	/**
-	 * The state vector descriptor of the ExecutionFlow must have an offset of 0 and a size that is 
-	 * the maximum orthogonality of the statechart.
-	 */
-	@Test public void testSCStateVectorDeepOrthopgonal() {
-		Statechart sc = _createStatechart("test");
-		
-		{  // first top region 
-			Region r = _createRegion("sc_r1", sc);
-			State s1 = _createState("s1", r);
-			State s2 = _createState("s2", r);
-			{ // first sub region 
-				Region s2_r = _createRegion("s2_r", s2);
-				State s2_1 = _createState("s2_1", s2_r);
-				State s2_2 = _createState("s2_2", s2_r);
-				{ // first sub sub region
-					Region s2_1_r = _createRegion("s2_1_r", s2_1);
-					State s2_1_1 = _createState("s2_1_1", s2_1_r);
-					State s2_1_2 = _createState("s2_1_2", s2_1_r);
-				}
-				{ // second sub sub region
-					Region s2_2_r = _createRegion("s2_1_r2", s2_1);
-					State s2_1_3 = _createState("s2_1_3", s2_2_r);
-					State s2_1_4 = _createState("s2_2_4", s2_2_r);
-				}
-			}
-		}
-		{  // second top region 
-			Region r = _createRegion("sc_r2", sc);
-			State s1 = _createState("r2_s1", r);
-			State s2 = _createState("r2_s2", r);
-		}
-
-
-		ExecutionFlow flow = sequencer.transform(sc);
-		
-		assertNotNull(flow.getStateVector());
-		assertEquals(3, flow.getStateVector().getSize());
-		assertEquals(0, flow.getStateVector().getOffset());
-	}
-
-	
-	/**
-	 * The state vector descriptor of the ExecutionFlow must have an offset of 0 and a size that is 
-	 * the maximum orthogonality of the statechart.
-	 */
-	@Test public void testSCStateVectorEmptyRegion() {
-		Statechart sc = _createStatechart("test");
-		
-		{  // first top region 
-			Region r = _createRegion("sc_r1", sc);
-		}
-	
-		ExecutionFlow flow = sequencer.transform(sc);
-		
-		assertNotNull(flow.getStateVector());
-		assertEquals(0, flow.getStateVector().getSize());
-		assertEquals(0, flow.getStateVector().getOffset());
-	}
-
-	/**
-	 * The state vector descriptor of the ExecutionFlow must have an offset of 0 and a size that is 
-	 * the maximum orthogonality of the statechart.
-	 */
-	@Test public void testSCStateVectorPseudoStates() {
-		Statechart sc = _createStatechart("test");
-		
-		{  // first top region 
-			Region r = _createRegion("sc_r1", sc);
-			Entry e = _createEntry(EntryKind.INITIAL, null, r);
-			Entry s = _createEntry(null, "s", r);
-			_createTransition(e, s);
-		}
-	
-		ExecutionFlow flow = sequencer.transform(sc);
-		
-		assertNotNull(flow.getStateVector());
-		assertEquals(0, flow.getStateVector().getSize());
-		assertEquals(0, flow.getStateVector().getOffset());
-	}
-	
-	
-	/**
-	 * If a time trigger is defined for a transition then an event must be introduced into the execution flow.
-	 */
-	@Test public void testSingleTransitionTimeTrigger() {
-		
-		Statechart sc = _createStatechart("test");
-		Scope scope = _createInterfaceScope("interface", sc);
-		VariableDefinition v1 = _createVariableDefinition("v1", Type.INTEGER, scope);
-		Region r = _createRegion("main", sc);
-		State s= _createState("s", r);
-
-		Transition t = _createTransition(s, s);
-		ReactionTrigger tr1 = _createReactionTrigger(t);
-		_createTimeEventSpec(TimeEventType.AFTER, 1, TimeUnit.SECOND, tr1);
-
-		Assignment assign = _createVariableAssignment(v1, AssignmentOperator.ASSIGN, _createValue("42"), (ReactionEffect) t.getEffect());
-		
-		ExecutionFlow flow = sequencer.transform(sc);
-		
-		// assert definition of time event
-		Scope timerScope = flow.getScopes().get(1);
-		assertTrue(timerScope.getDeclarations().get(0) instanceof TimeEvent);
-		
-		TimeEvent te = (TimeEvent) timerScope.getDeclarations().get(0);
-		
-		// assert that the reaction check checks the time event
-		assertEquals(1, flow.getStates().size());
-		ExecutionState _s = flow.getStates().get(0);
-		assertEquals(s.getName(), _s.getSimpleName());
-		If _if = (If) flow.getStates().get(0).getCycle().getSteps().get(0);
-
-		ElementReferenceExpression _ere = (ElementReferenceExpression) _if.getCheck().getCondition();
-		assertSame(te, _ere.getValue());
-		
-		// assert the scheduling of the time event during state entry
-		assertNotNull(_s.getEntryAction());
-		Sequence entryAction = (Sequence) _s.getEntryAction();
-		ScheduleTimeEvent ste = (ScheduleTimeEvent) entryAction.getSteps().get(0);
-		assertSame(te, ste.getTimeEvent());
-		NumericalMultiplyDivideExpression multiply = (NumericalMultiplyDivideExpression) ste.getTimeValue();
-		assertEquals("1", ((PrimitiveValueExpression)multiply.getLeftOperand()).getValue());
-		assertEquals("1000", ((PrimitiveValueExpression)multiply.getRightOperand()).getValue());
-		assertEquals(MultiplicativeOperator.MUL, multiply.getOperator());
-						
-		// assert the unscheduling of the time events during state exit
-		assertNotNull(_s.getExitAction());
-		Sequence exitAction = (Sequence) _s.getExitAction();
-		UnscheduleTimeEvent ute = (UnscheduleTimeEvent) exitAction.getSteps().get(0);
-		assertSame(te, ute.getTimeEvent());
-	}
-
-	/**
-	 * 
-	 */
-	@Test public void testSingleLocalTimeTrigger() {
-		
-		Statechart sc = _createStatechart("test");
-		Scope scope = _createInterfaceScope("interface", sc);
-		VariableDefinition v1 = _createVariableDefinition("v1", Type.INTEGER, scope);
-		Region r = _createRegion("main", sc);
-		State s= _createState("s", r);
-
-		LocalReaction timeTriggeredReaction = _createTimeTriggeredReaction(s, TimeEventType.AFTER, 2, TimeUnit.MILLISECOND);
-		Assignment assign = _createVariableAssignment(v1, AssignmentOperator.ASSIGN, _createValue("42"), (ReactionEffect) timeTriggeredReaction.getEffect());
-		
-		ExecutionFlow flow = sequencer.transform(sc);
-		
-		Scope timerScope = flow.getScopes().get(1);
-		assertTrue(timerScope.getDeclarations().get(0) instanceof TimeEvent);
-		
-		TimeEvent te = (TimeEvent) timerScope.getDeclarations().get(0);
-		
-		// assert that the reaction check checks the time event
-		ExecutionState _s = flow.getStates().get(0);
-
-		// assert the scheduling of the time event during state entry
-		assertNotNull(_s.getEntryAction());
-		Sequence entryAction = (Sequence) _s.getEntryAction();
-		ScheduleTimeEvent ste = (ScheduleTimeEvent) entryAction.getSteps().get(0);
-		assertSame(te, ste.getTimeEvent());
-		PrimitiveValueExpression value = (PrimitiveValueExpression) ste.getTimeValue();
-		assertEquals("2", value.getValue());
-		assertNotNull(_s.getExitAction());
-		Sequence exitAction = (Sequence) _s.getExitAction();
-		UnscheduleTimeEvent ute = (UnscheduleTimeEvent) exitAction.getSteps().get(0);
-		assertSame(te, ute.getTimeEvent());
-
-	}
-	
 
 }

+ 114 - 0
test-plugins/org.yakindu.sct.model.sexec.test/src/org/yakindu/sct/model/sexec/transformation/test/ModelSequencertDeclarationsTest.java

@@ -0,0 +1,114 @@
+package org.yakindu.sct.model.sexec.transformation.test;
+
+import static org.junit.Assert.assertEquals;
+import static org.junit.Assert.assertNotSame;
+import static org.junit.Assert.assertSame;
+import static org.junit.Assert.assertTrue;
+import static org.yakindu.sct.model.sexec.transformation.test.SCTTestUtil._createEventDefinition;
+import static org.yakindu.sct.model.sexec.transformation.test.SCTTestUtil._createInterfaceScope;
+import static org.yakindu.sct.model.sexec.transformation.test.SCTTestUtil._createInternalScope;
+import static org.yakindu.sct.model.sexec.transformation.test.SCTTestUtil._createReactionTrigger;
+import static org.yakindu.sct.model.sexec.transformation.test.SCTTestUtil._createRegion;
+import static org.yakindu.sct.model.sexec.transformation.test.SCTTestUtil._createRegularEventSpec;
+import static org.yakindu.sct.model.sexec.transformation.test.SCTTestUtil._createState;
+import static org.yakindu.sct.model.sexec.transformation.test.SCTTestUtil._createStatechart;
+import static org.yakindu.sct.model.sexec.transformation.test.SCTTestUtil._createTransition;
+import static org.yakindu.sct.model.sexec.transformation.test.SCTTestUtil._createVariableDefinition;
+
+import org.junit.Test;
+import org.yakindu.sct.model.sexec.ExecutionFlow;
+import org.yakindu.sct.model.sexec.If;
+import org.yakindu.sct.model.sgraph.Declaration;
+import org.yakindu.sct.model.sgraph.Region;
+import org.yakindu.sct.model.sgraph.Scope;
+import org.yakindu.sct.model.sgraph.State;
+import org.yakindu.sct.model.sgraph.Statechart;
+import org.yakindu.sct.model.sgraph.Transition;
+import org.yakindu.sct.model.stext.stext.ElementReferenceExpression;
+import org.yakindu.sct.model.stext.stext.EventDefinition;
+import org.yakindu.sct.model.stext.stext.InterfaceScope;
+import org.yakindu.sct.model.stext.stext.InternalScope;
+import org.yakindu.sct.model.stext.stext.ReactionTrigger;
+import org.yakindu.sct.model.stext.stext.Type;
+import org.yakindu.sct.model.stext.stext.VariableDefinition;
+
+public class ModelSequencertDeclarationsTest extends ModelSequencerTest {
+
+	
+
+	/** 
+	 * the scope name must be mapped.
+	 */
+	@Test public void testScopeName() {
+		InterfaceScope scope = _createInterfaceScope("abc", null);
+		assertEquals(scope.getName(), ((InterfaceScope) sequencer.map(scope)).getName());
+	}
+	
+	/** 
+	 * An InternalScope must be mapped to an InternalScope.
+	 */
+	@Test public void testMapEmptyInternalScope() {
+		InternalScope scope = _createInternalScope(null);
+		Scope _scope = sequencer.map(scope);
+		
+		assertTrue(_scope instanceof InternalScope);
+	}
+	
+	
+	@Test
+	public void testMapScope() {
+
+		InterfaceScope scope = _createInterfaceScope(null, null);
+		EventDefinition e1 = _createEventDefinition("e1", scope);
+		EventDefinition e2 = _createEventDefinition("e2", scope);
+		VariableDefinition v1 = _createVariableDefinition("v1", Type.INTEGER, scope);
+		
+		Scope _scope = sequencer.map(scope);
+
+		assertTrue(_scope instanceof InterfaceScope);
+		assertEquals(3, _scope.getDeclarations().size());
+		
+		
+		for ( int i =0; i<_scope.getDeclarations().size(); i++) {			
+			Declaration s_decl = scope.getDeclarations().get(i);
+			Declaration r_decl = _scope.getDeclarations().get(i);
+			
+			assertNotSame(s_decl, r_decl);	
+			assertEquals(s_decl.getName(), r_decl.getName());	
+			assertEquals(s_decl.getClass(), r_decl.getClass());	
+		}
+	}
+	
+	/**
+	 * The event refs used in the trigger condition must refer to the event declarations in the flow model 
+	 * and not the sc source model.
+	 */
+	@Test public void testTriggerEventDeclarationIntegrity() {
+
+		Statechart sc = _createStatechart("test");
+		InterfaceScope s_scope = _createInterfaceScope("Interface", sc);
+		EventDefinition e1 = _createEventDefinition("e1", s_scope);
+		Region r = _createRegion("main", sc);
+		State s1 = _createState("S1", r);
+		State s2 = _createState("S2", r);
+		Transition t = _createTransition(s1, s2);
+		ReactionTrigger tr1 = _createReactionTrigger(t);
+		_createRegularEventSpec(e1, tr1);
+
+		ExecutionFlow flow = sequencer.transform(sc);
+
+		EventDefinition _e1 = (EventDefinition) flow.getScopes().get(0).getDeclarations().get(0); 
+		assertNotSame(e1, _e1);
+		assertEquals(e1.getName(), _e1.getName());
+		
+		assertEquals(2, flow.getStates().size());
+		assertEquals(s1.getName(), flow.getStates().get(0).getSimpleName());
+		If _if = (If) flow.getStates().get(0).getCycle().getSteps().get(0);
+
+		ElementReferenceExpression _ere = (ElementReferenceExpression) _if.getCheck().getCondition();
+		assertSame(_e1, _ere.getValue());
+	}
+
+
+
+}

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

@@ -191,13 +191,13 @@ public class SCTTestUtil {
 	}
 	
 	
-	public static void _createExitAssignemnt(VariableDefinition v1, State s1, String value) {
+	public static void _createExitAssignment(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) {
+	public static void _createEntryAssignment(VariableDefinition v1, State s1, String value) {
 		LocalReaction entryAction = _createEntryAction(s1);
 		_createVariableAssignment(v1, AssignmentOperator.ASSIGN, _createValue(value), (ReactionEffect) entryAction.getEffect());
 	}