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

Migrated traffic light example model.
Renamed TimerHandler to TimerService.
Added RuntimeService class. RuntimeService can be used to execute statemachines periodically.
Refactoring of event based statemachine.
Migrated testcases for event based statemachine.

markus.muehlbrandt@itemis.de 14 лет назад
Родитель
Сommit
43ee1c1764
60 измененных файлов с 1430 добавлено и 247 удалено
  1. 1 1
      examples/org.yakindu.sct.generator.java.trafficlight/GenModelJava.sgen
  2. 26 26
      examples/org.yakindu.sct.generator.java.trafficlight/TrafficLightWaiting.sct
  3. 11 13
      plugins/org.yakindu.sct.generator.java/src/org/yakindu/sct/generator/java/templates/CustomCycleBasedStatemachine.xpt
  4. 10 36
      plugins/org.yakindu.sct.generator.java/src/org/yakindu/sct/generator/java/templates/CustomEventBasedStatemachine.xpt
  5. 5 5
      plugins/org.yakindu.sct.generator.java/src/org/yakindu/sct/generator/java/templates/CustomInterface.xpt
  6. 7 8
      plugins/org.yakindu.sct.generator.java/src/org/yakindu/sct/generator/java/templates/CustomInterfaceImpl.xpt
  7. 6 8
      plugins/org.yakindu.sct.generator.java/src/org/yakindu/sct/generator/java/templates/Event.xpt
  8. 2 4
      plugins/org.yakindu.sct.generator.java/src/org/yakindu/sct/generator/java/templates/EventNotification.xpt
  9. 2 3
      plugins/org.yakindu.sct.generator.java/src/org/yakindu/sct/generator/java/templates/Expression.ext
  10. 1 3
      plugins/org.yakindu.sct.generator.java/src/org/yakindu/sct/generator/java/templates/INotificationListener.xpt
  11. 1 3
      plugins/org.yakindu.sct.generator.java/src/org/yakindu/sct/generator/java/templates/INotificationSender.xpt
  12. 1 3
      plugins/org.yakindu.sct.generator.java/src/org/yakindu/sct/generator/java/templates/IStatemachine.xpt
  13. 3 5
      plugins/org.yakindu.sct.generator.java/src/org/yakindu/sct/generator/java/templates/ITimedStatemachine.xpt
  14. 3 5
      plugins/org.yakindu.sct.generator.java/src/org/yakindu/sct/generator/java/templates/ITimerHandler.xpt
  15. 6 5
      plugins/org.yakindu.sct.generator.java/src/org/yakindu/sct/generator/java/templates/Main.xpt
  16. 2 4
      plugins/org.yakindu.sct.generator.java/src/org/yakindu/sct/generator/java/templates/Naming.ext
  17. 1 3
      plugins/org.yakindu.sct.generator.java/src/org/yakindu/sct/generator/java/templates/Notification.xpt
  18. 1 3
      plugins/org.yakindu.sct.generator.java/src/org/yakindu/sct/generator/java/templates/NotificationSender.xpt
  19. 1 3
      plugins/org.yakindu.sct.generator.java/src/org/yakindu/sct/generator/java/templates/NotificationType.xpt
  20. 71 0
      plugins/org.yakindu.sct.generator.java/src/org/yakindu/sct/generator/java/templates/RuntimeService.xpt
  21. 3 5
      plugins/org.yakindu.sct.generator.java/src/org/yakindu/sct/generator/java/templates/TimeEvent.xpt
  22. 4 5
      plugins/org.yakindu.sct.generator.java/src/org/yakindu/sct/generator/java/templates/TimerHandler.xpt
  23. 1 3
      plugins/org.yakindu.sct.generator.java/src/org/yakindu/sct/generator/java/templates/ValuedEvent.xpt
  24. 5 5
      test-plugins/org.yakindu.sct.generator.java.runtime.test/src-gen/org/yakindu/sct/runtime/java/Event.java
  25. 1 1
      test-plugins/org.yakindu.sct.generator.java.runtime.test/src-gen/org/yakindu/sct/runtime/java/EventNotification.java
  26. 2 2
      test-plugins/org.yakindu.sct.generator.java.runtime.test/src-gen/org/yakindu/sct/runtime/java/ITimedStatemachine.java
  27. 1 1
      test-plugins/org.yakindu.sct.generator.java.runtime.test/src-gen/org/yakindu/sct/runtime/java/ITimerHandler.java
  28. 60 0
      test-plugins/org.yakindu.sct.generator.java.runtime.test/src-gen/org/yakindu/sct/runtime/java/RuntimeService.java
  29. 2 2
      test-plugins/org.yakindu.sct.generator.java.runtime.test/src-gen/org/yakindu/sct/runtime/java/TimeEvent.java
  30. 1 1
      test-plugins/org.yakindu.sct.generator.java.runtime.test/src-gen/org/yakindu/sct/runtime/java/TimerHandler.java
  31. 0 6
      test-plugins/org.yakindu.sct.generator.java.runtime.test/src-gen/org/yakindu/sct/runtime/java/interfacetest/DefaultInterfaceImpl.java
  32. 45 0
      test-plugins/org.yakindu.sct.generator.java.runtime.test/src-gen/org/yakindu/sct/runtime/java/interfacetest/InterfaceTestEventBasedStatemachine.java
  33. 0 6
      test-plugins/org.yakindu.sct.generator.java.runtime.test/src-gen/org/yakindu/sct/runtime/java/interfacetest/InterfaceThirdImpl.java
  34. 8 0
      test-plugins/org.yakindu.sct.generator.java.runtime.test/src-gen/org/yakindu/sct/runtime/java/test_deephistory/DefaultInterface.java
  35. 45 0
      test-plugins/org.yakindu.sct.generator.java.runtime.test/src-gen/org/yakindu/sct/runtime/java/test_deephistory/Test_DeepHistoryEventBasedStatemachine.java
  36. 3 2
      test-plugins/org.yakindu.sct.generator.java.runtime.test/src-gen/org/yakindu/sct/runtime/java/test_expression/DefaultInterface.java
  37. 10 10
      test-plugins/org.yakindu.sct.generator.java.runtime.test/src-gen/org/yakindu/sct/runtime/java/test_expression/DefaultInterfaceImpl.java
  38. 45 0
      test-plugins/org.yakindu.sct.generator.java.runtime.test/src-gen/org/yakindu/sct/runtime/java/test_expression/Test_ExpressionEventBasedStatemachine.java
  39. 15 0
      test-plugins/org.yakindu.sct.generator.java.runtime.test/src-gen/org/yakindu/sct/runtime/java/test_hierarchy/DefaultInterface.java
  40. 45 0
      test-plugins/org.yakindu.sct.generator.java.runtime.test/src-gen/org/yakindu/sct/runtime/java/test_hierarchy/Test_HierarchyEventBasedStatemachine.java
  41. 3 0
      test-plugins/org.yakindu.sct.generator.java.runtime.test/src-gen/org/yakindu/sct/runtime/java/test_localactions/DefaultInterface.java
  42. 13 13
      test-plugins/org.yakindu.sct.generator.java.runtime.test/src-gen/org/yakindu/sct/runtime/java/test_localactions/Test_LocalActionsCycleBasedStatemachine.java
  43. 45 0
      test-plugins/org.yakindu.sct.generator.java.runtime.test/src-gen/org/yakindu/sct/runtime/java/test_localactions/Test_LocalActionsEventBasedStatemachine.java
  44. 5 0
      test-plugins/org.yakindu.sct.generator.java.runtime.test/src-gen/org/yakindu/sct/runtime/java/test_parallelregions/DefaultInterface.java
  45. 45 0
      test-plugins/org.yakindu.sct.generator.java.runtime.test/src-gen/org/yakindu/sct/runtime/java/test_parallelregions/Test_ParallelRegionsEventBasedStatemachine.java
  46. 7 0
      test-plugins/org.yakindu.sct.generator.java.runtime.test/src-gen/org/yakindu/sct/runtime/java/test_shallowhistory/DefaultInterface.java
  47. 45 0
      test-plugins/org.yakindu.sct.generator.java.runtime.test/src-gen/org/yakindu/sct/runtime/java/test_shallowhistory/Test_ShallowHistoryEventBasedStatemachine.java
  48. 1 1
      test-plugins/org.yakindu.sct.generator.java.runtime.test/src-gen/org/yakindu/sct/runtime/java/test_transition/DefaultInterface.java
  49. 0 4
      test-plugins/org.yakindu.sct.generator.java.runtime.test/src-gen/org/yakindu/sct/runtime/java/test_transition/DefaultInterfaceImpl.java
  50. 2 1
      test-plugins/org.yakindu.sct.generator.java.runtime.test/src-gen/org/yakindu/sct/runtime/java/test_transition/InterfaceA.java
  51. 0 4
      test-plugins/org.yakindu.sct.generator.java.runtime.test/src-gen/org/yakindu/sct/runtime/java/test_transition/InterfaceAImpl.java
  52. 28 28
      test-plugins/org.yakindu.sct.generator.java.runtime.test/src-gen/org/yakindu/sct/runtime/java/test_transition/Test_TransitionCycleBasedStatemachine.java
  53. 45 0
      test-plugins/org.yakindu.sct.generator.java.runtime.test/src-gen/org/yakindu/sct/runtime/java/test_transition/Test_TransitionEventBasedStatemachine.java
  54. 25 0
      test-plugins/org.yakindu.sct.generator.java.runtime.test/src/org/yakindu/sct/generator/java/runtime/test/AllEventBasedStatemachineTests.java
  55. 3 3
      test-plugins/org.yakindu.sct.generator.java.runtime.test/src/org/yakindu/sct/generator/java/runtime/test/TestExpressionCycleBasedStatemachine.java
  56. 103 0
      test-plugins/org.yakindu.sct.generator.java.runtime.test/src/org/yakindu/sct/generator/java/runtime/test/TestExpressionEventBasedStatemachine.java
  57. 164 0
      test-plugins/org.yakindu.sct.generator.java.runtime.test/src/org/yakindu/sct/generator/java/runtime/test/TestHierarchyEventBasedStatemachine.java
  58. 275 0
      test-plugins/org.yakindu.sct.generator.java.runtime.test/src/org/yakindu/sct/generator/java/runtime/test/TestInterfaceTestEventBasedStatemachine.java
  59. 3 3
      test-plugins/org.yakindu.sct.generator.java.runtime.test/src/org/yakindu/sct/generator/java/runtime/test/TestLocalActionsCycleBasedStatemachine.java
  60. 161 0
      test-plugins/org.yakindu.sct.generator.java.runtime.test/src/org/yakindu/sct/generator/java/runtime/test/TestLocalActionsEventBasedStatemachine.java

+ 1 - 1
examples/org.yakindu.sct.generator.java.trafficlight/GenModelJava.sgen

@@ -1,4 +1,4 @@
-GeneratorModel for yakindu::java {
+	GeneratorModel for yakindu::java {
 	statechart TrafficLightWaiting {
 
 		feature Outlet {

+ 26 - 26
examples/org.yakindu.sct.generator.java.trafficlight/TrafficLightWaiting.sct

@@ -1,6 +1,6 @@
 <?xml version="1.0" encoding="UTF-8"?>
 <xmi:XMI xmi:version="2.0" xmlns:xmi="http://www.omg.org/XMI" xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" xmlns:notation="http://www.eclipse.org/gmf/runtime/1.0.2/notation" xmlns:sgraph="http://www.yakindu.org/sct/sgraph/2.0.0" xmlns:stext="http://www.yakindu.org/sct/statechart/SText">
-  <sgraph:Statechart xmi:id="_NPjBgBA-EeGQ0KsLDV4EFg" name="TrafficLightWaiting" expression="interface TrafficLight:&#xD;&#xA;&#x9;var red:boolean&#xD;&#xA;&#x9;var yellow:boolean&#xD;&#xA;&#x9;var green:boolean&#xD;&#xA;&#xD;&#xA;interface Pedestrian:&#xD;&#xA;&#x9;var request:boolean&#xD;&#xA;&#x9;var red:boolean&#xD;&#xA;&#x9;var green:boolean&#xD;&#xA;&#xD;&#xA;interface:&#xD;&#xA;&#x9;in event keypress1&#xD;&#xA;&#x9;in event keypress2">
+  <sgraph:Statechart xmi:id="_NPjBgBA-EeGQ0KsLDV4EFg" name="TrafficLightWaiting" specification="interface TrafficLight:&#xD;&#xA;&#x9;var red:boolean&#xD;&#xA;&#x9;var yellow:boolean&#xD;&#xA;&#x9;var green:boolean&#xD;&#xA;&#xD;&#xA;interface Pedestrian:&#xD;&#xA;&#x9;var request:boolean&#xD;&#xA;&#x9;var red:boolean&#xD;&#xA;&#x9;var green:boolean&#xD;&#xA;&#xD;&#xA;interface:&#xD;&#xA;&#x9;in event keypress1&#xD;&#xA;&#x9;in event keypress2">
     <scopes xsi:type="stext:InterfaceScope" xmi:id="_TnWbMBzuEeGEC4raFz1JbQ" name="TrafficLight">
       <declarations xsi:type="stext:VariableDefinition" xmi:id="_TnWbMRzuEeGEC4raFz1JbQ" name="red" type="boolean"/>
       <declarations xsi:type="stext:VariableDefinition" xmi:id="_TnWbMhzuEeGEC4raFz1JbQ" name="yellow" type="boolean"/>
@@ -21,13 +21,13 @@
       </vertices>
       <vertices xsi:type="sgraph:State" xmi:id="_NPjBmBA-EeGQ0KsLDV4EFg" name="on" incomingTransitions="_NPsyhxA-EeGQ0KsLDV4EFg __OsQsBBPEeGQ0KsLDV4EFg">
         <scopes xmi:id="_TnasoBzuEeGEC4raFz1JbQ"/>
-        <outgoingTransitions xmi:id="_XlIREBBFEeGQ0KsLDV4EFg" expression="keypress2" target="_MF4mkBBFEeGQ0KsLDV4EFg">
+        <outgoingTransitions xmi:id="_XlIREBBFEeGQ0KsLDV4EFg" specification="keypress2" target="_MF4mkBBFEeGQ0KsLDV4EFg">
           <trigger xsi:type="stext:ReactionTrigger" xmi:id="_TnbTsBzuEeGEC4raFz1JbQ">
             <triggers xsi:type="stext:RegularEventSpec" xmi:id="_TnbTsRzuEeGEC4raFz1JbQ" event="_TnWbOhzuEeGEC4raFz1JbQ"/>
           </trigger>
         </outgoingTransitions>
         <regions xmi:id="_vZz18BA_EeGQ0KsLDV4EFg" name="r1">
-          <vertices xsi:type="sgraph:State" xmi:id="_w8meYBA_EeGQ0KsLDV4EFg" expression="entry / TrafficLight.red = false; &#xD;&#xA;&#x9;TrafficLight.yellow = false;&#xD;&#xA;&#x9;TrafficLight.green = true;&#xD;&#xA;&#x9;Pedestrian.red = true;&#xD;&#xA;&#x9;Pedestrian.green = false;&#xD;&#xA;&#x9;Pedestrian.request = false;" name="StreetGreen" incomingTransitions="_pddaABBEEeGQ0KsLDV4EFg _yYuD0BBPEeGQ0KsLDV4EFg">
+          <vertices xsi:type="sgraph:State" xmi:id="_w8meYBA_EeGQ0KsLDV4EFg" specification="entry / TrafficLight.red = false; &#xD;&#xA;&#x9;TrafficLight.yellow = false;&#xD;&#xA;&#x9;TrafficLight.green = true;&#xD;&#xA;&#x9;Pedestrian.red = true;&#xD;&#xA;&#x9;Pedestrian.green = false;&#xD;&#xA;&#x9;Pedestrian.request = false;" name="StreetGreen" incomingTransitions="_pddaABBEEeGQ0KsLDV4EFg _yYuD0BBPEeGQ0KsLDV4EFg">
             <scopes xmi:id="_Tne-EBzuEeGEC4raFz1JbQ">
               <declarations xsi:type="stext:LocalReaction" xmi:id="_Tne-ERzuEeGEC4raFz1JbQ">
                 <trigger xsi:type="stext:ReactionTrigger" xmi:id="_Tne-EhzuEeGEC4raFz1JbQ">
@@ -67,13 +67,13 @@
                 </effect>
               </declarations>
             </scopes>
-            <outgoingTransitions xmi:id="_Lo2CEBBBEeGQ0KsLDV4EFg" expression="keypress1" target="_iAKe0BBAEeGQ0KsLDV4EFg">
+            <outgoingTransitions xmi:id="_Lo2CEBBBEeGQ0KsLDV4EFg" specification="keypress1" target="_iAKe0BBAEeGQ0KsLDV4EFg">
               <trigger xsi:type="stext:ReactionTrigger" xmi:id="_Tn08UBzuEeGEC4raFz1JbQ">
                 <triggers xsi:type="stext:RegularEventSpec" xmi:id="_Tn08URzuEeGEC4raFz1JbQ" event="_TnWbORzuEeGEC4raFz1JbQ"/>
               </trigger>
             </outgoingTransitions>
           </vertices>
-          <vertices xsi:type="sgraph:State" xmi:id="_iAKe0BBAEeGQ0KsLDV4EFg" expression="exit / Pedestrian.request = false;" name="PedWaiting" incomingTransitions="_Lo2CEBBBEeGQ0KsLDV4EFg">
+          <vertices xsi:type="sgraph:State" xmi:id="_iAKe0BBAEeGQ0KsLDV4EFg" specification="exit / Pedestrian.request = false;" name="PedWaiting" incomingTransitions="_Lo2CEBBBEeGQ0KsLDV4EFg">
             <scopes xmi:id="_Tn3_oBzuEeGEC4raFz1JbQ">
               <declarations xsi:type="stext:LocalReaction" xmi:id="_Tn3_oRzuEeGEC4raFz1JbQ">
                 <trigger xsi:type="stext:ReactionTrigger" xmi:id="_Tn3_ohzuEeGEC4raFz1JbQ">
@@ -88,13 +88,13 @@
                 </effect>
               </declarations>
             </scopes>
-            <outgoingTransitions xmi:id="_LDXEgBBDEeGQ0KsLDV4EFg" expression="after 7s" target="_SKct4BBBEeGQ0KsLDV4EFg">
+            <outgoingTransitions xmi:id="_LDXEgBBDEeGQ0KsLDV4EFg" specification="after 7s" target="_SKct4BBBEeGQ0KsLDV4EFg">
               <trigger xsi:type="stext:ReactionTrigger" xmi:id="_Tn7C8BzuEeGEC4raFz1JbQ">
                 <triggers xsi:type="stext:TimeEventSpec" xmi:id="_Tn7C8RzuEeGEC4raFz1JbQ" value="7"/>
               </trigger>
             </outgoingTransitions>
             <regions xmi:id="_iAKe0hBAEeGQ0KsLDV4EFg" name="r1">
-              <vertices xsi:type="sgraph:State" xmi:id="_mjm00BBAEeGQ0KsLDV4EFg" expression="entry / &#xD;&#xA;Pedestrian.request = true;" name="waitOn" incomingTransitions="_wTHnEBBAEeGQ0KsLDV4EFg _OXpxsBBBEeGQ0KsLDV4EFg">
+              <vertices xsi:type="sgraph:State" xmi:id="_mjm00BBAEeGQ0KsLDV4EFg" specification="entry / &#xD;&#xA;Pedestrian.request = true;" name="waitOn" incomingTransitions="_wTHnEBBAEeGQ0KsLDV4EFg _OXpxsBBBEeGQ0KsLDV4EFg">
                 <scopes xmi:id="_Tn7qABzuEeGEC4raFz1JbQ">
                   <declarations xsi:type="stext:LocalReaction" xmi:id="_Tn7qARzuEeGEC4raFz1JbQ">
                     <trigger xsi:type="stext:ReactionTrigger" xmi:id="_Tn7qAhzuEeGEC4raFz1JbQ">
@@ -109,13 +109,13 @@
                     </effect>
                   </declarations>
                 </scopes>
-                <outgoingTransitions xmi:id="_6LZ60BBAEeGQ0KsLDV4EFg" expression="after 500ms" target="_n6DDUBBAEeGQ0KsLDV4EFg">
+                <outgoingTransitions xmi:id="_6LZ60BBAEeGQ0KsLDV4EFg" specification="after 500ms" target="_n6DDUBBAEeGQ0KsLDV4EFg">
                   <trigger xsi:type="stext:ReactionTrigger" xmi:id="_Tn-tUBzuEeGEC4raFz1JbQ">
                     <triggers xsi:type="stext:TimeEventSpec" xmi:id="_Tn-tURzuEeGEC4raFz1JbQ" value="500" unit="ms"/>
                   </trigger>
                 </outgoingTransitions>
               </vertices>
-              <vertices xsi:type="sgraph:State" xmi:id="_n6DDUBBAEeGQ0KsLDV4EFg" expression="entry / &#xD;&#xA;Pedestrian.request = false;" name="waitOff" incomingTransitions="_6LZ60BBAEeGQ0KsLDV4EFg">
+              <vertices xsi:type="sgraph:State" xmi:id="_n6DDUBBAEeGQ0KsLDV4EFg" specification="entry / &#xD;&#xA;Pedestrian.request = false;" name="waitOff" incomingTransitions="_6LZ60BBAEeGQ0KsLDV4EFg">
                 <scopes xmi:id="_Tn_UYBzuEeGEC4raFz1JbQ">
                   <declarations xsi:type="stext:LocalReaction" xmi:id="_Tn_UYRzuEeGEC4raFz1JbQ">
                     <trigger xsi:type="stext:ReactionTrigger" xmi:id="_Tn_UYhzuEeGEC4raFz1JbQ">
@@ -130,7 +130,7 @@
                     </effect>
                   </declarations>
                 </scopes>
-                <outgoingTransitions xmi:id="_OXpxsBBBEeGQ0KsLDV4EFg" expression="after 500ms" target="_mjm00BBAEeGQ0KsLDV4EFg">
+                <outgoingTransitions xmi:id="_OXpxsBBBEeGQ0KsLDV4EFg" specification="after 500ms" target="_mjm00BBAEeGQ0KsLDV4EFg">
                   <trigger xsi:type="stext:ReactionTrigger" xmi:id="_ToCXsBzuEeGEC4raFz1JbQ">
                     <triggers xsi:type="stext:TimeEventSpec" xmi:id="_ToCXsRzuEeGEC4raFz1JbQ" value="500" unit="ms"/>
                   </trigger>
@@ -141,7 +141,7 @@
               </vertices>
             </regions>
           </vertices>
-          <vertices xsi:type="sgraph:State" xmi:id="_SKct4BBBEeGQ0KsLDV4EFg" expression="entry / TrafficLight.red = false;&#xD;&#xA;&#x9;TrafficLight.yellow = true;&#xD;&#xA;&#x9;TrafficLight.green = false;" name="StreetAttention" incomingTransitions="_LDXEgBBDEeGQ0KsLDV4EFg">
+          <vertices xsi:type="sgraph:State" xmi:id="_SKct4BBBEeGQ0KsLDV4EFg" specification="entry / TrafficLight.red = false;&#xD;&#xA;&#x9;TrafficLight.yellow = true;&#xD;&#xA;&#x9;TrafficLight.green = false;" name="StreetAttention" incomingTransitions="_LDXEgBBDEeGQ0KsLDV4EFg">
             <scopes xmi:id="_ToC-wBzuEeGEC4raFz1JbQ">
               <declarations xsi:type="stext:LocalReaction" xmi:id="_ToC-wRzuEeGEC4raFz1JbQ">
                 <trigger xsi:type="stext:ReactionTrigger" xmi:id="_ToC-whzuEeGEC4raFz1JbQ">
@@ -166,13 +166,13 @@
                 </effect>
               </declarations>
             </scopes>
-            <outgoingTransitions xmi:id="_fS31UBBEEeGQ0KsLDV4EFg" expression="after 2s" target="_fO-pQBBDEeGQ0KsLDV4EFg">
+            <outgoingTransitions xmi:id="_fS31UBBEEeGQ0KsLDV4EFg" specification="after 2s" target="_fO-pQBBDEeGQ0KsLDV4EFg">
               <trigger xsi:type="stext:ReactionTrigger" xmi:id="_ToJscBzuEeGEC4raFz1JbQ">
                 <triggers xsi:type="stext:TimeEventSpec" xmi:id="_ToJscRzuEeGEC4raFz1JbQ" value="2"/>
               </trigger>
             </outgoingTransitions>
           </vertices>
-          <vertices xsi:type="sgraph:State" xmi:id="_fO-pQBBDEeGQ0KsLDV4EFg" expression="entry / TrafficLight.red = true;&#xD;&#xA;TrafficLight.yellow = false;&#xD;&#xA;TrafficLight.green = false;" name="StreetRed" incomingTransitions="_fS31UBBEEeGQ0KsLDV4EFg">
+          <vertices xsi:type="sgraph:State" xmi:id="_fO-pQBBDEeGQ0KsLDV4EFg" specification="entry / TrafficLight.red = true;&#xD;&#xA;TrafficLight.yellow = false;&#xD;&#xA;TrafficLight.green = false;" name="StreetRed" incomingTransitions="_fS31UBBEEeGQ0KsLDV4EFg">
             <scopes xmi:id="_ToKTgBzuEeGEC4raFz1JbQ">
               <declarations xsi:type="stext:LocalReaction" xmi:id="_ToKTgRzuEeGEC4raFz1JbQ">
                 <trigger xsi:type="stext:ReactionTrigger" xmi:id="_ToKTghzuEeGEC4raFz1JbQ">
@@ -197,13 +197,13 @@
                 </effect>
               </declarations>
             </scopes>
-            <outgoingTransitions xmi:id="_g7TywBBEEeGQ0KsLDV4EFg" expression="after 2s" target="_12GAEBBDEeGQ0KsLDV4EFg">
+            <outgoingTransitions xmi:id="_g7TywBBEEeGQ0KsLDV4EFg" specification="after 2s" target="_12GAEBBDEeGQ0KsLDV4EFg">
               <trigger xsi:type="stext:ReactionTrigger" xmi:id="_ToRoQBzuEeGEC4raFz1JbQ">
                 <triggers xsi:type="stext:TimeEventSpec" xmi:id="_ToRoQRzuEeGEC4raFz1JbQ" value="2"/>
               </trigger>
             </outgoingTransitions>
           </vertices>
-          <vertices xsi:type="sgraph:State" xmi:id="_12GAEBBDEeGQ0KsLDV4EFg" expression="entry / Pedestrian.red = false;&#xD;&#xA;Pedestrian.green = true;" name="PedestrianGreen" incomingTransitions="_g7TywBBEEeGQ0KsLDV4EFg">
+          <vertices xsi:type="sgraph:State" xmi:id="_12GAEBBDEeGQ0KsLDV4EFg" specification="entry / Pedestrian.red = false;&#xD;&#xA;Pedestrian.green = true;" name="PedestrianGreen" incomingTransitions="_g7TywBBEEeGQ0KsLDV4EFg">
             <scopes xmi:id="_ToRoQhzuEeGEC4raFz1JbQ">
               <declarations xsi:type="stext:LocalReaction" xmi:id="_ToRoQxzuEeGEC4raFz1JbQ">
                 <trigger xsi:type="stext:ReactionTrigger" xmi:id="_ToRoRBzuEeGEC4raFz1JbQ">
@@ -223,13 +223,13 @@
                 </effect>
               </declarations>
             </scopes>
-            <outgoingTransitions xmi:id="_iZox8BBEEeGQ0KsLDV4EFg" expression="after 7s" target="_K-JX7RBEEeGQ0KsLDV4EFg">
+            <outgoingTransitions xmi:id="_iZox8BBEEeGQ0KsLDV4EFg" specification="after 7s" target="_K-JX7RBEEeGQ0KsLDV4EFg">
               <trigger xsi:type="stext:ReactionTrigger" xmi:id="_ToayMBzuEeGEC4raFz1JbQ">
                 <triggers xsi:type="stext:TimeEventSpec" xmi:id="_ToayMRzuEeGEC4raFz1JbQ" value="7"/>
               </trigger>
             </outgoingTransitions>
           </vertices>
-          <vertices xsi:type="sgraph:State" xmi:id="_K-JX7RBEEeGQ0KsLDV4EFg" expression="entry / Pedestrian.red = true;&#xD;&#xA;Pedestrian.green = false;" name="PedestrianRed" incomingTransitions="_iZox8BBEEeGQ0KsLDV4EFg">
+          <vertices xsi:type="sgraph:State" xmi:id="_K-JX7RBEEeGQ0KsLDV4EFg" specification="entry / Pedestrian.red = true;&#xD;&#xA;Pedestrian.green = false;" name="PedestrianRed" incomingTransitions="_iZox8BBEEeGQ0KsLDV4EFg">
             <scopes xmi:id="_TobZQBzuEeGEC4raFz1JbQ">
               <declarations xsi:type="stext:LocalReaction" xmi:id="_TobZQRzuEeGEC4raFz1JbQ">
                 <trigger xsi:type="stext:ReactionTrigger" xmi:id="_TobZQhzuEeGEC4raFz1JbQ">
@@ -249,13 +249,13 @@
                 </effect>
               </declarations>
             </scopes>
-            <outgoingTransitions xmi:id="_nVCU8BBEEeGQ0KsLDV4EFg" expression="after 5s" target="_TfjYTRBEEeGQ0KsLDV4EFg">
+            <outgoingTransitions xmi:id="_nVCU8BBEEeGQ0KsLDV4EFg" specification="after 5s" target="_TfjYTRBEEeGQ0KsLDV4EFg">
               <trigger xsi:type="stext:ReactionTrigger" xmi:id="_Tog40BzuEeGEC4raFz1JbQ">
                 <triggers xsi:type="stext:TimeEventSpec" xmi:id="_Tog40RzuEeGEC4raFz1JbQ" value="5"/>
               </trigger>
             </outgoingTransitions>
           </vertices>
-          <vertices xsi:type="sgraph:State" xmi:id="_TfjYTRBEEeGQ0KsLDV4EFg" expression="entry / TrafficLight.red = true;&#xD;&#xA;&#x9;TrafficLight.yellow = true;&#xD;&#xA;&#x9;TrafficLight.green = false;" name="StreetPrepare" incomingTransitions="_nVCU8BBEEeGQ0KsLDV4EFg">
+          <vertices xsi:type="sgraph:State" xmi:id="_TfjYTRBEEeGQ0KsLDV4EFg" specification="entry / TrafficLight.red = true;&#xD;&#xA;&#x9;TrafficLight.yellow = true;&#xD;&#xA;&#x9;TrafficLight.green = false;" name="StreetPrepare" incomingTransitions="_nVCU8BBEEeGQ0KsLDV4EFg">
             <scopes xmi:id="_Tohf4BzuEeGEC4raFz1JbQ">
               <declarations xsi:type="stext:LocalReaction" xmi:id="_Tohf4RzuEeGEC4raFz1JbQ">
                 <trigger xsi:type="stext:ReactionTrigger" xmi:id="_Tohf4hzuEeGEC4raFz1JbQ">
@@ -280,7 +280,7 @@
                 </effect>
               </declarations>
             </scopes>
-            <outgoingTransitions xmi:id="_pddaABBEEeGQ0KsLDV4EFg" expression="after 2s" target="_w8meYBA_EeGQ0KsLDV4EFg">
+            <outgoingTransitions xmi:id="_pddaABBEEeGQ0KsLDV4EFg" specification="after 2s" target="_w8meYBA_EeGQ0KsLDV4EFg">
               <trigger xsi:type="stext:ReactionTrigger" xmi:id="_TooNkBzuEeGEC4raFz1JbQ">
                 <triggers xsi:type="stext:TimeEventSpec" xmi:id="_TooNkRzuEeGEC4raFz1JbQ" value="2"/>
               </trigger>
@@ -291,7 +291,7 @@
           </vertices>
         </regions>
       </vertices>
-      <vertices xsi:type="sgraph:State" xmi:id="_MF4mkBBFEeGQ0KsLDV4EFg" expression="entry / TrafficLight.red = false;&#xD;&#xA;&#x9;TrafficLight.green = false;&#xD;&#xA;&#x9;TrafficLight.yellow = false;&#xD;&#xA;&#x9;Pedestrian.red = false;&#xD;&#xA;&#x9;Pedestrian.green = false;" name="off" incomingTransitions="_XlIREBBFEeGQ0KsLDV4EFg">
+      <vertices xsi:type="sgraph:State" xmi:id="_MF4mkBBFEeGQ0KsLDV4EFg" specification="entry / TrafficLight.red = false;&#xD;&#xA;&#x9;TrafficLight.green = false;&#xD;&#xA;&#x9;TrafficLight.yellow = false;&#xD;&#xA;&#x9;Pedestrian.red = false;&#xD;&#xA;&#x9;Pedestrian.green = false;" name="off" incomingTransitions="_XlIREBBFEeGQ0KsLDV4EFg">
         <scopes xmi:id="_TopbsBzuEeGEC4raFz1JbQ">
           <declarations xsi:type="stext:LocalReaction" xmi:id="_TopbsRzuEeGEC4raFz1JbQ">
             <trigger xsi:type="stext:ReactionTrigger" xmi:id="_TopbshzuEeGEC4raFz1JbQ">
@@ -326,13 +326,13 @@
             </effect>
           </declarations>
         </scopes>
-        <outgoingTransitions xmi:id="__OsQsBBPEeGQ0KsLDV4EFg" expression="keypress2" target="_NPjBmBA-EeGQ0KsLDV4EFg">
+        <outgoingTransitions xmi:id="__OsQsBBPEeGQ0KsLDV4EFg" specification="keypress2" target="_NPjBmBA-EeGQ0KsLDV4EFg">
           <trigger xsi:type="stext:ReactionTrigger" xmi:id="_To1o8BzuEeGEC4raFz1JbQ">
             <triggers xsi:type="stext:RegularEventSpec" xmi:id="_To1o8RzuEeGEC4raFz1JbQ" event="_TnWbOhzuEeGEC4raFz1JbQ"/>
           </trigger>
         </outgoingTransitions>
         <regions xmi:id="_xHG2gBBFEeGQ0KsLDV4EFg" name="r1">
-          <vertices xsi:type="sgraph:State" xmi:id="_BVnsgBBGEeGQ0KsLDV4EFg" expression="entry / &#xA;&#x9;TrafficLight.yellow = true;&#xA;" name="YellowOn" incomingTransitions="_EwURwBBGEeGQ0KsLDV4EFg _S4HWoBzuEeGEC4raFz1JbQ">
+          <vertices xsi:type="sgraph:State" xmi:id="_BVnsgBBGEeGQ0KsLDV4EFg" specification="entry / &#xA;&#x9;TrafficLight.yellow = true;&#xA;" name="YellowOn" incomingTransitions="_EwURwBBGEeGQ0KsLDV4EFg _S4HWoBzuEeGEC4raFz1JbQ">
             <scopes xmi:id="_To4sQBzuEeGEC4raFz1JbQ">
               <declarations xsi:type="stext:LocalReaction" xmi:id="_To4sQRzuEeGEC4raFz1JbQ">
                 <trigger xsi:type="stext:ReactionTrigger" xmi:id="_To4sQhzuEeGEC4raFz1JbQ">
@@ -347,7 +347,7 @@
                 </effect>
               </declarations>
             </scopes>
-            <outgoingTransitions xmi:id="_P6yC0BzuEeGEC4raFz1JbQ" expression="after 500ms" target="_B6YqMBzuEeGEC4raFz1JbQ">
+            <outgoingTransitions xmi:id="_P6yC0BzuEeGEC4raFz1JbQ" specification="after 500ms" target="_B6YqMBzuEeGEC4raFz1JbQ">
               <trigger xsi:type="stext:ReactionTrigger" xmi:id="_To7vkBzuEeGEC4raFz1JbQ">
                 <triggers xsi:type="stext:TimeEventSpec" xmi:id="_To7vkRzuEeGEC4raFz1JbQ" value="500" unit="ms"/>
               </trigger>
@@ -356,7 +356,7 @@
           <vertices xsi:type="sgraph:Entry" xmi:id="_EUWHcBBGEeGQ0KsLDV4EFg">
             <outgoingTransitions xmi:id="_EwURwBBGEeGQ0KsLDV4EFg" target="_BVnsgBBGEeGQ0KsLDV4EFg"/>
           </vertices>
-          <vertices xsi:type="sgraph:State" xmi:id="_B6YqMBzuEeGEC4raFz1JbQ" expression="entry /&#xA;&#x9;TrafficLight.yellow = false;" name="YellowOff" incomingTransitions="_P6yC0BzuEeGEC4raFz1JbQ">
+          <vertices xsi:type="sgraph:State" xmi:id="_B6YqMBzuEeGEC4raFz1JbQ" specification="entry /&#xA;&#x9;TrafficLight.yellow = false;" name="YellowOff" incomingTransitions="_P6yC0BzuEeGEC4raFz1JbQ">
             <scopes xmi:id="_To7vkhzuEeGEC4raFz1JbQ">
               <declarations xsi:type="stext:LocalReaction" xmi:id="_To7vkxzuEeGEC4raFz1JbQ">
                 <trigger xsi:type="stext:ReactionTrigger" xmi:id="_To7vlBzuEeGEC4raFz1JbQ">
@@ -371,7 +371,7 @@
                 </effect>
               </declarations>
             </scopes>
-            <outgoingTransitions xmi:id="_S4HWoBzuEeGEC4raFz1JbQ" expression="after 500ms" target="_BVnsgBBGEeGQ0KsLDV4EFg">
+            <outgoingTransitions xmi:id="_S4HWoBzuEeGEC4raFz1JbQ" specification="after 500ms" target="_BVnsgBBGEeGQ0KsLDV4EFg">
               <trigger xsi:type="stext:ReactionTrigger" xmi:id="_To-y4BzuEeGEC4raFz1JbQ">
                 <triggers xsi:type="stext:TimeEventSpec" xmi:id="_To-y4RzuEeGEC4raFz1JbQ" value="500" unit="ms"/>
               </trigger>

+ 11 - 13
plugins/org.yakindu.sct.generator.java/src/org/yakindu/sct/generator/java/templates/CustomCycleBasedStatemachine.xpt

@@ -5,9 +5,7 @@ are made available under the terms of the Eclipse Public License v1.0
 which accompanies this distribution, and is available at
 http://www.eclipse.org/legal/epl-v10.html
 Contributors:
-	committers of YAKINDU - initial API and implementation
- 	
-@author Markus Muehlbrandt - Initial contribution and API
+	Markus Muehlbrandt - Initial contribution and API
 «ENDREM»
 
 «IMPORT sexec»
@@ -38,12 +36,12 @@ Contributors:
 
 «DEFINE ActionCode FOR ScheduleTimeEvent-»
 «getComment()-»
-getTimerHandler().setTimer(«timeEvent.getName()», «timeValue.toCode()», cycleStartTime);
+getTimerService().setTimer(«timeEvent.getName()», «timeValue.toCode()», cycleStartTime);
 «ENDDEFINE»
 
 «DEFINE ActionCode FOR UnscheduleTimeEvent-»
 «getComment()-»
-getTimerHandler().resetTimer(«timeEvent.getName()»);
+getTimerService().resetTimer(«timeEvent.getName()»);
 «ENDDEFINE»
 
 «DEFINE ActionCode FOR Execution-»
@@ -180,7 +178,7 @@ import 
 «IF isTimedStatemachine()-»
 import «entry.getBasePackageName()».TimeEvent;
 import «entry.getBasePackageName()».ITimedStatemachine;
-import «entry.getBasePackageName()».ITimerHandler;
+import «entry.getBasePackageName()».ITimerService;
 import «entry.getBasePackageName()».EventNotification;
 import «entry.getBasePackageName()».Notification;
 «ELSE-»
@@ -237,7 +235,7 @@ public class 
 	private final Collection<Event<? extends Enum<?>>> outEvents;
 	
 	«IF isTimedStatemachine()-»
-	private ITimerHandler timerHandler;
+	private ITimerService timerService;
 	
 	private long cycleStartTime;
 	«ENDIF-»
@@ -271,16 +269,16 @@ public class 
 	}
 	
 	«IF isTimedStatemachine()-»
-	public void setTimerHandler(ITimerHandler timerHandler) {
-		this.timerHandler = timerHandler;
+	public void setTimerService(ITimerService timerService) {
+		this.timerService = timerService;
 	}
 
 	
-	public ITimerHandler getTimerHandler() {
-		if (timerHandler == null) {
-			throw new NullPointerException("TimerHandler of statemachine \"+«name»+\" not set!");
+	public ITimerService getTimerService() {
+		if (timerService == null) {
+			throw new NullPointerException("TimerService of statemachine \"+«name»+\" not set!");
 		}
-		return timerHandler;
+		return timerService;
 	}
 	
 	public void notify(Notification<?> notification) {

+ 10 - 36
plugins/org.yakindu.sct.generator.java/src/org/yakindu/sct/generator/java/templates/CustomEventBasedStatemachine.xpt

@@ -5,9 +5,7 @@ are made available under the terms of the Eclipse Public License v1.0
 which accompanies this distribution, and is available at
 http://www.eclipse.org/legal/epl-v10.html
 Contributors:
-	committers of YAKINDU - initial API and implementation
- 	
-@author Markus Muehlbrandt - Initial contribution and API
+	Markus Muehlbrandt - Initial contribution and API
 «ENDREM»
 «IMPORT sexec»
 «IMPORT stext»
@@ -29,14 +27,9 @@ import 
 public class «getEventBasedStatemachineName()» extends «getCycleBasedStatemachineName()» {
 
 	private LinkedList<Event<? extends Enum<?>>> eventQueue;
-	
-	private Thread runtimeThread;
-	
-	private long cyclePeriod;
-	
-	public «getEventBasedStatemachineName()»(long cyclePeriod) {
+
+	public «getEventBasedStatemachineName()»() {
 		eventQueue = new LinkedList<Event<? extends Enum<?>>>();
-		this.cyclePeriod = cyclePeriod;
 	}
 	
 	@Override
@@ -49,32 +42,13 @@ public class 
 		return !eventQueue.isEmpty();
 	}
 	
-	public void start() {
-		runtimeThread = new Thread() {
-			@Override
-			public void run() {
-				long startTime;
-				while (!isInterrupted()) {
-					startTime = System.currentTimeMillis();
-					if (eventOccured()) {
-						Event<? extends Enum<?>> event = getOccuredEvents().poll();
-						«getEventBasedStatemachineName()».super.getOccuredEvents().add(event);
-						runCycle();
-					}
-					try {
-						Thread.sleep(cyclePeriod-System.currentTimeMillis()+startTime);
-					} catch (InterruptedException e) {
-						interrupt();
-					}
-				}
-			}
-		};
-		runtimeThread.start();
-	}
-	
-	public boolean stop() {
-		runtimeThread.interrupt();
-		return runtimeThread.isAlive();
+	@Override
+	public void runCycle() {
+		if (eventOccured()) {
+			Event<? extends Enum<?>> event = getOccuredEvents().poll();
+			super.getOccuredEvents().add(event);
+			super.runCycle();
+		}
 	}
 }
 «ENDFILE-»

+ 5 - 5
plugins/org.yakindu.sct.generator.java/src/org/yakindu/sct/generator/java/templates/CustomInterface.xpt

@@ -5,10 +5,9 @@ are made available under the terms of the Eclipse Public License v1.0
 which accompanies this distribution, and is available at
 http://www.eclipse.org/legal/epl-v10.html
 Contributors:
-	committers of YAKINDU - initial API and implementation
- 	
-@author Markus Muehlbrandt - Initial contribution and API
+	Markus Muehlbrandt - Initial contribution and API
 «ENDREM»
+
 «IMPORT sexec»
 «IMPORT stext»
 «IMPORT sgraph»
@@ -45,9 +44,10 @@ public interface 
 	
 	«FOREACH declarations.typeSelect(EventDefinition) AS event-»
 	«IF  event.direction ==  Direction::IN-»
-	public void raise«event.name.toFirstUpper()»();
 		«IF event.type != Type::void-»
-	public void raise«event.name.toFirstUpper()»(«event.type.getJavaType()» value);
+			public void raise«event.name.toFirstUpper()»(«event.type.getJavaType()» value);
+		«ELSE»
+			public void raise«event.name.toFirstUpper()»();
 		«ENDIF-»
 	«ELSEIF event.direction ==  Direction::OUT-»
 	public boolean isRaised«event.name.toFirstUpper()»();

+ 7 - 8
plugins/org.yakindu.sct.generator.java/src/org/yakindu/sct/generator/java/templates/CustomInterfaceImpl.xpt

@@ -5,9 +5,7 @@ are made available under the terms of the Eclipse Public License v1.0
 which accompanies this distribution, and is available at
 http://www.eclipse.org/legal/epl-v10.html
 Contributors:
-	committers of YAKINDU - initial API and implementation
- 	
-@author Markus Muehlbrandt - Initial contribution and API
+	Markus Muehlbrandt - Initial contribution and API
 «ENDREM»
 «IMPORT sexec»
 «IMPORT stext»
@@ -46,17 +44,18 @@ public class 
 	}
 	
 	«FOREACH declarations.typeSelect(EventDefinition) AS event-»
-	public void raise«event.name.toFirstUpper()»() {
+	
+	«IF event.type != Type::void-»
+	public void raise«event.name.toFirstUpper()»(«event.type.getJavaType()» value) {
+		«event.getName()».setValue(value);
 		statemachine.getOccuredEvents().add(«event.getName()»);
 		«IF event.direction ==  Direction::OUT-»
 		statemachine.getOutEvents().add(«event.getName()»);
 		notifyListeners(new EventNotification(«event.getName()»));
 		«ENDIF-»
 	}
-	
-	«IF event.type != Type::void-»
-	public void raise«event.name.toFirstUpper()»(«event.type.getJavaType()» value) {
-		«event.getName()».setValue(value);
+	«ELSE»
+	public void raise«event.name.toFirstUpper()»() {
 		statemachine.getOccuredEvents().add(«event.getName()»);
 		«IF event.direction ==  Direction::OUT-»
 		statemachine.getOutEvents().add(«event.getName()»);

+ 6 - 8
plugins/org.yakindu.sct.generator.java/src/org/yakindu/sct/generator/java/templates/Event.xpt

@@ -5,9 +5,7 @@ are made available under the terms of the Eclipse Public License v1.0
 which accompanies this distribution, and is available at
 http://www.eclipse.org/legal/epl-v10.html
 Contributors:
-	committers of YAKINDU - initial API and implementation
- 	
-@author Markus Muehlbrandt - Initial contribution and API
+	Markus Muehlbrandt - Initial contribution and API
 «ENDREM»
 «IMPORT sexec»
 «IMPORT stext»
@@ -23,14 +21,14 @@ package 
 
 public class Event<Type extends Enum<Type>> {
 
-	private Type name;
+	private Type id;
 
-	public Event(Type name) {
-		this.name = name;
+	public Event(Type id) {
+		this.id = id;
 	}
 
-	public Type getName() {
-		return name;
+	public Type getId() {
+		return id;
 	}
 }
 «ENDFILE-»

+ 2 - 4
plugins/org.yakindu.sct.generator.java/src/org/yakindu/sct/generator/java/templates/EventNotification.xpt

@@ -5,9 +5,7 @@ are made available under the terms of the Eclipse Public License v1.0
 which accompanies this distribution, and is available at
 http://www.eclipse.org/legal/epl-v10.html
 Contributors:
-	committers of YAKINDU - initial API and implementation
- 	
-@author Markus Muehlbrandt - Initial contribution and API
+	Markus Muehlbrandt - Initial contribution and API
 «ENDREM»
 «IMPORT sexec»
 «IMPORT stext»
@@ -23,7 +21,7 @@ package 
 
 import «entry.getBasePackageName()».Event;
 
-public class EventNotification extends Notification<Event<?>> {
+public class EventNotification extends Notification<Event<? extends Enum<?>>> {
 
 	public EventNotification(Event<? extends Enum<?>> element) {
 		super(NotificationType.EventNotification, element);

+ 2 - 3
plugins/org.yakindu.sct.generator.java/src/org/yakindu/sct/generator/java/templates/Expression.ext

@@ -6,9 +6,8 @@
   http://www.eclipse.org/legal/epl-v10.html
   Contributors:
   	committers of YAKINDU - initial API and implementation  
-  	
-  	@author Joern Seger - Initial contribution and API
-  	@author Markus Muehlbrandt - Java adaptions
+  	Joern Seger - Initial contribution and API
+  	Markus Muehlbrandt - Java adaptions
  */
 import stext;
 import sexec;

+ 1 - 3
plugins/org.yakindu.sct.generator.java/src/org/yakindu/sct/generator/java/templates/INotificationListener.xpt

@@ -5,9 +5,7 @@ are made available under the terms of the Eclipse Public License v1.0
 which accompanies this distribution, and is available at
 http://www.eclipse.org/legal/epl-v10.html
 Contributors:
-	committers of YAKINDU - initial API and implementation
- 	
-@author Markus Muehlbrandt - Initial contribution and API
+	Markus Muehlbrandt - Initial contribution and API
 «ENDREM»
 «IMPORT sexec»
 «IMPORT stext»

+ 1 - 3
plugins/org.yakindu.sct.generator.java/src/org/yakindu/sct/generator/java/templates/INotificationSender.xpt

@@ -5,9 +5,7 @@ are made available under the terms of the Eclipse Public License v1.0
 which accompanies this distribution, and is available at
 http://www.eclipse.org/legal/epl-v10.html
 Contributors:
-	committers of YAKINDU - initial API and implementation
- 	
-@author Markus Muehlbrandt - Initial contribution and API
+	Markus Muehlbrandt - Initial contribution and API
 «ENDREM»
 «IMPORT sexec»
 «IMPORT stext»

+ 1 - 3
plugins/org.yakindu.sct.generator.java/src/org/yakindu/sct/generator/java/templates/IStatemachine.xpt

@@ -6,9 +6,7 @@ are made available under the terms of the Eclipse Public License v1.0
 which accompanies this distribution, and is available at
 http://www.eclipse.org/legal/epl-v10.html
 Contributors:
-	committers of YAKINDU - initial API and implementation
- 	
-@author Markus Muehlbrandt - Initial contribution and API
+	Markus Muehlbrandt - Initial contribution and API
 «ENDREM»
 «IMPORT sexec»
 «IMPORT stext»

+ 3 - 5
plugins/org.yakindu.sct.generator.java/src/org/yakindu/sct/generator/java/templates/ITimedStatemachine.xpt

@@ -5,9 +5,7 @@ are made available under the terms of the Eclipse Public License v1.0
 which accompanies this distribution, and is available at
 http://www.eclipse.org/legal/epl-v10.html
 Contributors:
-	committers of YAKINDU - initial API and implementation
- 	
-@author Markus Muehlbrandt - Initial contribution and API
+	Markus Muehlbrandt - Initial contribution and API
 «ENDREM»
 «IMPORT sexec»
 «IMPORT stext»
@@ -24,9 +22,9 @@ import 
 public interface ITimedStatemachine extends
 		IStatemachine, INotificationListener {
 
-	public void setTimerHandler(ITimerHandler timerHandler);
+	public void setTimerService(ITimerService timerService);
 
-	public ITimerHandler getTimerHandler();
+	public ITimerService getTimerService();
 }
 «ENDFILE-»
 «ENDDEFINE»

+ 3 - 5
plugins/org.yakindu.sct.generator.java/src/org/yakindu/sct/generator/java/templates/ITimerHandler.xpt

@@ -5,9 +5,7 @@ are made available under the terms of the Eclipse Public License v1.0
 which accompanies this distribution, and is available at
 http://www.eclipse.org/legal/epl-v10.html
 Contributors:
-	committers of YAKINDU - initial API and implementation
- 	
-@author Markus Muehlbrandt - Initial contribution and API
+	Markus Muehlbrandt - Initial contribution and API
 «ENDREM»
 «IMPORT sexec»
 «IMPORT stext»
@@ -16,11 +14,11 @@ Contributors:
 «EXTENSION org::yakindu::sct::generator::java::templates::Naming»
 
 «DEFINE file(sgen::GeneratorEntry entry) FOR ExecutionFlow-»
-«FILE entry.getBasePackagePath()+'/ITimerHandler.java'-»
+«FILE entry.getBasePackagePath()+'/ITimerService.java'-»
 «getLicenseHeader(entry)»
 package «entry.getBasePackageName()»;
 
-public interface ITimerHandler {
+public interface ITimerService {
 
 	public void setTimer(TimeEvent<? extends Enum<?>> event, long time, long cycleStartTime);
 

+ 6 - 5
plugins/org.yakindu.sct.generator.java/src/org/yakindu/sct/generator/java/templates/Main.xpt

@@ -5,10 +5,9 @@ are made available under the terms of the Eclipse Public License v1.0
 which accompanies this distribution, and is available at
 http://www.eclipse.org/legal/epl-v10.html
 Contributors:
-	committers of YAKINDU - initial API and implementation
- 	
-@author Markus Muehlbrandt - Initial contribution and API
+ 	Markus Muehlbrandt - Initial contribution and API
 «ENDREM»
+
 «IMPORT sexec»
 «IMPORT stext»
 «IMPORT sgraph»
@@ -24,9 +23,11 @@ Contributors:
 	
 	«EXPAND ITimedStatemachine::file(entry) FOR this»
 	
-	«EXPAND ITimerHandler::file(entry) FOR this»
+	«EXPAND ITimerService::file(entry) FOR this»
+	
+	«EXPAND TimerService::file(entry) FOR this»
 	
-	«EXPAND TimerHandler::file(entry) FOR this»
+	«EXPAND RuntimeService::file(entry) FOR this»
 	
 	«EXPAND Event::file(entry) FOR this»
 	

+ 2 - 4
plugins/org.yakindu.sct.generator.java/src/org/yakindu/sct/generator/java/templates/Naming.ext

@@ -5,10 +5,8 @@
   which accompanies this distribution, and is available at
   http://www.eclipse.org/legal/epl-v10.html
   Contributors:
-  	committers of YAKINDU - initial API and implementation  
-  	
-  	@author Joern Seger - Initial contribution and API
-  	@author Markus Muehlbrandt - Java adaptions and extensions
+  	Joern Seger - Initial contribution and API
+  	Markus Muehlbrandt - Java adaptions and extensions
  */
 import stext;
 import sexec;

+ 1 - 3
plugins/org.yakindu.sct.generator.java/src/org/yakindu/sct/generator/java/templates/Notification.xpt

@@ -5,9 +5,7 @@ are made available under the terms of the Eclipse Public License v1.0
 which accompanies this distribution, and is available at
 http://www.eclipse.org/legal/epl-v10.html
 Contributors:
-	committers of YAKINDU - initial API and implementation
- 	
-@author Markus Muehlbrandt - Initial contribution and API
+	Markus Muehlbrandt - Initial contribution and API
 «ENDREM»
 «IMPORT sexec»
 «IMPORT stext»

+ 1 - 3
plugins/org.yakindu.sct.generator.java/src/org/yakindu/sct/generator/java/templates/NotificationSender.xpt

@@ -5,9 +5,7 @@ are made available under the terms of the Eclipse Public License v1.0
 which accompanies this distribution, and is available at
 http://www.eclipse.org/legal/epl-v10.html
 Contributors:
-	committers of YAKINDU - initial API and implementation
- 	
-@author Markus Muehlbrandt - Initial contribution and API
+	Markus Muehlbrandt - Initial contribution and API
 «ENDREM»
 «IMPORT sexec»
 «IMPORT stext»

+ 1 - 3
plugins/org.yakindu.sct.generator.java/src/org/yakindu/sct/generator/java/templates/NotificationType.xpt

@@ -5,9 +5,7 @@ are made available under the terms of the Eclipse Public License v1.0
 which accompanies this distribution, and is available at
 http://www.eclipse.org/legal/epl-v10.html
 Contributors:
-	committers of YAKINDU - initial API and implementation
- 	
-@author Markus Muehlbrandt - Initial contribution and API
+	Markus Muehlbrandt - Initial contribution and API
 «ENDREM»
 «IMPORT sexec»
 «IMPORT stext»

+ 71 - 0
plugins/org.yakindu.sct.generator.java/src/org/yakindu/sct/generator/java/templates/RuntimeService.xpt

@@ -0,0 +1,71 @@
+«REM»
+Copyright (c) 2011 committers of YAKINDU and others.
+All rights reserved. This program and the accompanying materials
+are made available under the terms of the Eclipse Public License v1.0
+which accompanies this distribution, and is available at
+http://www.eclipse.org/legal/epl-v10.html
+Contributors:
+	Markus Muehlbrandt - Initial contribution and API
+«ENDREM»
+
+«IMPORT sexec»
+«IMPORT stext»
+«IMPORT sgraph»
+
+«EXTENSION org::yakindu::sct::generator::java::templates::Naming»
+
+«DEFINE file(sgen::GeneratorEntry entry) FOR ExecutionFlow-»
+«FILE entry.getBasePackagePath()+'/RuntimeService.java'-»
+«getLicenseHeader(entry)»
+package «entry.getBasePackageName()»;
+
+import java.util.HashSet;
+import java.util.Set;
+import java.util.Timer;
+import java.util.TimerTask;
+import java.util.concurrent.locks.ReentrantReadWriteLock;
+
+public class RuntimeService {
+
+	private Timer timer = new Timer();
+
+	private Set<IStatemachine> statemachineSet = new HashSet<IStatemachine>();
+
+	private ReentrantReadWriteLock lock = new ReentrantReadWriteLock();
+
+	private TimerTask timerTask = new TimerTask() {
+
+		@Override
+		public void run() {
+			lock.readLock().lock();
+			for (IStatemachine statemachine : statemachineSet) {
+				statemachine.runCycle();
+			}
+			lock.readLock().unlock();
+		}
+	};
+
+	public RuntimeService(long cyclePeriod) {
+		timer.scheduleAtFixedRate(timerTask, 0, cyclePeriod);
+	}
+
+	public boolean addStatemachine(IStatemachine statemachine) {
+		lock.writeLock().lock();
+		boolean ret = statemachineSet.add(statemachine);
+		lock.writeLock().unlock();
+		return ret;
+	}
+
+	public boolean removeStatemachine(IStatemachine statemachine) {
+		lock.writeLock().lock();
+		boolean ret = statemachineSet.remove(statemachine);
+		lock.writeLock().unlock();
+		return ret;
+	}
+
+	public void cancel() {
+		timer.cancel();
+	}
+}
+«ENDFILE-»
+«ENDDEFINE»

+ 3 - 5
plugins/org.yakindu.sct.generator.java/src/org/yakindu/sct/generator/java/templates/TimeEvent.xpt

@@ -5,9 +5,7 @@ are made available under the terms of the Eclipse Public License v1.0
 which accompanies this distribution, and is available at
 http://www.eclipse.org/legal/epl-v10.html
 Contributors:
-	committers of YAKINDU - initial API and implementation
- 	
-@author Markus Muehlbrandt - Initial contribution and API
+	Markus Muehlbrandt - Initial contribution and API
 «ENDREM»
 «IMPORT sexec»
 «IMPORT stext»
@@ -27,8 +25,8 @@ public class TimeEvent<EnumType extends Enum<EnumType>> extends ValuedEvent<Enum
 
 	private ITimedStatemachine statemachine;
 
-	public TimeEvent(EnumType name, boolean periodic) {
-		super(name, periodic);
+	public TimeEvent(EnumType id, boolean periodic) {
+		super(id, periodic);
 	}
 
 	public void setTime(long time) {

+ 4 - 5
plugins/org.yakindu.sct.generator.java/src/org/yakindu/sct/generator/java/templates/TimerHandler.xpt

@@ -5,10 +5,9 @@ are made available under the terms of the Eclipse Public License v1.0
 which accompanies this distribution, and is available at
 http://www.eclipse.org/legal/epl-v10.html
 Contributors:
-	committers of YAKINDU - initial API and implementation
- 	
-@author Markus Muehlbrandt - Initial contribution and API
+	Markus Muehlbrandt - Initial contribution and API
 «ENDREM»
+
 «IMPORT sexec»
 «IMPORT stext»
 «IMPORT sgraph»
@@ -16,7 +15,7 @@ Contributors:
 «EXTENSION org::yakindu::sct::generator::java::templates::Naming»
 
 «DEFINE file(sgen::GeneratorEntry entry) FOR ExecutionFlow-»
-«FILE entry.getBasePackagePath()+'/TimerHandler.java'-»
+«FILE entry.getBasePackagePath()+'/TimerService.java'-»
 «getLicenseHeader(entry)»
 package «entry.getBasePackageName()»;
 
@@ -27,7 +26,7 @@ import java.util.TimerTask;
 
 import «entry.getBasePackageName()».EventNotification;
 
-public class TimerHandler implements ITimerHandler {
+public class TimerService implements ITimerService {
 
 	private final Timer timer = new Timer();
 

+ 1 - 3
plugins/org.yakindu.sct.generator.java/src/org/yakindu/sct/generator/java/templates/ValuedEvent.xpt

@@ -5,9 +5,7 @@ are made available under the terms of the Eclipse Public License v1.0
 which accompanies this distribution, and is available at
 http://www.eclipse.org/legal/epl-v10.html
 Contributors:
-	committers of YAKINDU - initial API and implementation
- 	
-@author Markus Muehlbrandt - Initial contribution and API
+	Markus Muehlbrandt - Initial contribution and API
 «ENDREM»
 «IMPORT sexec»
 «IMPORT stext»

+ 5 - 5
test-plugins/org.yakindu.sct.generator.java.runtime.test/src-gen/org/yakindu/sct/runtime/java/Event.java

@@ -12,13 +12,13 @@ package org.yakindu.sct.runtime.java;
 
 public class Event<Type extends Enum<Type>> {
 
-	private Type name;
+	private Type id;
 
-	public Event(Type name) {
-		this.name = name;
+	public Event(Type id) {
+		this.id = id;
 	}
 
-	public Type getName() {
-		return name;
+	public Type getId() {
+		return id;
 	}
 }

+ 1 - 1
test-plugins/org.yakindu.sct.generator.java.runtime.test/src-gen/org/yakindu/sct/runtime/java/EventNotification.java

@@ -12,7 +12,7 @@ package org.yakindu.sct.runtime.java;
 
 import org.yakindu.sct.runtime.java.Event;
 
-public class EventNotification extends Notification<Event<?>> {
+public class EventNotification extends Notification<Event<? extends Enum<?>>> {
 
 	public EventNotification(Event<? extends Enum<?>> element) {
 		super(NotificationType.EventNotification, element);

+ 2 - 2
test-plugins/org.yakindu.sct.generator.java.runtime.test/src-gen/org/yakindu/sct/runtime/java/ITimedStatemachine.java

@@ -17,7 +17,7 @@ public interface ITimedStatemachine
 			IStatemachine,
 			INotificationListener {
 
-	public void setTimerHandler(ITimerHandler timerHandler);
+	public void setTimerService(ITimerService timerService);
 
-	public ITimerHandler getTimerHandler();
+	public ITimerService getTimerService();
 }

+ 1 - 1
test-plugins/org.yakindu.sct.generator.java.runtime.test/src-gen/org/yakindu/sct/runtime/java/ITimerHandler.java

@@ -10,7 +10,7 @@
  */
 package org.yakindu.sct.runtime.java;
 
-public interface ITimerHandler {
+public interface ITimerService {
 
 	public void setTimer(TimeEvent<? extends Enum<?>> event, long time,
 			long cycleStartTime);

+ 60 - 0
test-plugins/org.yakindu.sct.generator.java.runtime.test/src-gen/org/yakindu/sct/runtime/java/RuntimeService.java

@@ -0,0 +1,60 @@
+/**
+ * Copyright (c) 2011 committers of YAKINDU and others.
+ * All rights reserved. This program and the accompanying materials
+ * are made available under the terms of the Eclipse Public License v1.0
+ * which accompanies this distribution, and is available at
+ * http://www.eclipse.org/legal/epl-v10.html
+ *
+ * Contributors:
+ *     committers of YAKINDU - initial API and implementation
+ */
+package org.yakindu.sct.runtime.java;
+
+import java.util.HashSet;
+import java.util.Set;
+import java.util.Timer;
+import java.util.TimerTask;
+import java.util.concurrent.locks.ReentrantReadWriteLock;
+
+public class RuntimeService {
+
+	private Timer timer = new Timer();
+
+	private Set<IStatemachine> statemachineSet = new HashSet<IStatemachine>();
+
+	private ReentrantReadWriteLock lock = new ReentrantReadWriteLock();
+
+	private TimerTask timerTask = new TimerTask() {
+
+		@Override
+		public void run() {
+			lock.readLock().lock();
+			for (IStatemachine statemachine : statemachineSet) {
+				statemachine.runCycle();
+			}
+			lock.readLock().unlock();
+		}
+	};
+
+	public RuntimeService(long cyclePeriod) {
+		timer.scheduleAtFixedRate(timerTask, 0, cyclePeriod);
+	}
+
+	public boolean addStatemachine(IStatemachine statemachine) {
+		lock.writeLock().lock();
+		boolean ret = statemachineSet.add(statemachine);
+		lock.writeLock().unlock();
+		return ret;
+	}
+
+	public boolean removeStatemachine(IStatemachine statemachine) {
+		lock.writeLock().lock();
+		boolean ret = statemachineSet.remove(statemachine);
+		lock.writeLock().unlock();
+		return ret;
+	}
+
+	public void cancel() {
+		timer.cancel();
+	}
+}

+ 2 - 2
test-plugins/org.yakindu.sct.generator.java.runtime.test/src-gen/org/yakindu/sct/runtime/java/TimeEvent.java

@@ -18,8 +18,8 @@ public class TimeEvent<EnumType extends Enum<EnumType>>
 
 	private ITimedStatemachine statemachine;
 
-	public TimeEvent(EnumType name, boolean periodic) {
-		super(name, periodic);
+	public TimeEvent(EnumType id, boolean periodic) {
+		super(id, periodic);
 	}
 
 	public void setTime(long time) {

+ 1 - 1
test-plugins/org.yakindu.sct.generator.java.runtime.test/src-gen/org/yakindu/sct/runtime/java/TimerHandler.java

@@ -17,7 +17,7 @@ import java.util.TimerTask;
 
 import org.yakindu.sct.runtime.java.EventNotification;
 
-public class TimerHandler implements ITimerHandler {
+public class TimerService implements ITimerService {
 
 	private final Timer timer = new Timer();
 

+ 0 - 6
test-plugins/org.yakindu.sct.generator.java.runtime.test/src-gen/org/yakindu/sct/runtime/java/interfacetest/DefaultInterfaceImpl.java

@@ -37,12 +37,6 @@ public class DefaultInterfaceImpl extends NotificationSender
 		return EventEvent1;
 	}
 
-	public void raiseEvent2() {
-		statemachine.getOccuredEvents().add(EventEvent2);
-		statemachine.getOutEvents().add(EventEvent2);
-		notifyListeners(new EventNotification(EventEvent2));
-	}
-
 	public void raiseEvent2(int value) {
 		EventEvent2.setValue(value);
 		statemachine.getOccuredEvents().add(EventEvent2);

+ 45 - 0
test-plugins/org.yakindu.sct.generator.java.runtime.test/src-gen/org/yakindu/sct/runtime/java/interfacetest/InterfaceTestEventBasedStatemachine.java

@@ -0,0 +1,45 @@
+/**
+ * Copyright (c) 2011 committers of YAKINDU and others.
+ * All rights reserved. This program and the accompanying materials
+ * are made available under the terms of the Eclipse Public License v1.0
+ * which accompanies this distribution, and is available at
+ * http://www.eclipse.org/legal/epl-v10.html
+ *
+ * Contributors:
+ *     committers of YAKINDU - initial API and implementation
+ */
+package org.yakindu.sct.runtime.java.interfacetest;
+
+import java.util.LinkedList;
+
+import org.yakindu.sct.runtime.java.Event;
+
+public class InterfaceTestEventBasedStatemachine
+		extends
+			InterfaceTestCycleBasedStatemachine {
+
+	private LinkedList<Event<? extends Enum<?>>> eventQueue;
+
+	public InterfaceTestEventBasedStatemachine() {
+		eventQueue = new LinkedList<Event<? extends Enum<?>>>();
+	}
+
+	@Override
+	protected LinkedList<Event<? extends Enum<?>>> getOccuredEvents() {
+		return eventQueue;
+	}
+
+	@Override
+	protected boolean eventOccured() {
+		return !eventQueue.isEmpty();
+	}
+
+	@Override
+	public void runCycle() {
+		if (eventOccured()) {
+			Event<? extends Enum<?>> event = getOccuredEvents().poll();
+			super.getOccuredEvents().add(event);
+			super.runCycle();
+		}
+	}
+}

+ 0 - 6
test-plugins/org.yakindu.sct.generator.java.runtime.test/src-gen/org/yakindu/sct/runtime/java/interfacetest/InterfaceThirdImpl.java

@@ -37,12 +37,6 @@ public class InterfaceThirdImpl extends NotificationSender
 		return EventEvent5;
 	}
 
-	public void raiseEvent6() {
-		statemachine.getOccuredEvents().add(EventEvent6);
-		statemachine.getOutEvents().add(EventEvent6);
-		notifyListeners(new EventNotification(EventEvent6));
-	}
-
 	public void raiseEvent6(boolean value) {
 		EventEvent6.setValue(value);
 		statemachine.getOccuredEvents().add(EventEvent6);

+ 8 - 0
test-plugins/org.yakindu.sct.generator.java.runtime.test/src-gen/org/yakindu/sct/runtime/java/test_deephistory/DefaultInterface.java

@@ -17,13 +17,21 @@ public interface DefaultInterface {
 	}
 
 	public void raiseEvent1();
+
 	public void raiseEvent2();
+
 	public void raiseEvent3();
+
 	public void raiseEvent4();
+
 	public void raiseEvent5();
+
 	public void raiseEvent6();
+
 	public void raiseEvent7();
+
 	public void raiseEvent8();
+
 	public void raiseEvent9();
 
 }

+ 45 - 0
test-plugins/org.yakindu.sct.generator.java.runtime.test/src-gen/org/yakindu/sct/runtime/java/test_deephistory/Test_DeepHistoryEventBasedStatemachine.java

@@ -0,0 +1,45 @@
+/**
+ * Copyright (c) 2011 committers of YAKINDU and others.
+ * All rights reserved. This program and the accompanying materials
+ * are made available under the terms of the Eclipse Public License v1.0
+ * which accompanies this distribution, and is available at
+ * http://www.eclipse.org/legal/epl-v10.html
+ *
+ * Contributors:
+ *     committers of YAKINDU - initial API and implementation
+ */
+package org.yakindu.sct.runtime.java.test_deephistory;
+
+import java.util.LinkedList;
+
+import org.yakindu.sct.runtime.java.Event;
+
+public class Test_DeepHistoryEventBasedStatemachine
+		extends
+			Test_DeepHistoryCycleBasedStatemachine {
+
+	private LinkedList<Event<? extends Enum<?>>> eventQueue;
+
+	public Test_DeepHistoryEventBasedStatemachine() {
+		eventQueue = new LinkedList<Event<? extends Enum<?>>>();
+	}
+
+	@Override
+	protected LinkedList<Event<? extends Enum<?>>> getOccuredEvents() {
+		return eventQueue;
+	}
+
+	@Override
+	protected boolean eventOccured() {
+		return !eventQueue.isEmpty();
+	}
+
+	@Override
+	public void runCycle() {
+		if (eventOccured()) {
+			Event<? extends Enum<?>> event = getOccuredEvents().poll();
+			super.getOccuredEvents().add(event);
+			super.runCycle();
+		}
+	}
+}

+ 3 - 2
test-plugins/org.yakindu.sct.generator.java.runtime.test/src-gen/org/yakindu/sct/runtime/java/test_expression/DefaultInterface.java

@@ -16,15 +16,16 @@ import org.yakindu.sct.runtime.java.ValuedEvent;
 public interface DefaultInterface extends INotificationSender {
 
 	public enum Events {
-		Event1, Event2,
+		Event1, Event2, Event3,
 	}
 
-	public void raiseEvent1();
 	public void raiseEvent1(int value);
 	public boolean isRaisedEvent2();
 
 	public ValuedEvent<Events, Double> getEventEvent2();
 
+	public void raiseEvent3();
+
 	public int getVarVar1();
 	public void setVarVar1(int value);
 	public int getVarVar2();

+ 10 - 10
test-plugins/org.yakindu.sct.generator.java.runtime.test/src-gen/org/yakindu/sct/runtime/java/test_expression/DefaultInterfaceImpl.java

@@ -10,6 +10,7 @@
  */
 package org.yakindu.sct.runtime.java.test_expression;
 
+import org.yakindu.sct.runtime.java.Event;
 import org.yakindu.sct.runtime.java.EventNotification;
 import org.yakindu.sct.runtime.java.NotificationSender;
 import org.yakindu.sct.runtime.java.ValuedEvent;
@@ -22,6 +23,7 @@ public class DefaultInterfaceImpl extends NotificationSender
 			Events.Event1, 0);
 	private final ValuedEvent<Events, Double> EventEvent2 = new ValuedEvent<Events, Double>(
 			Events.Event2, 0D);
+	private final Event<Events> EventEvent3 = new Event<Events>(Events.Event3);
 
 	private Test_ExpressionCycleBasedStatemachine statemachine;
 
@@ -30,10 +32,6 @@ public class DefaultInterfaceImpl extends NotificationSender
 		this.statemachine = statemachine;
 	}
 
-	public void raiseEvent1() {
-		statemachine.getOccuredEvents().add(EventEvent1);
-	}
-
 	public void raiseEvent1(int value) {
 		EventEvent1.setValue(value);
 		statemachine.getOccuredEvents().add(EventEvent1);
@@ -43,12 +41,6 @@ public class DefaultInterfaceImpl extends NotificationSender
 		return EventEvent1;
 	}
 
-	public void raiseEvent2() {
-		statemachine.getOccuredEvents().add(EventEvent2);
-		statemachine.getOutEvents().add(EventEvent2);
-		notifyListeners(new EventNotification(EventEvent2));
-	}
-
 	public void raiseEvent2(double value) {
 		EventEvent2.setValue(value);
 		statemachine.getOccuredEvents().add(EventEvent2);
@@ -64,6 +56,14 @@ public class DefaultInterfaceImpl extends NotificationSender
 		return statemachine.getOutEvents().contains(EventEvent2);
 	}
 
+	public void raiseEvent3() {
+		statemachine.getOccuredEvents().add(EventEvent3);
+	}
+
+	public Event<Events> getEventEvent3() {
+		return EventEvent3;
+	}
+
 	private int varVar1 = 6;
 
 	public int getVarVar1() {

+ 45 - 0
test-plugins/org.yakindu.sct.generator.java.runtime.test/src-gen/org/yakindu/sct/runtime/java/test_expression/Test_ExpressionEventBasedStatemachine.java

@@ -0,0 +1,45 @@
+/**
+ * Copyright (c) 2011 committers of YAKINDU and others.
+ * All rights reserved. This program and the accompanying materials
+ * are made available under the terms of the Eclipse Public License v1.0
+ * which accompanies this distribution, and is available at
+ * http://www.eclipse.org/legal/epl-v10.html
+ *
+ * Contributors:
+ *     committers of YAKINDU - initial API and implementation
+ */
+package org.yakindu.sct.runtime.java.test_expression;
+
+import java.util.LinkedList;
+
+import org.yakindu.sct.runtime.java.Event;
+
+public class Test_ExpressionEventBasedStatemachine
+		extends
+			Test_ExpressionCycleBasedStatemachine {
+
+	private LinkedList<Event<? extends Enum<?>>> eventQueue;
+
+	public Test_ExpressionEventBasedStatemachine() {
+		eventQueue = new LinkedList<Event<? extends Enum<?>>>();
+	}
+
+	@Override
+	protected LinkedList<Event<? extends Enum<?>>> getOccuredEvents() {
+		return eventQueue;
+	}
+
+	@Override
+	protected boolean eventOccured() {
+		return !eventQueue.isEmpty();
+	}
+
+	@Override
+	public void runCycle() {
+		if (eventOccured()) {
+			Event<? extends Enum<?>> event = getOccuredEvents().poll();
+			super.getOccuredEvents().add(event);
+			super.runCycle();
+		}
+	}
+}

+ 15 - 0
test-plugins/org.yakindu.sct.generator.java.runtime.test/src-gen/org/yakindu/sct/runtime/java/test_hierarchy/DefaultInterface.java

@@ -17,20 +17,35 @@ public interface DefaultInterface {
 	}
 
 	public void raiseEvent1();
+
 	public void raiseEvent2();
+
 	public void raiseEvent3();
+
 	public void raiseEvent4();
+
 	public void raiseEvent5();
+
 	public void raiseEvent6();
+
 	public void raiseEvent7();
+
 	public void raiseEvent8();
+
 	public void raiseEvent9();
+
 	public void raiseEvent10();
+
 	public void raiseEvent11();
+
 	public void raiseEvent12();
+
 	public void raiseEvent13();
+
 	public void raiseEvent14();
+
 	public void raiseEvent15();
+
 	public void raiseEvent16();
 
 	public int getVarS1();

+ 45 - 0
test-plugins/org.yakindu.sct.generator.java.runtime.test/src-gen/org/yakindu/sct/runtime/java/test_hierarchy/Test_HierarchyEventBasedStatemachine.java

@@ -0,0 +1,45 @@
+/**
+ * Copyright (c) 2011 committers of YAKINDU and others.
+ * All rights reserved. This program and the accompanying materials
+ * are made available under the terms of the Eclipse Public License v1.0
+ * which accompanies this distribution, and is available at
+ * http://www.eclipse.org/legal/epl-v10.html
+ *
+ * Contributors:
+ *     committers of YAKINDU - initial API and implementation
+ */
+package org.yakindu.sct.runtime.java.test_hierarchy;
+
+import java.util.LinkedList;
+
+import org.yakindu.sct.runtime.java.Event;
+
+public class Test_HierarchyEventBasedStatemachine
+		extends
+			Test_HierarchyCycleBasedStatemachine {
+
+	private LinkedList<Event<? extends Enum<?>>> eventQueue;
+
+	public Test_HierarchyEventBasedStatemachine() {
+		eventQueue = new LinkedList<Event<? extends Enum<?>>>();
+	}
+
+	@Override
+	protected LinkedList<Event<? extends Enum<?>>> getOccuredEvents() {
+		return eventQueue;
+	}
+
+	@Override
+	protected boolean eventOccured() {
+		return !eventQueue.isEmpty();
+	}
+
+	@Override
+	public void runCycle() {
+		if (eventOccured()) {
+			Event<? extends Enum<?>> event = getOccuredEvents().poll();
+			super.getOccuredEvents().add(event);
+			super.runCycle();
+		}
+	}
+}

+ 3 - 0
test-plugins/org.yakindu.sct.generator.java.runtime.test/src-gen/org/yakindu/sct/runtime/java/test_localactions/DefaultInterface.java

@@ -17,8 +17,11 @@ public interface DefaultInterface {
 	}
 
 	public void raiseEvent1();
+
 	public void raiseEvent2();
+
 	public void raiseEvent3();
+
 	public void raiseEvent4();
 
 	public int getVarI();

+ 13 - 13
test-plugins/org.yakindu.sct.generator.java.runtime.test/src-gen/org/yakindu/sct/runtime/java/test_localactions/Test_LocalActionsCycleBasedStatemachine.java

@@ -18,7 +18,7 @@ import java.util.Set;
 import org.yakindu.sct.runtime.java.Event;
 import org.yakindu.sct.runtime.java.TimeEvent;
 import org.yakindu.sct.runtime.java.ITimedStatemachine;
-import org.yakindu.sct.runtime.java.ITimerHandler;
+import org.yakindu.sct.runtime.java.ITimerService;
 import org.yakindu.sct.runtime.java.EventNotification;
 import org.yakindu.sct.runtime.java.Notification;
 
@@ -47,7 +47,7 @@ public class Test_LocalActionsCycleBasedStatemachine
 
 	private final Collection<Event<? extends Enum<?>>> outEvents;
 
-	private ITimerHandler timerHandler;
+	private ITimerService timerService;
 
 	private long cycleStartTime;
 
@@ -76,16 +76,16 @@ public class Test_LocalActionsCycleBasedStatemachine
 
 	}
 
-	public void setTimerHandler(ITimerHandler timerHandler) {
-		this.timerHandler = timerHandler;
+	public void setTimerService(ITimerService timerService) {
+		this.timerService = timerService;
 	}
 
-	public ITimerHandler getTimerHandler() {
-		if (timerHandler == null) {
+	public ITimerService getTimerService() {
+		if (timerService == null) {
 			throw new NullPointerException(
-					"TimerHandler of statemachine \"+Test_LocalActions+\" not set!");
+					"TimerService of statemachine \"+Test_LocalActions+\" not set!");
 		}
-		return timerHandler;
+		return timerService;
 	}
 
 	public void notify(Notification<?> notification) {
@@ -105,7 +105,7 @@ public class Test_LocalActionsCycleBasedStatemachine
 
 	public void enter() {
 		cycleStartTime = System.currentTimeMillis();
-		getTimerHandler().setTimer(State1_time_event_0, 100, cycleStartTime);
+		getTimerService().setTimer(State1_time_event_0, 100, cycleStartTime);
 		defaultInterface.setVarI(1);
 
 		activeStates.add(State.State1);
@@ -115,10 +115,10 @@ public class Test_LocalActionsCycleBasedStatemachine
 	private void reactState1() {
 		if (occuredEvents.contains(defaultInterface.getEventEvent1())) {
 			activeStates.remove(State.State1);
-			getTimerHandler().resetTimer(State1_time_event_0);
+			getTimerService().resetTimer(State1_time_event_0);
 			defaultInterface.setVarI(0);
 
-			getTimerHandler()
+			getTimerService()
 					.setTimer(State2_time_event_0, 200, cycleStartTime);
 			defaultInterface.setVarJ(1);
 
@@ -143,10 +143,10 @@ public class Test_LocalActionsCycleBasedStatemachine
 	private void reactState2() {
 		if (occuredEvents.contains(defaultInterface.getEventEvent3())) {
 			activeStates.remove(State.State2);
-			getTimerHandler().resetTimer(State2_time_event_0);
+			getTimerService().resetTimer(State2_time_event_0);
 			defaultInterface.setVarJ(0);
 
-			getTimerHandler()
+			getTimerService()
 					.setTimer(State1_time_event_0, 100, cycleStartTime);
 			defaultInterface.setVarI(1);
 

+ 45 - 0
test-plugins/org.yakindu.sct.generator.java.runtime.test/src-gen/org/yakindu/sct/runtime/java/test_localactions/Test_LocalActionsEventBasedStatemachine.java

@@ -0,0 +1,45 @@
+/**
+ * Copyright (c) 2011 committers of YAKINDU and others.
+ * All rights reserved. This program and the accompanying materials
+ * are made available under the terms of the Eclipse Public License v1.0
+ * which accompanies this distribution, and is available at
+ * http://www.eclipse.org/legal/epl-v10.html
+ *
+ * Contributors:
+ *     committers of YAKINDU - initial API and implementation
+ */
+package org.yakindu.sct.runtime.java.test_localactions;
+
+import java.util.LinkedList;
+
+import org.yakindu.sct.runtime.java.Event;
+
+public class Test_LocalActionsEventBasedStatemachine
+		extends
+			Test_LocalActionsCycleBasedStatemachine {
+
+	private LinkedList<Event<? extends Enum<?>>> eventQueue;
+
+	public Test_LocalActionsEventBasedStatemachine() {
+		eventQueue = new LinkedList<Event<? extends Enum<?>>>();
+	}
+
+	@Override
+	protected LinkedList<Event<? extends Enum<?>>> getOccuredEvents() {
+		return eventQueue;
+	}
+
+	@Override
+	protected boolean eventOccured() {
+		return !eventQueue.isEmpty();
+	}
+
+	@Override
+	public void runCycle() {
+		if (eventOccured()) {
+			Event<? extends Enum<?>> event = getOccuredEvents().poll();
+			super.getOccuredEvents().add(event);
+			super.runCycle();
+		}
+	}
+}

+ 5 - 0
test-plugins/org.yakindu.sct.generator.java.runtime.test/src-gen/org/yakindu/sct/runtime/java/test_parallelregions/DefaultInterface.java

@@ -17,10 +17,15 @@ public interface DefaultInterface {
 	}
 
 	public void raiseEvent1();
+
 	public void raiseEvent2();
+
 	public void raiseEvent3();
+
 	public void raiseEvent4();
+
 	public void raiseEvent5();
+
 	public void raiseEvent6();
 
 }

+ 45 - 0
test-plugins/org.yakindu.sct.generator.java.runtime.test/src-gen/org/yakindu/sct/runtime/java/test_parallelregions/Test_ParallelRegionsEventBasedStatemachine.java

@@ -0,0 +1,45 @@
+/**
+ * Copyright (c) 2011 committers of YAKINDU and others.
+ * All rights reserved. This program and the accompanying materials
+ * are made available under the terms of the Eclipse Public License v1.0
+ * which accompanies this distribution, and is available at
+ * http://www.eclipse.org/legal/epl-v10.html
+ *
+ * Contributors:
+ *     committers of YAKINDU - initial API and implementation
+ */
+package org.yakindu.sct.runtime.java.test_parallelregions;
+
+import java.util.LinkedList;
+
+import org.yakindu.sct.runtime.java.Event;
+
+public class Test_ParallelRegionsEventBasedStatemachine
+		extends
+			Test_ParallelRegionsCycleBasedStatemachine {
+
+	private LinkedList<Event<? extends Enum<?>>> eventQueue;
+
+	public Test_ParallelRegionsEventBasedStatemachine() {
+		eventQueue = new LinkedList<Event<? extends Enum<?>>>();
+	}
+
+	@Override
+	protected LinkedList<Event<? extends Enum<?>>> getOccuredEvents() {
+		return eventQueue;
+	}
+
+	@Override
+	protected boolean eventOccured() {
+		return !eventQueue.isEmpty();
+	}
+
+	@Override
+	public void runCycle() {
+		if (eventOccured()) {
+			Event<? extends Enum<?>> event = getOccuredEvents().poll();
+			super.getOccuredEvents().add(event);
+			super.runCycle();
+		}
+	}
+}

+ 7 - 0
test-plugins/org.yakindu.sct.generator.java.runtime.test/src-gen/org/yakindu/sct/runtime/java/test_shallowhistory/DefaultInterface.java

@@ -17,12 +17,19 @@ public interface DefaultInterface {
 	}
 
 	public void raiseEvent1();
+
 	public void raiseEvent2();
+
 	public void raiseEvent3();
+
 	public void raiseEvent4();
+
 	public void raiseEvent5();
+
 	public void raiseEvent6();
+
 	public void raiseEvent7();
+
 	public void raiseEvent8();
 
 }

+ 45 - 0
test-plugins/org.yakindu.sct.generator.java.runtime.test/src-gen/org/yakindu/sct/runtime/java/test_shallowhistory/Test_ShallowHistoryEventBasedStatemachine.java

@@ -0,0 +1,45 @@
+/**
+ * Copyright (c) 2011 committers of YAKINDU and others.
+ * All rights reserved. This program and the accompanying materials
+ * are made available under the terms of the Eclipse Public License v1.0
+ * which accompanies this distribution, and is available at
+ * http://www.eclipse.org/legal/epl-v10.html
+ *
+ * Contributors:
+ *     committers of YAKINDU - initial API and implementation
+ */
+package org.yakindu.sct.runtime.java.test_shallowhistory;
+
+import java.util.LinkedList;
+
+import org.yakindu.sct.runtime.java.Event;
+
+public class Test_ShallowHistoryEventBasedStatemachine
+		extends
+			Test_ShallowHistoryCycleBasedStatemachine {
+
+	private LinkedList<Event<? extends Enum<?>>> eventQueue;
+
+	public Test_ShallowHistoryEventBasedStatemachine() {
+		eventQueue = new LinkedList<Event<? extends Enum<?>>>();
+	}
+
+	@Override
+	protected LinkedList<Event<? extends Enum<?>>> getOccuredEvents() {
+		return eventQueue;
+	}
+
+	@Override
+	protected boolean eventOccured() {
+		return !eventQueue.isEmpty();
+	}
+
+	@Override
+	public void runCycle() {
+		if (eventOccured()) {
+			Event<? extends Enum<?>> event = getOccuredEvents().poll();
+			super.getOccuredEvents().add(event);
+			super.runCycle();
+		}
+	}
+}

+ 1 - 1
test-plugins/org.yakindu.sct.generator.java.runtime.test/src-gen/org/yakindu/sct/runtime/java/test_transition/DefaultInterface.java

@@ -19,8 +19,8 @@ public interface DefaultInterface extends INotificationSender {
 		Event5, Event6, Event7,
 	}
 
-	public void raiseEvent5();
 	public void raiseEvent5(boolean value);
+
 	public void raiseEvent6();
 	public boolean isRaisedEvent7();
 

+ 0 - 4
test-plugins/org.yakindu.sct.generator.java.runtime.test/src-gen/org/yakindu/sct/runtime/java/test_transition/DefaultInterfaceImpl.java

@@ -31,10 +31,6 @@ public class DefaultInterfaceImpl extends NotificationSender
 		this.statemachine = statemachine;
 	}
 
-	public void raiseEvent5() {
-		statemachine.getOccuredEvents().add(EventEvent5);
-	}
-
 	public void raiseEvent5(boolean value) {
 		EventEvent5.setValue(value);
 		statemachine.getOccuredEvents().add(EventEvent5);

+ 2 - 1
test-plugins/org.yakindu.sct.generator.java.runtime.test/src-gen/org/yakindu/sct/runtime/java/test_transition/InterfaceA.java

@@ -19,9 +19,10 @@ public interface InterfaceA extends INotificationSender {
 		Event1, Event2, Event3, Event4,
 	}
 
-	public void raiseEvent1();
 	public void raiseEvent1(int value);
+
 	public void raiseEvent2();
+
 	public void raiseEvent3();
 	public boolean isRaisedEvent4();
 

+ 0 - 4
test-plugins/org.yakindu.sct.generator.java.runtime.test/src-gen/org/yakindu/sct/runtime/java/test_transition/InterfaceAImpl.java

@@ -29,10 +29,6 @@ public class InterfaceAImpl extends NotificationSender implements InterfaceA {
 		this.statemachine = statemachine;
 	}
 
-	public void raiseEvent1() {
-		statemachine.getOccuredEvents().add(EventEvent1);
-	}
-
 	public void raiseEvent1(int value) {
 		EventEvent1.setValue(value);
 		statemachine.getOccuredEvents().add(EventEvent1);

+ 28 - 28
test-plugins/org.yakindu.sct.generator.java.runtime.test/src-gen/org/yakindu/sct/runtime/java/test_transition/Test_TransitionCycleBasedStatemachine.java

@@ -18,7 +18,7 @@ import java.util.Set;
 import org.yakindu.sct.runtime.java.Event;
 import org.yakindu.sct.runtime.java.TimeEvent;
 import org.yakindu.sct.runtime.java.ITimedStatemachine;
-import org.yakindu.sct.runtime.java.ITimerHandler;
+import org.yakindu.sct.runtime.java.ITimerService;
 import org.yakindu.sct.runtime.java.EventNotification;
 import org.yakindu.sct.runtime.java.Notification;
 import org.yakindu.sct.runtime.java.ValuedEvent;
@@ -56,7 +56,7 @@ public class Test_TransitionCycleBasedStatemachine
 
 	private final Collection<Event<? extends Enum<?>>> outEvents;
 
-	private ITimerHandler timerHandler;
+	private ITimerService timerService;
 
 	private long cycleStartTime;
 
@@ -86,16 +86,16 @@ public class Test_TransitionCycleBasedStatemachine
 
 	}
 
-	public void setTimerHandler(ITimerHandler timerHandler) {
-		this.timerHandler = timerHandler;
+	public void setTimerService(ITimerService timerService) {
+		this.timerService = timerService;
 	}
 
-	public ITimerHandler getTimerHandler() {
-		if (timerHandler == null) {
+	public ITimerService getTimerService() {
+		if (timerService == null) {
 			throw new NullPointerException(
-					"TimerHandler of statemachine \"+Test_Transition+\" not set!");
+					"TimerService of statemachine \"+Test_Transition+\" not set!");
 		}
-		return timerHandler;
+		return timerService;
 	}
 
 	public void notify(Notification<?> notification) {
@@ -132,9 +132,9 @@ public class Test_TransitionCycleBasedStatemachine
 
 	public void enter() {
 		cycleStartTime = System.currentTimeMillis();
-		getTimerHandler().setTimer(State1_time_event_0, (10 * 1000),
+		getTimerService().setTimer(State1_time_event_0, (10 * 1000),
 				cycleStartTime);
-		getTimerHandler().setTimer(State1_time_event_1, 100, cycleStartTime);
+		getTimerService().setTimer(State1_time_event_1, 100, cycleStartTime);
 
 		activeStates.add(State.State1);
 
@@ -144,16 +144,16 @@ public class Test_TransitionCycleBasedStatemachine
 		if ((occuredEvents.contains(interfaceA.getEventEvent1()) || occuredEvents
 				.contains(interfaceA.getEventEvent2()))) {
 			activeStates.remove(State.State1);
-			getTimerHandler().resetTimer(State1_time_event_0);
-			getTimerHandler().resetTimer(State1_time_event_1);
+			getTimerService().resetTimer(State1_time_event_0);
+			getTimerService().resetTimer(State1_time_event_1);
 
 			activeStates.add(State.State2);
 
 		} else {
 			if ((defaultInterface.getVarI() == 5)) {
 				activeStates.remove(State.State1);
-				getTimerHandler().resetTimer(State1_time_event_0);
-				getTimerHandler().resetTimer(State1_time_event_1);
+				getTimerService().resetTimer(State1_time_event_0);
+				getTimerService().resetTimer(State1_time_event_1);
 
 				activeStates.add(State.State2);
 
@@ -161,8 +161,8 @@ public class Test_TransitionCycleBasedStatemachine
 				if ((occuredEvents.contains(interfaceA.getEventEvent3()) && (defaultInterface
 						.getVarJ() < 20))) {
 					activeStates.remove(State.State1);
-					getTimerHandler().resetTimer(State1_time_event_0);
-					getTimerHandler().resetTimer(State1_time_event_1);
+					getTimerService().resetTimer(State1_time_event_0);
+					getTimerService().resetTimer(State1_time_event_1);
 
 					activeStates.add(State.State2);
 
@@ -171,8 +171,8 @@ public class Test_TransitionCycleBasedStatemachine
 							.contains(interfaceA.getEventEvent4())) && (defaultInterface
 							.getVarJ() > 30))) {
 						activeStates.remove(State.State1);
-						getTimerHandler().resetTimer(State1_time_event_0);
-						getTimerHandler().resetTimer(State1_time_event_1);
+						getTimerService().resetTimer(State1_time_event_0);
+						getTimerService().resetTimer(State1_time_event_1);
 
 						activeStates.add(State.State2);
 
@@ -180,8 +180,8 @@ public class Test_TransitionCycleBasedStatemachine
 						if (occuredEvents.contains(defaultInterface
 								.getEventEvent6())) {
 							activeStates.remove(State.State1);
-							getTimerHandler().resetTimer(State1_time_event_0);
-							getTimerHandler().resetTimer(State1_time_event_1);
+							getTimerService().resetTimer(State1_time_event_0);
+							getTimerService().resetTimer(State1_time_event_1);
 
 							defaultInterface.setVarI(15);
 
@@ -191,9 +191,9 @@ public class Test_TransitionCycleBasedStatemachine
 							if (occuredEvents.contains(defaultInterface
 									.getEventEvent7())) {
 								activeStates.remove(State.State1);
-								getTimerHandler().resetTimer(
+								getTimerService().resetTimer(
 										State1_time_event_0);
-								getTimerHandler().resetTimer(
+								getTimerService().resetTimer(
 										State1_time_event_1);
 
 								defaultInterface.setVarJ((defaultInterface
@@ -204,9 +204,9 @@ public class Test_TransitionCycleBasedStatemachine
 							} else {
 								if (occuredEvents.contains(State1_time_event_0)) {
 									activeStates.remove(State.State1);
-									getTimerHandler().resetTimer(
+									getTimerService().resetTimer(
 											State1_time_event_0);
-									getTimerHandler().resetTimer(
+									getTimerService().resetTimer(
 											State1_time_event_1);
 
 									activeStates.add(State.State2);
@@ -215,9 +215,9 @@ public class Test_TransitionCycleBasedStatemachine
 									if (occuredEvents
 											.contains(State1_time_event_1)) {
 										activeStates.remove(State.State1);
-										getTimerHandler().resetTimer(
+										getTimerService().resetTimer(
 												State1_time_event_0);
-										getTimerHandler().resetTimer(
+										getTimerService().resetTimer(
 												State1_time_event_1);
 
 										activeStates.add(State.State2);
@@ -226,9 +226,9 @@ public class Test_TransitionCycleBasedStatemachine
 										if (occuredEvents.contains(interfaceA
 												.getEventEvent1())) {
 											activeStates.remove(State.State1);
-											getTimerHandler().resetTimer(
+											getTimerService().resetTimer(
 													State1_time_event_0);
-											getTimerHandler().resetTimer(
+											getTimerService().resetTimer(
 													State1_time_event_1);
 
 											activeStates.add(State.State2);

+ 45 - 0
test-plugins/org.yakindu.sct.generator.java.runtime.test/src-gen/org/yakindu/sct/runtime/java/test_transition/Test_TransitionEventBasedStatemachine.java

@@ -0,0 +1,45 @@
+/**
+ * Copyright (c) 2011 committers of YAKINDU and others.
+ * All rights reserved. This program and the accompanying materials
+ * are made available under the terms of the Eclipse Public License v1.0
+ * which accompanies this distribution, and is available at
+ * http://www.eclipse.org/legal/epl-v10.html
+ *
+ * Contributors:
+ *     committers of YAKINDU - initial API and implementation
+ */
+package org.yakindu.sct.runtime.java.test_transition;
+
+import java.util.LinkedList;
+
+import org.yakindu.sct.runtime.java.Event;
+
+public class Test_TransitionEventBasedStatemachine
+		extends
+			Test_TransitionCycleBasedStatemachine {
+
+	private LinkedList<Event<? extends Enum<?>>> eventQueue;
+
+	public Test_TransitionEventBasedStatemachine() {
+		eventQueue = new LinkedList<Event<? extends Enum<?>>>();
+	}
+
+	@Override
+	protected LinkedList<Event<? extends Enum<?>>> getOccuredEvents() {
+		return eventQueue;
+	}
+
+	@Override
+	protected boolean eventOccured() {
+		return !eventQueue.isEmpty();
+	}
+
+	@Override
+	public void runCycle() {
+		if (eventOccured()) {
+			Event<? extends Enum<?>> event = getOccuredEvents().poll();
+			super.getOccuredEvents().add(event);
+			super.runCycle();
+		}
+	}
+}

+ 25 - 0
test-plugins/org.yakindu.sct.generator.java.runtime.test/src/org/yakindu/sct/generator/java/runtime/test/AllEventBasedStatemachineTests.java

@@ -0,0 +1,25 @@
+/**
+ * Copyright (c) 2011 committers of YAKINDU and others.
+ * All rights reserved. This program and the accompanying materials
+ * are made available under the terms of the Eclipse Public License v1.0
+ * which accompanies this distribution, and is available at
+ * http://www.eclipse.org/legal/epl-v10.html
+ * Contributors:
+ * 	@author markus muehlbrandt - initial API and implementation
+ * 
+ */
+package org.yakindu.sct.generator.java.runtime.test;
+
+import org.junit.runner.RunWith;
+import org.junit.runners.Suite;
+
+@RunWith(Suite.class)
+@Suite.SuiteClasses({ 
+		TestInterfaceTestEventBasedStatemachine.class,
+		TestLocalActionsEventBasedStatemachine.class,
+		TestExpressionEventBasedStatemachine.class,
+		TestHierarchyEventBasedStatemachine.class
+		})
+
+public class AllEventBasedStatemachineTests {
+}

+ 3 - 3
test-plugins/org.yakindu.sct.generator.java.runtime.test/src/org/yakindu/sct/generator/java/runtime/test/TestExpressionCycleBasedStatemachine.java

@@ -27,7 +27,7 @@ public class TestExpressionCycleBasedStatemachine {
 		assertEquals("Var3 value not set correct: ", 2405.6, statemachine
 				.getDefaultInterface().getVarVar3(),Math.pow(10, -8));
 		
-		statemachine.getDefaultInterface().raiseEvent1();
+		statemachine.getDefaultInterface().raiseEvent1(0);
 		statemachine.runCycle();
 		assertEquals("Other.Var1 value not set correct: ", false, statemachine
 				.getInterfaceOther().getVarVar1());
@@ -64,14 +64,14 @@ public class TestExpressionCycleBasedStatemachine {
 		assertEquals("Default.Var1 value not set correct: ", 9, statemachine
 				.getDefaultInterface().getVarVar1());
 		
-		statemachine.getDefaultInterface().raiseEvent1();
+		statemachine.getDefaultInterface().raiseEvent1(0);
 		statemachine.runCycle();
 		assertEquals("Default.Var5 value not set correct: ", true, statemachine
 				.getDefaultInterface().getVarVar5());
 		assertEquals("Other.Var3 value not set correct: ", 962.24, statemachine
 				.getDefaultInterface().getVarVar3(),Math.pow(10, -8));
 		
-		statemachine.getDefaultInterface().raiseEvent1();
+		statemachine.getDefaultInterface().raiseEvent1(0);
 		statemachine.runCycle();
 		assertEquals("Other.Var3 value not set correct: ", 962.24, statemachine
 				.getDefaultInterface().getVarVar3(),Math.pow(10, -8));

+ 103 - 0
test-plugins/org.yakindu.sct.generator.java.runtime.test/src/org/yakindu/sct/generator/java/runtime/test/TestExpressionEventBasedStatemachine.java

@@ -0,0 +1,103 @@
+package org.yakindu.sct.generator.java.runtime.test;
+
+import static org.junit.Assert.assertEquals;
+
+import org.junit.After;
+import org.junit.Before;
+import org.junit.Test;
+import org.yakindu.sct.runtime.java.RuntimeService;
+import org.yakindu.sct.runtime.java.test_expression.Test_ExpressionEventBasedStatemachine;
+
+public class TestExpressionEventBasedStatemachine {
+
+	private Test_ExpressionEventBasedStatemachine statemachine;
+
+	private RuntimeService runtimeService;
+
+	// Minimal cycletime
+	private final long cyclePeriod = 1;
+
+	@Before
+	public void setUp() {
+		statemachine = new Test_ExpressionEventBasedStatemachine();
+		statemachine.enter();
+		runtimeService = new RuntimeService(cyclePeriod);
+		runtimeService.addStatemachine(statemachine);
+	}
+
+	@After
+	public void tearDown() {
+		runtimeService.removeStatemachine(statemachine);
+		runtimeService.cancel();
+		statemachine = null;
+	}
+
+	private void sleep(long time) {
+
+		try {
+			Thread.sleep(time);
+		} catch (InterruptedException e) {
+			e.printStackTrace();
+		}
+	}
+
+	@Test
+	public void testCycles() {
+		assertEquals("Var3 value not set correct: ", 2405.6, statemachine
+				.getDefaultInterface().getVarVar3(), Math.pow(10, -8));
+
+		statemachine.getDefaultInterface().raiseEvent1(0);
+		sleep(5);
+		assertEquals("Other.Var1 value not set correct: ", false, statemachine
+				.getInterfaceOther().getVarVar1());
+		assertEquals("Default.Var2 value not set correct: ", 1, statemachine
+				.getDefaultInterface().getVarVar2());
+		assertEquals("Default.Var4 value not set correct: ", 22.3, statemachine
+				.getDefaultInterface().getVarVar4(), Math.pow(10, -8));
+		assertEquals("Other.Var3 value not set correct: ", 481.12, statemachine
+				.getDefaultInterface().getVarVar3(), Math.pow(10, -8));
+		assertEquals("Default.Var1 value not set correct: ", 7, statemachine
+				.getDefaultInterface().getVarVar1());
+
+		// Trigger oncycle expression with event
+		statemachine.getDefaultInterface().raiseEvent3();
+		sleep(5);
+		assertEquals("Other.Var1 value not set correct: ", false, statemachine
+				.getInterfaceOther().getVarVar1());
+		assertEquals("Default.Var2 value not set correct: ", 1, statemachine
+				.getDefaultInterface().getVarVar2());
+		assertEquals("Default.Var4 value not set correct: ", 22.3, statemachine
+				.getDefaultInterface().getVarVar4(), Math.pow(10, -8));
+		assertEquals("Other.Var3 value not set correct: ", 481.12, statemachine
+				.getDefaultInterface().getVarVar3(), Math.pow(10, -8));
+		assertEquals("Default.Var1 value not set correct: ", 8, statemachine
+				.getDefaultInterface().getVarVar1());
+
+		// Trigger oncycle expression with event
+		statemachine.getDefaultInterface().raiseEvent3();
+		sleep(5);
+		assertEquals("Other.Var1 value not set correct: ", false, statemachine
+				.getInterfaceOther().getVarVar1());
+		assertEquals("Default.Var2 value not set correct: ", 1, statemachine
+				.getDefaultInterface().getVarVar2());
+		assertEquals("Default.Var4 value not set correct: ", 22.3, statemachine
+				.getDefaultInterface().getVarVar4(), Math.pow(10, -8));
+		assertEquals("Other.Var3 value not set correct: ", 481.12, statemachine
+				.getDefaultInterface().getVarVar3(), Math.pow(10, -8));
+		assertEquals("Default.Var1 value not set correct: ", 9, statemachine
+				.getDefaultInterface().getVarVar1());
+
+		statemachine.getDefaultInterface().raiseEvent1(0);
+		sleep(5);
+		assertEquals("Default.Var5 value not set correct: ", true, statemachine
+				.getDefaultInterface().getVarVar5());
+		assertEquals("Other.Var3 value not set correct: ", 962.24, statemachine
+				.getDefaultInterface().getVarVar3(), Math.pow(10, -8));
+
+		statemachine.getDefaultInterface().raiseEvent1(0);
+		sleep(5);
+		assertEquals("Other.Var3 value not set correct: ", 962.24, statemachine
+				.getDefaultInterface().getVarVar3(), Math.pow(10, -8));
+
+	}
+}

+ 164 - 0
test-plugins/org.yakindu.sct.generator.java.runtime.test/src/org/yakindu/sct/generator/java/runtime/test/TestHierarchyEventBasedStatemachine.java

@@ -0,0 +1,164 @@
+/**
+ * Copyright (c) 2011 committers of YAKINDU and others.
+ * All rights reserved. This program and the accompanying materials
+ * are made available under the terms of the Eclipse Public License v1.0
+ * which accompanies this distribution, and is available at
+ * http://www.eclipse.org/legal/epl-v10.html
+ * Contributors:
+ * 	@author markus muehlbrandt - initial API and implementation
+ * 
+ */
+package org.yakindu.sct.generator.java.runtime.test;
+
+import static org.junit.Assert.assertEquals;
+
+import org.junit.After;
+import org.junit.Before;
+import org.junit.Test;
+import org.yakindu.sct.runtime.java.RuntimeService;
+import org.yakindu.sct.runtime.java.test_hierarchy.Test_HierarchyEventBasedStatemachine;
+
+/**
+ * Testcases for 'Test_LocalActions' cycle based statemachine.
+ * 
+ * @author muehlbrandt
+ * 
+ */
+public class TestHierarchyEventBasedStatemachine {
+
+	private Test_HierarchyEventBasedStatemachine statemachine;
+	
+	private RuntimeService runtimeService;
+
+	// Minimal cycletime
+	private final long cyclePeriod = 1;
+
+	@Before
+	public void setUp() {
+		statemachine = new Test_HierarchyEventBasedStatemachine();
+		statemachine.enter();
+		runtimeService = new RuntimeService(cyclePeriod);
+		runtimeService.addStatemachine(statemachine);
+	}
+
+	@After
+	public void tearDown() {
+		runtimeService.removeStatemachine(statemachine);
+		runtimeService.cancel();
+		statemachine = null;
+	}
+
+	private void sleep(long time) {
+		try {
+			Thread.sleep(time);
+		} catch (InterruptedException e) {
+			e.printStackTrace();
+		}
+	}
+
+	@Test
+	public void testState1() {
+		assertEquals("s1 value not set correct: ", 2, statemachine
+				.getDefaultInterface().getVarS1());
+		assertEquals("s2 value not set correct: ", 0, statemachine
+				.getDefaultInterface().getVarS2());
+
+		statemachine.getDefaultInterface().raiseEvent9();
+		sleep(2);
+		assertEquals("s1 value not set correct: ", 2, statemachine
+				.getDefaultInterface().getVarS1());
+		assertEquals("s2 value not set correct: ", 0, statemachine
+				.getDefaultInterface().getVarS2());
+
+		statemachine.getDefaultInterface().raiseEvent10();
+		sleep(2);
+		assertEquals("s1 value not set correct: ", 2, statemachine
+				.getDefaultInterface().getVarS1());
+		assertEquals("s2 value not set correct: ", 0, statemachine
+				.getDefaultInterface().getVarS2());
+
+		statemachine.getDefaultInterface().raiseEvent1();
+		sleep(2);
+		assertEquals("s1 value not set correct: ", 0, statemachine
+				.getDefaultInterface().getVarS1());
+		assertEquals("s2 value not set correct: ", 2, statemachine
+				.getDefaultInterface().getVarS2());
+
+		statemachine.getDefaultInterface().raiseEvent14();
+		sleep(2);
+		assertEquals("s1 value not set correct: ", 2, statemachine
+				.getDefaultInterface().getVarS1());
+		assertEquals("s2 value not set correct: ", 0, statemachine
+				.getDefaultInterface().getVarS2());
+
+		statemachine.getDefaultInterface().raiseEvent1();
+		statemachine.getDefaultInterface().raiseEvent2();
+		sleep(4);
+		assertEquals("s1 value not set correct: ", 0, statemachine
+				.getDefaultInterface().getVarS1());
+		assertEquals("s2 value not set correct: ", 3, statemachine
+				.getDefaultInterface().getVarS2());
+
+		statemachine.getDefaultInterface().raiseEvent15();
+		sleep(2);
+		assertEquals("s1 value not set correct: ", 2, statemachine
+				.getDefaultInterface().getVarS1());
+		assertEquals("s2 value not set correct: ", 0, statemachine
+				.getDefaultInterface().getVarS2());
+
+		statemachine.getDefaultInterface().raiseEvent1();
+		statemachine.getDefaultInterface().raiseEvent2();
+		statemachine.getDefaultInterface().raiseEvent3();
+		sleep(6);
+		assertEquals("s1 value not set correct: ", 0, statemachine
+				.getDefaultInterface().getVarS1());
+		assertEquals("s2 value not set correct: ", 4, statemachine
+				.getDefaultInterface().getVarS2());
+
+		statemachine.getDefaultInterface().raiseEvent4();
+		sleep(2);
+		assertEquals("s1 value not set correct: ", 0, statemachine
+				.getDefaultInterface().getVarS1());
+		assertEquals("s2 value not set correct: ", 4, statemachine
+				.getDefaultInterface().getVarS2());
+
+		statemachine.getDefaultInterface().raiseEvent16();
+		sleep(2);
+		assertEquals("s1 value not set correct: ", 2, statemachine
+				.getDefaultInterface().getVarS1());
+		assertEquals("s2 value not set correct: ", 0, statemachine
+				.getDefaultInterface().getVarS2());
+
+		statemachine.getDefaultInterface().raiseEvent1();
+		statemachine.getDefaultInterface().raiseEvent2();
+		statemachine.getDefaultInterface().raiseEvent3();
+		statemachine.getDefaultInterface().raiseEvent4();
+		statemachine.getDefaultInterface().raiseEvent5();
+		sleep(10);
+		assertEquals("s1 value not set correct: ", 0, statemachine
+				.getDefaultInterface().getVarS1());
+		assertEquals("s2 value not set correct: ", 4, statemachine
+				.getDefaultInterface().getVarS2());
+
+		statemachine.getDefaultInterface().raiseEvent8();
+		sleep(2);
+		assertEquals("s1 value not set correct: ", 0, statemachine
+				.getDefaultInterface().getVarS1());
+		assertEquals("s2 value not set correct: ", 3, statemachine
+				.getDefaultInterface().getVarS2());
+
+		statemachine.getDefaultInterface().raiseEvent7();
+		sleep(2);
+		assertEquals("s1 value not set correct: ", 0, statemachine
+				.getDefaultInterface().getVarS1());
+		assertEquals("s2 value not set correct: ", 2, statemachine
+				.getDefaultInterface().getVarS2());
+
+		statemachine.getDefaultInterface().raiseEvent6();
+		sleep(2);
+		assertEquals("s1 value not set correct: ", 2, statemachine
+				.getDefaultInterface().getVarS1());
+		assertEquals("s2 value not set correct: ", 0, statemachine
+				.getDefaultInterface().getVarS2());
+	}
+}

+ 275 - 0
test-plugins/org.yakindu.sct.generator.java.runtime.test/src/org/yakindu/sct/generator/java/runtime/test/TestInterfaceTestEventBasedStatemachine.java

@@ -0,0 +1,275 @@
+/**
+ * Copyright (c) 2011 committers of YAKINDU and others.
+ * All rights reserved. This program and the accompanying materials
+ * are made available under the terms of the Eclipse Public License v1.0
+ * which accompanies this distribution, and is available at
+ * http://www.eclipse.org/legal/epl-v10.html
+ * Contributors:
+ * 	@author markus muehlbrandt - initial API and implementation
+ * 
+ */
+package org.yakindu.sct.generator.java.runtime.test;
+
+import static org.junit.Assert.assertEquals;
+import static org.junit.Assert.assertFalse;
+import static org.junit.Assert.assertTrue;
+import static org.junit.Assert.fail;
+
+import org.junit.After;
+import org.junit.Before;
+import org.junit.Test;
+import org.yakindu.sct.runtime.java.INotificationListener;
+import org.yakindu.sct.runtime.java.Notification;
+import org.yakindu.sct.runtime.java.RuntimeService;
+import org.yakindu.sct.runtime.java.interfacetest.InterfaceTestCycleBasedStatemachine.State;
+import org.yakindu.sct.runtime.java.interfacetest.InterfaceTestEventBasedStatemachine;
+
+/**
+ * Testcases for 'InterfaceTest' event based statemachine.
+ * 
+ * @author muehlbrandt
+ * 
+ */
+public class TestInterfaceTestEventBasedStatemachine {
+
+	private InterfaceTestEventBasedStatemachine statemachine;
+
+	private RuntimeService runtimeService;
+
+	// Minimal cycletime
+	private final long cyclePeriod = 1;
+
+	private static boolean[] events = new boolean[3];
+
+	@Before
+	public void setUp() {
+		for (byte i = 0; i < events.length; i++) {
+			events[i] = false;
+		}
+		statemachine = new InterfaceTestEventBasedStatemachine();
+		statemachine.getDefaultInterface().addNotificationListener(
+				new INotificationListener() {
+
+					public void notify(Notification<?> notification) {
+						if (notification.getElement() == statemachine
+								.getDefaultInterface().getEventEvent2()) {
+							events[0] = true;
+						}
+					}
+				});
+		statemachine.getInterfaceOther().addNotificationListener(
+				new INotificationListener() {
+
+					public void notify(Notification<?> notification) {
+						if (notification.getElement() == statemachine
+								.getInterfaceOther().getEventEvent4()) {
+							events[1] = true;
+						}
+					}
+				});
+		statemachine.getInterfaceThird().addNotificationListener(
+				new INotificationListener() {
+					public void notify(Notification<?> notification) {
+						if (notification.getElement() == statemachine
+								.getInterfaceThird().getEventEvent6()) {
+							events[2] = true;
+						}
+					}
+				});
+		statemachine.enter();
+
+		runtimeService = new RuntimeService(cyclePeriod);
+		runtimeService.addStatemachine(statemachine);
+	}
+
+	@After
+	public void tearDown() {
+		runtimeService.cancel();
+		statemachine = null;
+	}
+
+	private void sleep(long time) {
+		try {
+			Thread.sleep(time);
+		} catch (InterruptedException e) {
+			e.printStackTrace();
+		}
+	}
+
+	@Test
+	public void testExceptionHandling() {
+		// Value of Event 2 should not be set to null
+		try {
+			statemachine.getDefaultInterface().getEventEvent2().setValue(null);
+			fail("statemachine.getDefaultInterface().getEventEvent2().setValue(null) should throw IllegalArgumentException");
+		} catch (IllegalArgumentException exception) {
+		}
+
+		// Value of Event 6 should not be set to null
+		try {
+			statemachine.getInterfaceThird().getEventEvent6().setValue(null);
+			fail("statemachine.getDefaultInterface().getEventEvent2().setValue(null) should throw IllegalArgumentException");
+		} catch (IllegalArgumentException exception) {
+		}
+	}
+
+	@Test
+	public void testStatemachineEntry() {
+		assertEquals("InterfaceDefault.Var2 is not correct initialized:", 2.3,
+				statemachine.getDefaultInterface().getVarVar2(),
+				Math.pow(10, -8));
+		assertEquals("InterfaceDefault.Var3 is not correct initialized:", 1,
+				statemachine.getDefaultInterface().getVarVar3());
+		assertTrue("Statemachine isn't in State: " + State.State1.name() + ".",
+				statemachine.getActiveStates().contains(State.State1));
+		assertEquals("More than one state is active.", 1, statemachine
+				.getActiveStates().size());
+	}
+
+	@Test
+	public void testStatemachineRunCycle_1() {
+
+		statemachine.getDefaultInterface().raiseEvent1();
+		sleep(5);
+		// Test if state is changed to State2
+		assertTrue("Statemachine isn't in State: " + State.State2.name() + ".",
+				statemachine.getActiveStates().contains(State.State2));
+		// Test if only one state is active
+		assertEquals("More than one state is active.", 1, statemachine
+				.getActiveStates().size());
+		// Test if event2 is raised (happens in entry of State2
+		assertTrue("Event 2 not raised: ", events[0]);
+		// Test if event2 value is set to 22 (happens in entry of State2
+		assertEquals("Event 2 value not set correct: ", 22, statemachine
+				.getDefaultInterface().getEventEvent2().getValue().intValue());
+
+		statemachine.getDefaultInterface().raiseEvent1();
+		sleep(2);
+		// Test if statemachine is back in State 1
+		assertTrue("Statemachine isn't in State: " + State.State1.name() + ".",
+				statemachine.getActiveStates().contains(State.State1));
+		// Test if only one state is active
+		assertEquals("More than one state is active.", 1, statemachine
+				.getActiveStates().size());
+		// Event 2 shouldn't be raised anymore
+		assertFalse("Event is still raised: ", statemachine
+				.getDefaultInterface().isRaisedEvent2());
+	}
+
+	@Test
+	public void testStatemachineRunCycle_2() {
+		statemachine.getDefaultInterface().setVarVar2(-12.6);
+		statemachine.getDefaultInterface().raiseEvent1();
+		sleep(2);
+		// Test if statemachine is still in State 1
+		assertTrue("Statemachine isn't in State: " + State.State1.name() + ".",
+				statemachine.getActiveStates().contains(State.State1));
+		// Test if only one state is active
+		assertEquals("More than one state is active.", 1, statemachine
+				.getActiveStates().size());
+		// Event 2 shouldn't be raised
+		assertFalse("Event is still raised: ", statemachine
+				.getDefaultInterface().isRaisedEvent2());
+		// Event 2 value should not be set to 22
+		assertTrue("Event value is set to 22: ", statemachine
+				.getDefaultInterface().getEventEvent2().getValue() != 22);
+
+		statemachine.getDefaultInterface().setVarVar2(213.55);
+		statemachine.getDefaultInterface().raiseEvent1();
+		sleep(2);
+		// Test if state is changed to State2
+		assertTrue("Statemachine isn't in State: " + State.State2.name() + ".",
+				statemachine.getActiveStates().contains(State.State2));
+		// Test if only one state is active
+		assertEquals("More than one state is active.", 1, statemachine
+				.getActiveStates().size());
+		// Test if event2 is raised (happens in entry of State2
+		assertTrue("Event 2 not raised: ", events[0]);
+		// Test if event2 value is set to 22 (happens in entry of State2
+		assertEquals("Event 2 value not set correct: ", 22, statemachine
+				.getDefaultInterface().getEventEvent2().getValue().intValue());
+	}
+
+	@Test
+	public void testStatemachineRunCycle_3() {
+		statemachine.getInterfaceOther().raiseEvent3();
+		sleep(2);
+		// Test if state is changed to State3
+		assertTrue("Statemachine isn't in State: " + State.State3.name() + ".",
+				statemachine.getActiveStates().contains(State.State3));
+		// Test if only one state is active
+		assertEquals("More than one state is active.", 1, statemachine
+				.getActiveStates().size());
+		// Test if event4 is raised (happens in entry of State3
+		assertTrue("Event not raised: ", events[1]);
+
+		statemachine.getInterfaceOther().raiseEvent3();
+		sleep(2);
+		// Test if statemachine is back in State 1
+		assertTrue("Statemachine isn't in State: " + State.State1.name() + ".",
+				statemachine.getActiveStates().contains(State.State1));
+		// Test if only one state is active
+		assertEquals("More than one state is active.", 1, statemachine
+				.getActiveStates().size());
+		// Event 4 shouldn't be raised anymore
+		assertFalse("Event is still raised: ", statemachine.getInterfaceOther()
+				.isRaisedEvent4());
+	}
+
+	@Test
+	public void testStatemachineRunCycle_4() {
+		statemachine.getDefaultInterface().setVarVar3(2);
+		statemachine.getInterfaceOther().raiseEvent3();
+		sleep(2);
+		// Test if state is changed to State1
+		assertTrue("Statemachine isn't in State: " + State.State1.name() + ".",
+				statemachine.getActiveStates().contains(State.State1));
+		// Test if only one state is active
+		assertEquals("More than one state is active.", 1, statemachine
+				.getActiveStates().size());
+		// Test if event4 is not raised
+		assertFalse("Event not raised: ", events[1]);
+
+		statemachine.getDefaultInterface().setVarVar3(1);
+		statemachine.getInterfaceOther().raiseEvent3();
+		sleep(2);
+		// Test if state is changed to State3
+		assertTrue("Statemachine isn't in State: " + State.State3.name() + ".",
+				statemachine.getActiveStates().contains(State.State3));
+		// Test if only one state is active
+		assertEquals("More than one state is active.", 1, statemachine
+				.getActiveStates().size());
+		// Test if event4 is raised (happens in entry of State3
+		assertTrue("Event not raised: ", events[1]);
+	}
+
+	@Test
+	public void testStatemachineRunCycle_5() {
+		statemachine.getDefaultInterface().setVarVar1(true);
+		statemachine.getInterfaceThird().raiseEvent5();
+		sleep(2);
+		// Test if state is changed to State4
+		assertTrue("Statemachine isn't in State: " + State.State4.name() + ".",
+				statemachine.getActiveStates().contains(State.State4));
+		// Test if only one state is active
+		assertEquals("More than one state is active.", 1, statemachine
+				.getActiveStates().size());
+		// Test if event6 is raised
+		assertTrue("Event not raised: ", events[2]);
+		// Test if event6 is set to true;
+		assertTrue("Event 6 not set: ", statemachine.getInterfaceThird()
+				.getEventEvent6().getValue());
+
+		statemachine.getInterfaceThird().raiseEvent5();
+		sleep(2);
+		// Test if state is changed to State1
+		assertTrue("Statemachine isn't in State: " + State.State1.name() + ".",
+				statemachine.getActiveStates().contains(State.State1));
+		// Test if only one state is active
+		assertEquals("More than one state is active.", 1, statemachine
+				.getActiveStates().size());
+		// Test if event6 is not raised
+		assertFalse("Event raised: ", statemachine.getInterfaceThird()
+				.isRaisedEvent6());
+	}
+}

+ 3 - 3
test-plugins/org.yakindu.sct.generator.java.runtime.test/src/org/yakindu/sct/generator/java/runtime/test/TestLocalActionsCycleBasedStatemachine.java

@@ -17,7 +17,7 @@ import static org.junit.Assert.fail;
 import org.junit.After;
 import org.junit.Before;
 import org.junit.Test;
-import org.yakindu.sct.runtime.java.TimerHandler;
+import org.yakindu.sct.runtime.java.TimerService;
 import org.yakindu.sct.runtime.java.test_localactions.Test_LocalActionsCycleBasedStatemachine.State;
 import org.yakindu.sct.runtime.java.test_localactions.Test_LocalActionsCycleBasedStatemachine;
 
@@ -43,13 +43,13 @@ public class TestLocalActionsCycleBasedStatemachine {
 	@Before
 	public void setUp() {
 		statemachine = new Test_LocalActionsCycleBasedStatemachine();
-		statemachine.setTimerHandler(new TimerHandler());
+		statemachine.setTimerService(new TimerService());
 		statemachine.enter();
 	}
 
 	@After
 	public void tearDown() {
-		statemachine.getTimerHandler().cancel();
+		statemachine.getTimerService().cancel();
 		statemachine = null;
 	}
 

+ 161 - 0
test-plugins/org.yakindu.sct.generator.java.runtime.test/src/org/yakindu/sct/generator/java/runtime/test/TestLocalActionsEventBasedStatemachine.java

@@ -0,0 +1,161 @@
+/**
+ * Copyright (c) 2011 committers of YAKINDU and others.
+ * All rights reserved. This program and the accompanying materials
+ * are made available under the terms of the Eclipse Public License v1.0
+ * which accompanies this distribution, and is available at
+ * http://www.eclipse.org/legal/epl-v10.html
+ * Contributors:
+ * 	@author markus muehlbrandt - initial API and implementation
+ * 
+ */
+package org.yakindu.sct.generator.java.runtime.test;
+
+import static org.junit.Assert.assertEquals;
+import static org.junit.Assert.assertTrue;
+import static org.junit.Assert.fail;
+
+import org.junit.After;
+import org.junit.Before;
+import org.junit.Test;
+import org.yakindu.sct.runtime.java.RuntimeService;
+import org.yakindu.sct.runtime.java.TimerService;
+import org.yakindu.sct.runtime.java.test_localactions.Test_LocalActionsCycleBasedStatemachine.State;
+import org.yakindu.sct.runtime.java.test_localactions.Test_LocalActionsCycleBasedStatemachine;
+import org.yakindu.sct.runtime.java.test_localactions.Test_LocalActionsEventBasedStatemachine;
+
+/**
+ * Testcases for 'Test_LocalActions' cycle based statemachine.
+ * 
+ * @author muehlbrandt
+ * 
+ */
+public class TestLocalActionsEventBasedStatemachine {
+
+	private Test_LocalActionsEventBasedStatemachine statemachine;
+
+	// Define the error threshold in ms. 10 ms are required to satisfy
+	// soft-realtime requirements.
+	private final long timerThreshold = 10;
+
+	// Define sleeptime in ms of JUnit Test between statemachine "runCycle()"
+	// calls. So the TimerHandler Thread get's a chance to throw a timed event
+	// within the timerThreshold time.
+	private final long junitSleepTime = 1;
+
+	private RuntimeService runtimeService;
+
+	// Minimal cycletime
+	private final long cyclePeriod = 1;
+
+	@Before
+	public void setUp() {
+		statemachine = new Test_LocalActionsEventBasedStatemachine();
+		statemachine.setTimerService(new TimerService());
+		statemachine.enter();
+		runtimeService = new RuntimeService(cyclePeriod);
+		runtimeService.addStatemachine(statemachine);
+	}
+
+	@After
+	public void tearDown() {
+		runtimeService.cancel();
+		statemachine.getTimerService().cancel();
+		statemachine = null;
+	}
+
+	@Test
+	public void testExceptionHandling() {
+		try {
+			Test_LocalActionsCycleBasedStatemachine statemachine = new Test_LocalActionsCycleBasedStatemachine();
+			statemachine.enter();
+			fail("Statemachine should throw a NullPointerException if entered without TimerHandler set before");
+		} catch (NullPointerException exception) {
+
+		}
+	}
+
+	@Test
+	public void testStatemachineEntry() {
+		assertTrue("Statemachine isn't in State: " + State.State1.name() + ".",
+				statemachine.getActiveStates().contains(State.State1));
+		assertEquals("More than one state is active.", 1, statemachine
+				.getActiveStates().size());
+		assertEquals("Variable i not set to 1", 1, statemachine
+				.getDefaultInterface().getVarI());
+	}
+
+	@Test
+	public void testState1LocalReaction() throws InterruptedException {
+		final long time = System.currentTimeMillis();
+
+		assertEquals("Error in local reaction \"Entry / i=1;\" of State1", 1,
+				statemachine.getDefaultInterface().getVarI());
+
+		statemachine.getDefaultInterface().raiseEvent3();
+		Thread.sleep(5);
+		assertEquals("Error in local reaction \"onCycle / i=2;\" of State1", 2,
+				statemachine.getDefaultInterface().getVarI());
+
+		statemachine.getDefaultInterface().raiseEvent2();
+		Thread.sleep(5);
+		assertEquals("Error in local reaction \"Event2 / i=3;\" of State1", 3,
+				statemachine.getDefaultInterface().getVarI());
+
+		// Check timer behavior
+		while (statemachine.getDefaultInterface().getVarC() < 10) {
+			Thread.sleep(junitSleepTime);
+		}
+		final long time2 = System.currentTimeMillis() - time;
+		final long expectedTime = statemachine.getDefaultInterface().getVarC() * 100;
+		final long delta = time2 - expectedTime;
+		assertTrue("Timer threshold overflow in State 1. Delta is " + delta
+				+ " ms. Threshold is: " + timerThreshold + " ms.",
+				time2 <= expectedTime + timerThreshold);
+	}
+
+	@Test
+	public void testState2LocalReaction() throws InterruptedException {
+		// Switch to State2;
+		statemachine.getDefaultInterface().raiseEvent1();
+		Thread.sleep(5);
+		final long time = System.currentTimeMillis();
+
+		assertEquals("Error in local reaction \"exit / i=0;\" of State1", 0,
+				statemachine.getDefaultInterface().getVarI());
+
+		assertEquals("Error in local reaction \"entry / j=0;\" of State2", 1,
+				statemachine.getDefaultInterface().getVarJ());
+
+		// Check local reaction for Event2
+		statemachine.getDefaultInterface().raiseEvent2();
+		Thread.sleep(5);
+		assertEquals(
+				"Error in local reaction \"Event2, Event4 / j=2;\" of State2",
+				2, statemachine.getDefaultInterface().getVarJ());
+
+		// Check timer behavior
+		while (statemachine.getDefaultInterface().getVarJ() != 3) {
+			Thread.sleep(junitSleepTime);
+		}
+		final long time2 = System.currentTimeMillis() - time;
+		// After 200 ms var j should be set to 3
+		final long expectedTime = 200;
+		final long delta = time2 - expectedTime;
+		assertTrue("Timer threshold overflow in State 2. Delta is " + delta
+				+ " ms. Threshold is: " + timerThreshold + " ms.",
+				time2 <= expectedTime + timerThreshold);
+
+		// Check local reaction for Event4
+		statemachine.getDefaultInterface().raiseEvent4();
+		Thread.sleep(5);
+		assertEquals(
+				"Error in local reaction \"Event2, Event4 / j=2;\" of State2",
+				2, statemachine.getDefaultInterface().getVarJ());
+
+		// Check local reaction for exit
+		statemachine.getDefaultInterface().raiseEvent3();
+		Thread.sleep(5);
+		assertEquals("Error in local reaction \"exit / j=0;\" of State2", 0,
+				statemachine.getDefaultInterface().getVarJ());
+	}
+}