Browse Source

a trigger with no port specification is now also triggered by an external
event with the correct name
timing is now in milliseconds (internal) --- getSimulatedTime() returns an
integer
time starts when Controller.start() is called, no longer when the module
is imported --- this makes sure tests are run correctly
fixed a small issue with simultaneous events: they are now processed in
the order they were added to the queue
an instance now correctly checks whether it needs to execute a transitions
either when it has a due event or it can potentially execute an eventless
transition

Simon Van Mierlo 9 years ago
parent
commit
0664fd0abb
99 changed files with 2127 additions and 682 deletions
  1. 16 13
      examples/HTTP_client/client.py
  2. 22 18
      examples/HTTP_server/server.py
  3. 5 5
      examples/bouncingballs/js/index.html
  4. 31 24
      examples/bouncingballs/js/target_js/target.js
  5. 7 4
      examples/bouncingballs/python/Makefile
  6. 23 0
      examples/bouncingballs/python/runner_performance.py
  7. 421 0
      examples/bouncingballs/python/sccd_performance.xml
  8. 31 25
      examples/bouncingballs/python/target_py/target.py
  9. 786 0
      examples/bouncingballs/python/target_py/target_performance.py
  10. 91 65
      examples/tanks/ai_controller.py
  11. 43 40
      examples/tanks/player_controller.py
  12. 7 7
      examples/timer-parallel/python/target_py/target.py
  13. 5 5
      examples/timer-threads/python/target_py/target.py
  14. 8 7
      examples/timer/js/target_js/target.js
  15. 8 7
      examples/timer/python/target_py/target.py
  16. 14 12
      examples/trafficlights/js/target_js/target.js
  17. 14 12
      examples/trafficlights/python/target_py/target.py
  18. 29 24
      examples/train/python/target_py/target.py
  19. 60 38
      src/javascript_sccd_runtime/statecharts_core.js
  20. 12 6
      src/python_sccd/python_sccd_compiler/generic_generator.py
  21. 5 6
      src/python_sccd/python_sccd_runtime/accurate_time.py
  22. 1 1
      src/python_sccd/python_sccd_runtime/event_queue.py
  23. 61 47
      src/python_sccd/python_sccd_runtime/statecharts_core.py
  24. 1 1
      src/python_sccd/python_sccd_runtime/tkinter_eventloop.py
  25. 1 1
      test/run_tests.py
  26. 6 3
      test/target_js/big_step_maximality/00_take_one.js
  27. 6 3
      test/target_js/big_step_maximality/01_take_many.js
  28. 8 3
      test/target_js/big_step_maximality/10_orthogonal_take_one.js
  29. 8 3
      test/target_js/big_step_maximality/11_orthogonal_take_many.js
  30. 6 5
      test/target_js/event_lifeline/00_take_one_next_small_step.js
  31. 6 5
      test/target_js/event_lifeline/02_take_one_queue.js
  32. 6 5
      test/target_js/event_lifeline/10_take_many_next_small_step.js
  33. 6 5
      test/target_js/event_lifeline/11_take_many_next_combo_step.js
  34. 6 5
      test/target_js/event_lifeline/12_take_many_queue.js
  35. 8 6
      test/target_js/event_lifeline/20_orthogonal_take_one_next_small_step.js
  36. 8 6
      test/target_js/event_lifeline/21_orthogonal_take_one_queue.js
  37. 8 6
      test/target_js/event_lifeline/30_orthogonal_take_many_next_small_step.js
  38. 8 6
      test/target_js/event_lifeline/31_orthogonal_take_many_next_combo_step.js
  39. 8 6
      test/target_js/event_lifeline/32_orthogonal_take_many_queue.js
  40. 6 5
      test/target_js/no_statechart/00_no_statechart_js.js
  41. 6 5
      test/target_js/original_semantics/after.js
  42. 7 6
      test/target_js/original_semantics/associate_event.js
  43. 4 3
      test/target_js/original_semantics/correct_duplicate_state_id.js
  44. 9 8
      test/target_js/original_semantics/enter_exit_hierarchy.js
  45. 7 3
      test/target_js/original_semantics/guard.js
  46. 7 5
      test/target_js/original_semantics/history.js
  47. 12 7
      test/target_js/original_semantics/history_deep.js
  48. 12 7
      test/target_js/original_semantics/history_parallel_deep.js
  49. 6 5
      test/target_js/original_semantics/inner_first.js
  50. 9 5
      test/target_js/original_semantics/instate.js
  51. 5 3
      test/target_js/original_semantics/multiple_target.js
  52. 7 6
      test/target_js/original_semantics/object_manager.js
  53. 6 5
      test/target_js/original_semantics/outer_first.js
  54. 8 7
      test/target_js/original_semantics/parallel.js
  55. 10 9
      test/target_js/original_semantics/parallel_history.js
  56. 10 9
      test/target_js/original_semantics/parallel_history_2.js
  57. 10 9
      test/target_js/original_semantics/parallel_history_3.js
  58. 6 3
      test/target_js/priority/00_source_parent.js
  59. 6 3
      test/target_js/priority/01_source_child.js
  60. 6 5
      test/target_js/priority/10_source_parent_history.js
  61. 6 5
      test/target_js/priority/11_source_child_history.js
  62. 5 4
      test/target_js/timing/00_rapid_js.js
  63. 3 1
      test/target_py/big_step_maximality/00_take_one.py
  64. 3 1
      test/target_py/big_step_maximality/01_take_many.py
  65. 5 1
      test/target_py/big_step_maximality/10_orthogonal_take_one.py
  66. 5 1
      test/target_py/big_step_maximality/11_orthogonal_take_many.py
  67. 3 3
      test/target_py/event_lifeline/00_take_one_next_small_step.py
  68. 3 3
      test/target_py/event_lifeline/02_take_one_queue.py
  69. 3 3
      test/target_py/event_lifeline/10_take_many_next_small_step.py
  70. 3 3
      test/target_py/event_lifeline/11_take_many_next_combo_step.py
  71. 3 3
      test/target_py/event_lifeline/12_take_many_queue.py
  72. 5 4
      test/target_py/event_lifeline/20_orthogonal_take_one_next_small_step.py
  73. 5 4
      test/target_py/event_lifeline/21_orthogonal_take_one_queue.py
  74. 5 4
      test/target_py/event_lifeline/30_orthogonal_take_many_next_small_step.py
  75. 5 4
      test/target_py/event_lifeline/31_orthogonal_take_many_next_combo_step.py
  76. 5 4
      test/target_py/event_lifeline/32_orthogonal_take_many_queue.py
  77. 3 3
      test/target_py/no_statechart/00_no_statechart_py.py
  78. 3 3
      test/target_py/original_semantics/after.py
  79. 4 4
      test/target_py/original_semantics/associate_event.py
  80. 1 1
      test/target_py/original_semantics/correct_duplicate_state_id.py
  81. 6 6
      test/target_py/original_semantics/enter_exit_hierarchy.py
  82. 4 1
      test/target_py/original_semantics/guard.py
  83. 4 3
      test/target_py/original_semantics/history.py
  84. 9 5
      test/target_py/original_semantics/history_deep.py
  85. 9 5
      test/target_py/original_semantics/history_parallel_deep.py
  86. 3 3
      test/target_py/original_semantics/inner_first.py
  87. 6 3
      test/target_py/original_semantics/instate.py
  88. 2 1
      test/target_py/original_semantics/multiple_target.py
  89. 4 4
      test/target_py/original_semantics/object_manager.py
  90. 3 3
      test/target_py/original_semantics/outer_first.py
  91. 5 5
      test/target_py/original_semantics/parallel.py
  92. 7 7
      test/target_py/original_semantics/parallel_history.py
  93. 7 7
      test/target_py/original_semantics/parallel_history_2.py
  94. 7 7
      test/target_py/original_semantics/parallel_history_3.py
  95. 3 1
      test/target_py/priority/00_source_parent.py
  96. 3 1
      test/target_py/priority/01_source_child.py
  97. 3 3
      test/target_py/priority/10_source_parent_history.py
  98. 3 3
      test/target_py/priority/11_source_child_history.py
  99. 2 2
      test/target_py/timing/00_rapid_py.py

+ 16 - 13
examples/HTTP_client/client.py

@@ -1,7 +1,7 @@
 """
 Generated by Statechart compiler by Glenn De Jonghe, Joeri Exelmans, Simon Van Mierlo, and Yentl Van Tendeloo (for the inspiration)
 
-Date:   Thu Aug 04 13:29:22 2016
+Date:   Fri Aug 05 16:08:35 2016
 
 Model author: Yentl Van Tendeloo
 Model name:   HTTP client
@@ -77,30 +77,30 @@ class Prompt(RuntimeClassBase):
         # transition /init
         _init_0 = Transition(self, self.states["/init"], [self.states["/initializing"]])
         _init_0.setAction(self._init_0_exec)
-        _init_0.trigger = Event("instance_created", None)
+        _init_0.setTrigger(Event("instance_created", None))
         self.states["/init"].addTransition(_init_0)
         
         # transition /initializing
         _initializing_0 = Transition(self, self.states["/initializing"], [self.states["/initializing"]])
-        _initializing_0.trigger = Event("_0after")
+        _initializing_0.setTrigger(Event("_0after"))
         self.states["/initializing"].addTransition(_initializing_0)
         _initializing_1 = Transition(self, self.states["/initializing"], [self.states["/send_request"]])
-        _initializing_1.trigger = Event("http_client_ready", None)
+        _initializing_1.setTrigger(Event("http_client_ready", None))
         self.states["/initializing"].addTransition(_initializing_1)
         
         # transition /send_request
         _send_request_0 = Transition(self, self.states["/send_request"], [self.states["/wait_reply"]])
         _send_request_0.setAction(self._send_request_0_exec)
-        _send_request_0.trigger = Event("_1after")
+        _send_request_0.setTrigger(Event("_1after"))
         self.states["/send_request"].addTransition(_send_request_0)
         
         # transition /wait_reply
         _wait_reply_0 = Transition(self, self.states["/wait_reply"], [self.states["/wait_reply"]])
-        _wait_reply_0.trigger = Event("_2after")
+        _wait_reply_0.setTrigger(Event("_2after"))
         self.states["/wait_reply"].addTransition(_wait_reply_0)
         _wait_reply_1 = Transition(self, self.states["/wait_reply"], [self.states["/send_request"]])
         _wait_reply_1.setAction(self._wait_reply_1_exec)
-        _wait_reply_1.trigger = Event("HTTP_output", None)
+        _wait_reply_1.setTrigger(Event("HTTP_output", None))
         self.states["/wait_reply"].addTransition(_wait_reply_1)
     
     def _init_enter(self):
@@ -250,55 +250,58 @@ class HTTPClient(RuntimeClassBase):
         # transition /init
         _init_0 = Transition(self, self.states["/init"], [self.states["/connecting"]])
         _init_0.setAction(self._init_0_exec)
-        _init_0.trigger = Event("created_socket", "socket_in")
+        _init_0.setTrigger(Event("created_socket", "socket_in"))
         self.states["/init"].addTransition(_init_0)
         
         # transition /connecting
         _connecting_0 = Transition(self, self.states["/connecting"], [self.states["/connected"]])
         _connecting_0.setAction(self._connecting_0_exec)
-        _connecting_0.trigger = Event("connected_socket", "socket_in")
+        _connecting_0.setTrigger(Event("connected_socket", "socket_in"))
         _connecting_0.setGuard(self._connecting_0_guard)
         self.states["/connecting"].addTransition(_connecting_0)
         
         # transition /connected/listening/listen
         _connected_listening_listen_0 = Transition(self, self.states["/connected/listening/listen"], [self.states["/connected/listening/listen"]])
         _connected_listening_listen_0.setAction(self._connected_listening_listen_0_exec)
-        _connected_listening_listen_0.trigger = Event("received_socket", "socket_in")
+        _connected_listening_listen_0.setTrigger(Event("received_socket", "socket_in"))
         _connected_listening_listen_0.setGuard(self._connected_listening_listen_0_guard)
         self.states["/connected/listening/listen"].addTransition(_connected_listening_listen_0)
         _connected_listening_listen_1 = Transition(self, self.states["/connected/listening/listen"], [self.states["/connected/listening/close"]])
-        _connected_listening_listen_1.trigger = Event("received_socket", "socket_in")
+        _connected_listening_listen_1.setTrigger(Event("received_socket", "socket_in"))
         _connected_listening_listen_1.setGuard(self._connected_listening_listen_1_guard)
         self.states["/connected/listening/listen"].addTransition(_connected_listening_listen_1)
         
         # transition /connected/sending/waiting_for_data
         _connected_sending_waiting_for_data_0 = Transition(self, self.states["/connected/sending/waiting_for_data"], [self.states["/connected/sending/transferring"]])
         _connected_sending_waiting_for_data_0.setAction(self._connected_sending_waiting_for_data_0_exec)
+        _connected_sending_waiting_for_data_0.setTrigger(None)
         _connected_sending_waiting_for_data_0.setGuard(self._connected_sending_waiting_for_data_0_guard)
         self.states["/connected/sending/waiting_for_data"].addTransition(_connected_sending_waiting_for_data_0)
         
         # transition /connected/sending/transferring
         _connected_sending_transferring_0 = Transition(self, self.states["/connected/sending/transferring"], [self.states["/connected/sending/waiting_for_data"]])
         _connected_sending_transferring_0.setAction(self._connected_sending_transferring_0_exec)
-        _connected_sending_transferring_0.trigger = Event("sent_socket", "socket_in")
+        _connected_sending_transferring_0.setTrigger(Event("sent_socket", "socket_in"))
         _connected_sending_transferring_0.setGuard(self._connected_sending_transferring_0_guard)
         self.states["/connected/sending/transferring"].addTransition(_connected_sending_transferring_0)
         
         # transition /connected/queueing/queueing
         _connected_queueing_queueing_0 = Transition(self, self.states["/connected/queueing/queueing"], [self.states["/connected/queueing/queueing"]])
         _connected_queueing_queueing_0.setAction(self._connected_queueing_queueing_0_exec)
-        _connected_queueing_queueing_0.trigger = Event("HTTP_input", None)
+        _connected_queueing_queueing_0.setTrigger(Event("HTTP_input", None))
         self.states["/connected/queueing/queueing"].addTransition(_connected_queueing_queueing_0)
         
         # transition /connected/parsing/wait_for_header
         _connected_parsing_wait_for_header_0 = Transition(self, self.states["/connected/parsing/wait_for_header"], [self.states["/connected/parsing/wait_for_payload"]])
         _connected_parsing_wait_for_header_0.setAction(self._connected_parsing_wait_for_header_0_exec)
+        _connected_parsing_wait_for_header_0.setTrigger(None)
         _connected_parsing_wait_for_header_0.setGuard(self._connected_parsing_wait_for_header_0_guard)
         self.states["/connected/parsing/wait_for_header"].addTransition(_connected_parsing_wait_for_header_0)
         
         # transition /connected/parsing/wait_for_payload
         _connected_parsing_wait_for_payload_0 = Transition(self, self.states["/connected/parsing/wait_for_payload"], [self.states["/connected/parsing/wait_for_header"]])
         _connected_parsing_wait_for_payload_0.setAction(self._connected_parsing_wait_for_payload_0_exec)
+        _connected_parsing_wait_for_payload_0.setTrigger(None)
         _connected_parsing_wait_for_payload_0.setGuard(self._connected_parsing_wait_for_payload_0_guard)
         self.states["/connected/parsing/wait_for_payload"].addTransition(_connected_parsing_wait_for_payload_0)
     

+ 22 - 18
examples/HTTP_server/server.py

@@ -1,7 +1,7 @@
 """
 Generated by Statechart compiler by Glenn De Jonghe, Joeri Exelmans, Simon Van Mierlo, and Yentl Van Tendeloo (for the inspiration)
 
-Date:   Thu Aug 04 13:29:22 2016
+Date:   Fri Aug 05 16:08:35 2016
 
 Model author: Yentl Van Tendeloo
 Model name:   HTTP Server
@@ -70,13 +70,13 @@ class Echo(RuntimeClassBase):
         # transition /init_server
         _init_server_0 = Transition(self, self.states["/init_server"], [self.states["/wait_for_requests"]])
         _init_server_0.setAction(self._init_server_0_exec)
-        _init_server_0.trigger = Event("instance_created", None)
+        _init_server_0.setTrigger(Event("instance_created", None))
         self.states["/init_server"].addTransition(_init_server_0)
         
         # transition /wait_for_requests/wait
         _wait_for_requests_wait_0 = Transition(self, self.states["/wait_for_requests/wait"], [self.states["/wait_for_requests/wait"]])
         _wait_for_requests_wait_0.setAction(self._wait_for_requests_wait_0_exec)
-        _wait_for_requests_wait_0.trigger = Event("HTTP_output", None)
+        _wait_for_requests_wait_0.setTrigger(Event("HTTP_output", None))
         self.states["/wait_for_requests/wait"].addTransition(_wait_for_requests_wait_0)
     
     def _init_server_enter(self):
@@ -186,45 +186,45 @@ class Server(RuntimeClassBase):
         # transition /main/forward/forward
         _main_forward_forward_0 = Transition(self, self.states["/main/forward/forward"], [self.states["/main/forward/forward"]])
         _main_forward_forward_0.setAction(self._main_forward_forward_0_exec)
-        _main_forward_forward_0.trigger = Event("HTTP_output", None)
+        _main_forward_forward_0.setTrigger(Event("HTTP_output", None))
         self.states["/main/forward/forward"].addTransition(_main_forward_forward_0)
         
         # transition /main/server/init
         _main_server_init_0 = Transition(self, self.states["/main/server/init"], [self.states["/main/server/binding"]])
         _main_server_init_0.setAction(self._main_server_init_0_exec)
-        _main_server_init_0.trigger = Event("created_socket", "socket_in")
+        _main_server_init_0.setTrigger(Event("created_socket", "socket_in"))
         self.states["/main/server/init"].addTransition(_main_server_init_0)
         
         # transition /main/server/binding
         _main_server_binding_0 = Transition(self, self.states["/main/server/binding"], [self.states["/main/server/listening"]])
-        _main_server_binding_0.trigger = Event("bound_socket", "socket_in")
+        _main_server_binding_0.setTrigger(Event("bound_socket", "socket_in"))
         _main_server_binding_0.setGuard(self._main_server_binding_0_guard)
         self.states["/main/server/binding"].addTransition(_main_server_binding_0)
         
         # transition /main/server/listening
         _main_server_listening_0 = Transition(self, self.states["/main/server/listening"], [self.states["/main/server/accepting"]])
         _main_server_listening_0.setAction(self._main_server_listening_0_exec)
-        _main_server_listening_0.trigger = Event("listened_socket", "socket_in")
+        _main_server_listening_0.setTrigger(Event("listened_socket", "socket_in"))
         _main_server_listening_0.setGuard(self._main_server_listening_0_guard)
         self.states["/main/server/listening"].addTransition(_main_server_listening_0)
         
         # transition /main/server/accepting
         _main_server_accepting_0 = Transition(self, self.states["/main/server/accepting"], [self.states["/main/server/accepting"]])
         _main_server_accepting_0.setAction(self._main_server_accepting_0_exec)
-        _main_server_accepting_0.trigger = Event("accepted_socket", "socket_in")
+        _main_server_accepting_0.setTrigger(Event("accepted_socket", "socket_in"))
         self.states["/main/server/accepting"].addTransition(_main_server_accepting_0)
         _main_server_accepting_1 = Transition(self, self.states["/main/server/accepting"], [self.states["/main/server/accepting"]])
         _main_server_accepting_1.setAction(self._main_server_accepting_1_exec)
-        _main_server_accepting_1.trigger = Event("instance_created", None)
+        _main_server_accepting_1.setTrigger(Event("instance_created", None))
         self.states["/main/server/accepting"].addTransition(_main_server_accepting_1)
         _main_server_accepting_2 = Transition(self, self.states["/main/server/accepting"], [self.states["/main/server/accepting"]])
-        _main_server_accepting_2.trigger = Event("_0after")
+        _main_server_accepting_2.setTrigger(Event("_0after"))
         self.states["/main/server/accepting"].addTransition(_main_server_accepting_2)
         
         # transition /main/close_socket/close
         _main_close_socket_close_0 = Transition(self, self.states["/main/close_socket/close"], [self.states["/main/close_socket/close"]])
         _main_close_socket_close_0.setAction(self._main_close_socket_close_0_exec)
-        _main_close_socket_close_0.trigger = Event("close_socket", None)
+        _main_close_socket_close_0.setTrigger(Event("close_socket", None))
         self.states["/main/close_socket/close"].addTransition(_main_close_socket_close_0)
     
     def _main_server_init_enter(self):
@@ -396,64 +396,68 @@ class Socket(RuntimeClassBase):
         # transition /init
         _init_0 = Transition(self, self.states["/init"], [self.states["/connected"]])
         _init_0.setAction(self._init_0_exec)
-        _init_0.trigger = Event("set_association_name", None)
+        _init_0.setTrigger(Event("set_association_name", None))
         self.states["/init"].addTransition(_init_0)
         
         # transition /connected/listening/listen
         _connected_listening_listen_0 = Transition(self, self.states["/connected/listening/listen"], [self.states["/connected/listening/listen"]])
         _connected_listening_listen_0.setAction(self._connected_listening_listen_0_exec)
-        _connected_listening_listen_0.trigger = Event("received_socket", "socket_in")
+        _connected_listening_listen_0.setTrigger(Event("received_socket", "socket_in"))
         _connected_listening_listen_0.setGuard(self._connected_listening_listen_0_guard)
         self.states["/connected/listening/listen"].addTransition(_connected_listening_listen_0)
         _connected_listening_listen_1 = Transition(self, self.states["/connected/listening/listen"], [self.states["/connected/listening/closed"]])
         _connected_listening_listen_1.setAction(self._connected_listening_listen_1_exec)
-        _connected_listening_listen_1.trigger = Event("received_socket", "socket_in")
+        _connected_listening_listen_1.setTrigger(Event("received_socket", "socket_in"))
         _connected_listening_listen_1.setGuard(self._connected_listening_listen_1_guard)
         self.states["/connected/listening/listen"].addTransition(_connected_listening_listen_1)
         
         # transition /connected/sending/waiting_for_data
         _connected_sending_waiting_for_data_0 = Transition(self, self.states["/connected/sending/waiting_for_data"], [self.states["/connected/sending/transferring"]])
         _connected_sending_waiting_for_data_0.setAction(self._connected_sending_waiting_for_data_0_exec)
+        _connected_sending_waiting_for_data_0.setTrigger(None)
         _connected_sending_waiting_for_data_0.setGuard(self._connected_sending_waiting_for_data_0_guard)
         self.states["/connected/sending/waiting_for_data"].addTransition(_connected_sending_waiting_for_data_0)
         
         # transition /connected/sending/transferring
         _connected_sending_transferring_0 = Transition(self, self.states["/connected/sending/transferring"], [self.states["/connected/sending/waiting_for_data"]])
         _connected_sending_transferring_0.setAction(self._connected_sending_transferring_0_exec)
-        _connected_sending_transferring_0.trigger = Event("sent_socket", "socket_in")
+        _connected_sending_transferring_0.setTrigger(Event("sent_socket", "socket_in"))
         _connected_sending_transferring_0.setGuard(self._connected_sending_transferring_0_guard)
         self.states["/connected/sending/transferring"].addTransition(_connected_sending_transferring_0)
         
         # transition /connected/queueing/queueing
         _connected_queueing_queueing_0 = Transition(self, self.states["/connected/queueing/queueing"], [self.states["/connected/queueing/queueing"]])
         _connected_queueing_queueing_0.setAction(self._connected_queueing_queueing_0_exec)
-        _connected_queueing_queueing_0.trigger = Event("HTTP_input", None)
+        _connected_queueing_queueing_0.setTrigger(Event("HTTP_input", None))
         self.states["/connected/queueing/queueing"].addTransition(_connected_queueing_queueing_0)
         
         # transition /connected/parsing/wait_for_header
         _connected_parsing_wait_for_header_0 = Transition(self, self.states["/connected/parsing/wait_for_header"], [self.states["/connected/parsing/wait_for_payload"]])
         _connected_parsing_wait_for_header_0.setAction(self._connected_parsing_wait_for_header_0_exec)
+        _connected_parsing_wait_for_header_0.setTrigger(None)
         _connected_parsing_wait_for_header_0.setGuard(self._connected_parsing_wait_for_header_0_guard)
         self.states["/connected/parsing/wait_for_header"].addTransition(_connected_parsing_wait_for_header_0)
         _connected_parsing_wait_for_header_1 = Transition(self, self.states["/connected/parsing/wait_for_header"], [self.states["/connected/parsing/closing"]])
+        _connected_parsing_wait_for_header_1.setTrigger(None)
         _connected_parsing_wait_for_header_1.setGuard(self._connected_parsing_wait_for_header_1_guard)
         self.states["/connected/parsing/wait_for_header"].addTransition(_connected_parsing_wait_for_header_1)
         
         # transition /connected/parsing/closing
         _connected_parsing_closing_0 = Transition(self, self.states["/connected/parsing/closing"], [self.states["/connected/parsing/closing"]])
         _connected_parsing_closing_0.setAction(self._connected_parsing_closing_0_exec)
-        _connected_parsing_closing_0.trigger = Event("_0after")
+        _connected_parsing_closing_0.setTrigger(Event("_0after"))
         self.states["/connected/parsing/closing"].addTransition(_connected_parsing_closing_0)
         
         # transition /connected/parsing/wait_for_payload
         _connected_parsing_wait_for_payload_0 = Transition(self, self.states["/connected/parsing/wait_for_payload"], [self.states["/connected/parsing/wait_for_header"]])
         _connected_parsing_wait_for_payload_0.setAction(self._connected_parsing_wait_for_payload_0_exec)
+        _connected_parsing_wait_for_payload_0.setTrigger(None)
         _connected_parsing_wait_for_payload_0.setGuard(self._connected_parsing_wait_for_payload_0_guard)
         self.states["/connected/parsing/wait_for_payload"].addTransition(_connected_parsing_wait_for_payload_0)
         
         # transition /connected
         _connected_0 = Transition(self, self.states["/connected"], [self.states["/close"]])
-        _connected_0.trigger = Event("close", None)
+        _connected_0.setTrigger(Event("close", None))
         self.states["/connected"].addTransition(_connected_0)
     
     def _connected_listening_listen_enter(self):

+ 5 - 5
examples/bouncingballs/js/index.html

@@ -1,8 +1,8 @@
-<script src="https://msdl.uantwerpen.be/git/simon/SCCD/raw/v0.9/src/javascript_sccd_runtime/libs/HackTimer.js"></script>
-<script src="https://msdl.uantwerpen.be/git/simon/SCCD/raw/v0.9/src/javascript_sccd_runtime/statecharts_core.js"></script>
-<script src="https://msdl.uantwerpen.be/git/simon/SCCD/raw/v0.9/src/javascript_sccd_runtime/libs/utils.js"></script>
-<script src="https://msdl.uantwerpen.be/git/simon/SCCD/raw/v0.9/src/javascript_sccd_runtime/libs/svg.js"></script>
-<script src="https://msdl.uantwerpen.be/git/simon/SCCD/raw/v0.9/src/javascript_sccd_runtime/libs/ui.js"></script>
+<script src="../../../src/javascript_sccd_runtime/libs/HackTimer.js"></script>
+<script src="../../../src/javascript_sccd_runtime/statecharts_core.js"></script>
+<script src="../../../src/javascript_sccd_runtime/libs/utils.js"></script>
+<script src="../../../src/javascript_sccd_runtime/libs/svg.js"></script>
+<script src="../../../src/javascript_sccd_runtime/libs/ui.js"></script>
 <script src="target_js/target.js"></script>
 <script>
 controller = new Bouncing_Balls_JavaScript_Version.Controller(new JsEventLoop());

+ 31 - 24
examples/bouncingballs/js/target_js/target.js

@@ -1,6 +1,6 @@
 /* Generated by Statechart compiler by Glenn De Jonghe, Joeri Exelmans, Simon Van Mierlo, and Yentl Van Tendeloo (for the inspiration)
 
-Date:   Thu Aug 04 13:29:22 2016
+Date:   Fri Aug 05 16:11:47 2016
 
 Model author: Joeri Exelmans+Raphael Mannadiar+Simon Van Mierlo
 Model name:   Bouncing_Balls_JavaScript_Version
@@ -99,37 +99,40 @@ MainApp.prototype.build_statechart_structure = function() {
     // transition /running/root/main_behaviour/initializing
     var _running_root_main_behaviour_initializing_0 = new Transition(this, this.states["/running/root/main_behaviour/initializing"], [this.states["/running/root/main_behaviour/running"]]);
     _running_root_main_behaviour_initializing_0.setAction(this._running_root_main_behaviour_initializing_0_exec);
+    _running_root_main_behaviour_initializing_0.setTrigger(null);
     this.states["/running/root/main_behaviour/initializing"].addTransition(_running_root_main_behaviour_initializing_0);
     
     // transition /running/root/main_behaviour/running
     var _running_root_main_behaviour_running_0 = new Transition(this, this.states["/running/root/main_behaviour/running"], [this.states["/running/root/main_behaviour/running"]]);
     _running_root_main_behaviour_running_0.setAction(this._running_root_main_behaviour_running_0_exec);
-    _running_root_main_behaviour_running_0.trigger = new Event("button_pressed", null);
+    _running_root_main_behaviour_running_0.setTrigger(new Event("button_pressed", null));
     _running_root_main_behaviour_running_0.setGuard(this._running_root_main_behaviour_running_0_guard);
     this.states["/running/root/main_behaviour/running"].addTransition(_running_root_main_behaviour_running_0);
     
     // transition /running/root/cd_behaviour/waiting
     var _running_root_cd_behaviour_waiting_0 = new Transition(this, this.states["/running/root/cd_behaviour/waiting"], [this.states["/running/root/cd_behaviour/creating"]]);
     _running_root_cd_behaviour_waiting_0.setAction(this._running_root_cd_behaviour_waiting_0_exec);
-    _running_root_cd_behaviour_waiting_0.trigger = new Event("create_field", null);
+    _running_root_cd_behaviour_waiting_0.setTrigger(new Event("create_field", null));
     this.states["/running/root/cd_behaviour/waiting"].addTransition(_running_root_cd_behaviour_waiting_0);
     var _running_root_cd_behaviour_waiting_1 = new Transition(this, this.states["/running/root/cd_behaviour/waiting"], [this.states["/running/root/cd_behaviour/check_nr_of_fields"]]);
     _running_root_cd_behaviour_waiting_1.setAction(this._running_root_cd_behaviour_waiting_1_exec);
-    _running_root_cd_behaviour_waiting_1.trigger = new Event("delete_field", null);
+    _running_root_cd_behaviour_waiting_1.setTrigger(new Event("delete_field", null));
     this.states["/running/root/cd_behaviour/waiting"].addTransition(_running_root_cd_behaviour_waiting_1);
     
     // transition /running/root/cd_behaviour/creating
     var _running_root_cd_behaviour_creating_0 = new Transition(this, this.states["/running/root/cd_behaviour/creating"], [this.states["/running/root/cd_behaviour/waiting"]]);
     _running_root_cd_behaviour_creating_0.setAction(this._running_root_cd_behaviour_creating_0_exec);
-    _running_root_cd_behaviour_creating_0.trigger = new Event("instance_created", null);
+    _running_root_cd_behaviour_creating_0.setTrigger(new Event("instance_created", null));
     this.states["/running/root/cd_behaviour/creating"].addTransition(_running_root_cd_behaviour_creating_0);
     
     // transition /running/root/cd_behaviour/check_nr_of_fields
     var _running_root_cd_behaviour_check_nr_of_fields_0 = new Transition(this, this.states["/running/root/cd_behaviour/check_nr_of_fields"], [this.states["/running/stopped"]]);
     _running_root_cd_behaviour_check_nr_of_fields_0.setAction(this._running_root_cd_behaviour_check_nr_of_fields_0_exec);
+    _running_root_cd_behaviour_check_nr_of_fields_0.setTrigger(null);
     _running_root_cd_behaviour_check_nr_of_fields_0.setGuard(this._running_root_cd_behaviour_check_nr_of_fields_0_guard);
     this.states["/running/root/cd_behaviour/check_nr_of_fields"].addTransition(_running_root_cd_behaviour_check_nr_of_fields_0);
     var _running_root_cd_behaviour_check_nr_of_fields_1 = new Transition(this, this.states["/running/root/cd_behaviour/check_nr_of_fields"], [this.states["/running/root/cd_behaviour/waiting"]]);
+    _running_root_cd_behaviour_check_nr_of_fields_1.setTrigger(null);
     _running_root_cd_behaviour_check_nr_of_fields_1.setGuard(this._running_root_cd_behaviour_check_nr_of_fields_1_guard);
     this.states["/running/root/cd_behaviour/check_nr_of_fields"].addTransition(_running_root_cd_behaviour_check_nr_of_fields_1);
 };
@@ -325,65 +328,67 @@ Field.prototype.build_statechart_structure = function() {
     // transition /root/waiting
     var _root_waiting_0 = new Transition(this, this.states["/root/waiting"], [this.states["/root/initializing"]]);
     _root_waiting_0.setAction(this._root_waiting_0_exec);
-    _root_waiting_0.trigger = new Event("set_association_name", null);
+    _root_waiting_0.setTrigger(new Event("set_association_name", null));
     this.states["/root/waiting"].addTransition(_root_waiting_0);
     
     // transition /root/initializing
     var _root_initializing_0 = new Transition(this, this.states["/root/initializing"], [this.states["/root/creating"]]);
     _root_initializing_0.setAction(this._root_initializing_0_exec);
+    _root_initializing_0.setTrigger(null);
     this.states["/root/initializing"].addTransition(_root_initializing_0);
     
     // transition /root/creating
     var _root_creating_0 = new Transition(this, this.states["/root/creating"], [this.states["/root/packing"]]);
     _root_creating_0.setAction(this._root_creating_0_exec);
-    _root_creating_0.trigger = new Event("instance_created", null);
+    _root_creating_0.setTrigger(new Event("instance_created", null));
     this.states["/root/creating"].addTransition(_root_creating_0);
     
     // transition /root/packing
     var _root_packing_0 = new Transition(this, this.states["/root/packing"], [this.states["/root/running"]]);
-    _root_packing_0.trigger = new Event("button_created", null);
+    _root_packing_0.setTrigger(new Event("button_created", null));
     this.states["/root/packing"].addTransition(_root_packing_0);
     
     // transition /root/running/main_behaviour/running
     var _root_running_main_behaviour_running_0 = new Transition(this, this.states["/root/running/main_behaviour/running"], [this.states["/root/running/main_behaviour/creating"]]);
     _root_running_main_behaviour_running_0.setAction(this._root_running_main_behaviour_running_0_exec);
-    _root_running_main_behaviour_running_0.trigger = new Event("right_click", "field_ui");
+    _root_running_main_behaviour_running_0.setTrigger(new Event("right_click", "field_ui"));
     this.states["/root/running/main_behaviour/running"].addTransition(_root_running_main_behaviour_running_0);
     
     // transition /root/running/main_behaviour/creating
     var _root_running_main_behaviour_creating_0 = new Transition(this, this.states["/root/running/main_behaviour/creating"], [this.states["/root/running/main_behaviour/running"]]);
     _root_running_main_behaviour_creating_0.setAction(this._root_running_main_behaviour_creating_0_exec);
-    _root_running_main_behaviour_creating_0.trigger = new Event("instance_created", null);
+    _root_running_main_behaviour_creating_0.setTrigger(new Event("instance_created", null));
     this.states["/root/running/main_behaviour/creating"].addTransition(_root_running_main_behaviour_creating_0);
     
     // transition /root/running/deleting_behaviour/running
     var _root_running_deleting_behaviour_running_0 = new Transition(this, this.states["/root/running/deleting_behaviour/running"], [this.states["/root/running/deleting_behaviour/running"]]);
     _root_running_deleting_behaviour_running_0.setAction(this._root_running_deleting_behaviour_running_0_exec);
-    _root_running_deleting_behaviour_running_0.trigger = new Event("delete_ball", null);
+    _root_running_deleting_behaviour_running_0.setTrigger(new Event("delete_ball", null));
     this.states["/root/running/deleting_behaviour/running"].addTransition(_root_running_deleting_behaviour_running_0);
     
     // transition /root/running/child_behaviour/listening
     var _root_running_child_behaviour_listening_0 = new Transition(this, this.states["/root/running/child_behaviour/listening"], [this.states["/root/running/child_behaviour/listening"]]);
     _root_running_child_behaviour_listening_0.setAction(this._root_running_child_behaviour_listening_0_exec);
-    _root_running_child_behaviour_listening_0.trigger = new Event("button_pressed", null);
+    _root_running_child_behaviour_listening_0.setTrigger(new Event("button_pressed", null));
     this.states["/root/running/child_behaviour/listening"].addTransition(_root_running_child_behaviour_listening_0);
     
     // transition /root/running/deleting_balls_behaviour/listening
     var _root_running_deleting_balls_behaviour_listening_0 = new Transition(this, this.states["/root/running/deleting_balls_behaviour/listening"], [this.states["/root/running/deleting_balls_behaviour/listening"]]);
     _root_running_deleting_balls_behaviour_listening_0.setAction(this._root_running_deleting_balls_behaviour_listening_0_exec);
-    _root_running_deleting_balls_behaviour_listening_0.trigger = new Event("key_press", "field_ui");
+    _root_running_deleting_balls_behaviour_listening_0.setTrigger(new Event("key_press", "field_ui"));
     _root_running_deleting_balls_behaviour_listening_0.setGuard(this._root_running_deleting_balls_behaviour_listening_0_guard);
     this.states["/root/running/deleting_balls_behaviour/listening"].addTransition(_root_running_deleting_balls_behaviour_listening_0);
     
     // transition /root/deleting
     var _root_deleting_0 = new Transition(this, this.states["/root/deleting"], [this.states["/root/deleted"]]);
     _root_deleting_0.setAction(this._root_deleting_0_exec);
+    _root_deleting_0.setTrigger(null);
     this.states["/root/deleting"].addTransition(_root_deleting_0);
     
     // transition /root/running
     var _root_running_0 = new Transition(this, this.states["/root/running"], [this.states["/root/deleting"]]);
     _root_running_0.setAction(this._root_running_0_exec);
-    _root_running_0.trigger = new Event("window_close", "field_ui");
+    _root_running_0.setTrigger(new Event("window_close", "field_ui"));
     this.states["/root/running"].addTransition(_root_running_0);
 };
 
@@ -514,12 +519,13 @@ Button.prototype.build_statechart_structure = function() {
     // transition /initializing
     var _initializing_0 = new Transition(this, this.states["/initializing"], [this.states["/running"]]);
     _initializing_0.setAction(this._initializing_0_exec);
+    _initializing_0.setTrigger(null);
     this.states["/initializing"].addTransition(_initializing_0);
     
     // transition /running
     var _running_0 = new Transition(this, this.states["/running"], [this.states["/running"]]);
     _running_0.setAction(this._running_0_exec);
-    _running_0.trigger = new Event("mouse_click", "button_ui");
+    _running_0.setTrigger(new Event("mouse_click", "button_ui"));
     _running_0.setGuard(this._running_0_guard);
     this.states["/running"].addTransition(_running_0);
 };
@@ -642,39 +648,39 @@ Ball.prototype.build_statechart_structure = function() {
     // transition /main_behaviour/initializing
     var _main_behaviour_initializing_0 = new Transition(this, this.states["/main_behaviour/initializing"], [this.states["/main_behaviour/bouncing"]]);
     _main_behaviour_initializing_0.setAction(this._main_behaviour_initializing_0_exec);
-    _main_behaviour_initializing_0.trigger = new Event("set_association_name", null);
+    _main_behaviour_initializing_0.setTrigger(new Event("set_association_name", null));
     this.states["/main_behaviour/initializing"].addTransition(_main_behaviour_initializing_0);
     
     // transition /main_behaviour/bouncing
     var _main_behaviour_bouncing_0 = new Transition(this, this.states["/main_behaviour/bouncing"], [this.states["/main_behaviour/bouncing"]]);
     _main_behaviour_bouncing_0.setAction(this._main_behaviour_bouncing_0_exec);
-    _main_behaviour_bouncing_0.trigger = new Event("_0after");
+    _main_behaviour_bouncing_0.setTrigger(new Event("_0after"));
     this.states["/main_behaviour/bouncing"].addTransition(_main_behaviour_bouncing_0);
     var _main_behaviour_bouncing_1 = new Transition(this, this.states["/main_behaviour/bouncing"], [this.states["/main_behaviour/selected"]]);
     _main_behaviour_bouncing_1.setAction(this._main_behaviour_bouncing_1_exec);
-    _main_behaviour_bouncing_1.trigger = new Event("mouse_press", "ball_ui");
+    _main_behaviour_bouncing_1.setTrigger(new Event("mouse_press", "ball_ui"));
     _main_behaviour_bouncing_1.setGuard(this._main_behaviour_bouncing_1_guard);
     this.states["/main_behaviour/bouncing"].addTransition(_main_behaviour_bouncing_1);
     
     // transition /main_behaviour/dragging
     var _main_behaviour_dragging_0 = new Transition(this, this.states["/main_behaviour/dragging"], [this.states["/main_behaviour/dragging"]]);
     _main_behaviour_dragging_0.setAction(this._main_behaviour_dragging_0_exec);
-    _main_behaviour_dragging_0.trigger = new Event("mouse_move", "ui");
+    _main_behaviour_dragging_0.setTrigger(new Event("mouse_move", "ui"));
     this.states["/main_behaviour/dragging"].addTransition(_main_behaviour_dragging_0);
     var _main_behaviour_dragging_1 = new Transition(this, this.states["/main_behaviour/dragging"], [this.states["/main_behaviour/bouncing"]]);
     _main_behaviour_dragging_1.setAction(this._main_behaviour_dragging_1_exec);
-    _main_behaviour_dragging_1.trigger = new Event("mouse_release", "ui");
+    _main_behaviour_dragging_1.setTrigger(new Event("mouse_release", "ui"));
     this.states["/main_behaviour/dragging"].addTransition(_main_behaviour_dragging_1);
     
     // transition /main_behaviour/selected
     var _main_behaviour_selected_0 = new Transition(this, this.states["/main_behaviour/selected"], [this.states["/main_behaviour/dragging"]]);
     _main_behaviour_selected_0.setAction(this._main_behaviour_selected_0_exec);
-    _main_behaviour_selected_0.trigger = new Event("mouse_press", "ball_ui");
+    _main_behaviour_selected_0.setTrigger(new Event("mouse_press", "ball_ui"));
     _main_behaviour_selected_0.setGuard(this._main_behaviour_selected_0_guard);
     this.states["/main_behaviour/selected"].addTransition(_main_behaviour_selected_0);
     var _main_behaviour_selected_1 = new Transition(this, this.states["/main_behaviour/selected"], [this.states["/deleted"]]);
     _main_behaviour_selected_1.setAction(this._main_behaviour_selected_1_exec);
-    _main_behaviour_selected_1.trigger = new Event("delete_self", null);
+    _main_behaviour_selected_1.setTrigger(new Event("delete_self", null));
     this.states["/main_behaviour/selected"].addTransition(_main_behaviour_selected_1);
 };
 
@@ -820,9 +826,10 @@ ObjectManager.prototype.instantiate = function(class_name, construct_params) {
 // add symbol 'ObjectManager' to package 'Bouncing_Balls_JavaScript_Version'
 Bouncing_Balls_JavaScript_Version.ObjectManager = ObjectManager;
 
-var Controller = function(event_loop_callbacks, finished_callback) {
+var Controller = function(event_loop_callbacks, finished_callback, behind_schedule_callback) {
     if (finished_callback === undefined) finished_callback = null;
-    EventLoopControllerBase.call(this, new ObjectManager(this), event_loop_callbacks, finished_callback);
+    if (behind_schedule_callback === undefined) behind_schedule_callback = null;
+    EventLoopControllerBase.call(this, new ObjectManager(this), event_loop_callbacks, finished_callback, behind_schedule_callback);
     this.addInputPort("ui");
     this.object_manager.createInstance("MainApp", new Array());
 };

+ 7 - 4
examples/bouncingballs/python/Makefile

@@ -3,19 +3,22 @@
 SCCDC = python -m sccd.compiler.sccdc
 FLAGS = -l python -p eventloop
 
-SOURCE = sccd.xml
+SOURCES = sccd.xml sccd_performance.xml
 
 TARGET_DIR = target_py
-TARGET = $(TARGET_DIR)/target.py
+TARGETS = $(TARGET_DIR)/target.py $(TARGET_DIR)/target_performance.py
 
 
-all: $(TARGET_DIR) $(TARGET)
+all: $(TARGET_DIR) $(TARGETS)
 
 clean:
 	find $(TARGET_DIR) -type f -delete
 	-rmdir $(TARGET_DIR)
 
-$(TARGET): $(SOURCE)
+$(TARGET_DIR)/target.py: sccd.xml
+	$(SCCDC) $(FLAGS) -o $@ $<
+
+$(TARGET_DIR)/target_performance.py: sccd_performance.xml
 	$(SCCDC) $(FLAGS) -o $@ $<
 
 $(TARGET_DIR):

+ 23 - 0
examples/bouncingballs/python/runner_performance.py

@@ -0,0 +1,23 @@
+'''
+Created on 27-jul.-2014
+
+@author: Simon
+'''
+
+import Tkinter as tk
+import target_py.target_performance as target
+from sccd.runtime.libs.ui import ui
+from sccd.runtime.statecharts_core import Event
+from sccd.runtime.tkinter_eventloop import *
+
+if __name__ == '__main__':
+    ui.window = tk.Tk()
+    ui.window.withdraw()
+    def callback(ctrl, behind_schedule):
+        if behind_schedule > 500:
+            print len(ctrl.object_manager.instances)
+            ctrl.stop()
+            ui.window.destroy()
+    controller = target.Controller(TkEventLoop(ui.window), behind_schedule_callback=callback)
+    controller.start()
+    ui.window.mainloop()

+ 421 - 0
examples/bouncingballs/python/sccd_performance.xml

@@ -0,0 +1,421 @@
+<?xml version="1.1" ?>
+<diagram author="Simon Van Mierlo+Raphael Mannadiar" name="Bouncing_Balls_Python_Version">
+    <description>
+        Tkinter frame with bouncing balls in it.
+    </description>
+    <top>
+        from sccd.runtime.libs.ui import ui
+        from sccd.runtime.libs.utils import utils
+        import random
+    </top>
+    <inport name="ui"/>
+    <class name="MainApp" default="true">
+        <relationships>
+            <association name="fields" class="Field" />
+        </relationships>
+        <constructor>
+            <body>
+                <![CDATA[
+                self.nr_of_fields = 0
+                ]]>
+            </body>
+        </constructor>
+        <scxml initial="running">
+            <state id="running" initial="root">
+                <parallel id="root">
+                    <state id="main_behaviour" initial="initializing">
+                        <state id="initializing">
+                            <transition target="../running">
+                                <raise event="create_field" />        
+                            </transition>
+                        </state>
+                        <state id="running">
+                            <transition target='.' event='button_pressed' cond='event_name == "create_new_field"'>
+                                <parameter name="event_name" type="str" />
+                                <raise event="create_field" />
+                            </transition>
+                        </state>
+                    </state>
+                    <state id="cd_behaviour" initial="waiting">
+                        <state id="waiting">
+                            <transition event="create_field" target="../creating">
+                                <raise scope="cd" event="create_instance">
+                                    <parameter expr='"fields"' />
+                                </raise>
+                            </transition>
+                            <transition event="delete_field" target='../check_nr_of_fields'>
+                                <parameter name="association_name" type="str"/>
+                                <raise scope="cd" event="delete_instance">
+                                    <parameter expr='association_name' />
+                                </raise>
+                                <script>
+                                    <![CDATA[
+                                    self.nr_of_fields -= 1
+                                    ]]>
+                                </script>
+                            </transition>
+                        </state>
+                        <state id="creating">
+                            <transition event="instance_created" target="../waiting">
+                                <parameter name="association_name" type="string"/>
+                                <raise scope="cd" event="start_instance">
+                                    <parameter expr="association_name" />
+                                </raise>
+                                <raise scope="narrow" event="set_association_name" target="association_name">
+                                    <parameter expr="association_name" />
+                                </raise>
+                                <script>
+                                    <![CDATA[
+                                    self.nr_of_fields += 1
+                                    ]]>
+                                </script>
+                            </transition>
+                        </state>
+                        <state id="check_nr_of_fields">
+                            <transition target="../../../stopped" cond="self.nr_of_fields == 0" after="0.05">
+                                <script>
+                                    <![CDATA[
+                                    ui.close_window(ui.window)
+                                    ]]>
+                                </script>
+                            </transition>
+                            <transition target="../waiting" cond="self.nr_of_fields != 0"/>
+                        </state>
+                    </state>
+                    <state id="spawn_windows" initial="spawning">
+                        <state id="spawning">
+                            <transition target="." after="(1000 - self.getSimulatedTime() % 1000) / 1000.0" cond="self.nr_of_fields &lt; 10">
+                                <raise event="button_pressed">
+                                    <parameter expr="'create_new_field'" />
+                                </raise>
+                            </transition>
+                        </state>
+                    </state>
+                </parallel>
+                <state id="stopped" />
+            </state>
+        </scxml>
+    </class>
+
+    <class name="Field">
+        <attribute name="canvas" />
+        <attribute name="field_window" />
+        <inport name="field_ui"/>
+        <relationships>
+            <association name="balls" class="Ball" />
+            <association name="buttons" class="Button" />
+            <association name="parent" class="MainApp" min="1" max="1" />
+        </relationships>
+        <constructor>
+            <body>
+                <![CDATA[
+                self.field_window = ui.new_window(400,450);
+                self.canvas = ui.append_canvas(self.field_window,400,400,{'background':'#eee'});
+                ui.bind_event(self.field_window, ui.EVENTS.WINDOW_CLOSE, self.controller, 'window_close', self.inports['field_ui']);
+                ui.bind_event(self.field_window, ui.EVENTS.KEY_PRESS, self.controller, 'key_press', self.inports['field_ui']);
+                ui.bind_event(self.canvas.element, ui.EVENTS.MOUSE_RIGHT_CLICK,    self.controller, 'right_click', self.inports['field_ui']);
+                ui.bind_event(self.canvas.element, ui.EVENTS.MOUSE_MOVE, self.controller, 'mouse_move', self.inports['field_ui']);
+                ui.bind_event(self.canvas.element, ui.EVENTS.MOUSE_RELEASE, self.controller, 'mouse_release', self.inports['field_ui']);
+                ]]>
+            </body>
+        </constructor>
+        <destructor>
+            <body>
+                <![CDATA[
+                ui.close_window(self.field_window);
+                ]]>
+            </body>
+        </destructor>
+        <scxml initial="root">
+            <state id="root" initial="waiting">
+                <state id="waiting">
+                    <transition event="set_association_name" target="../initializing">
+                        <parameter name="association_name" type="str" />
+                        <script>
+                            <![CDATA[
+                            self.association_name = association_name
+                            ]]>
+                        </script>
+                    </transition>
+                </state>
+                <state id="initializing">
+                    <transition target="../creating">
+                        <raise scope="cd" event="create_instance">
+                            <parameter expr='"buttons"' />
+                            <parameter expr='"Button"' />
+                            <parameter expr="self" />
+                            <parameter expr="'create_new_field'" />
+                            <parameter expr="'Spawn New Window'" />
+                        </raise>
+                    </transition>
+                </state>
+                <state id="creating">
+                    <transition event='instance_created' target='../packing'>
+                        <parameter name="association_name" type="string"/>
+                        <raise scope="cd" event="start_instance">
+                            <parameter expr="association_name" />
+                        </raise>
+                    </transition>
+                </state>
+                <state id="packing">
+                    <transition event="button_created" target='../running'>
+                    </transition>
+                </state>
+                <parallel id="running">
+                    <transition port="field_ui" event="window_close" target="../deleting">
+                        <raise event="delete_instance" scope="cd">
+                            <parameter expr='"buttons"' />
+                        </raise>
+                        <raise event="delete_instance" scope="cd">
+                            <parameter expr='"balls"' />
+                        </raise>
+                    </transition>
+                    <state id="main_behaviour" initial="running">
+                        <state id="running">
+                            <transition event="right_click" target="../creating">
+                                <parameter name="x" />
+                                <parameter name="y" />
+                                <parameter name="button" />
+                                <raise scope="cd" event="create_instance">
+                                    <parameter expr='"balls"' />
+                                    <parameter expr='"Ball"' />
+                                    <parameter expr="self.canvas" />
+                                    <parameter expr="x" />
+                                    <parameter expr="y" />
+                                </raise>
+                            </transition>
+                        </state>
+                        <state id="creating">
+                            <transition event="instance_created" target="../running">
+                                <parameter name="association_name" type="string"/>
+                                <raise scope="cd" event="start_instance">
+                                    <parameter expr="association_name" />
+                                </raise>
+                                <raise scope="narrow" event="set_association_name" target="association_name">
+                                    <parameter expr="association_name" />
+                                </raise>
+                            </transition>
+                        </state>
+                    </state>
+                    <state id="deleting_behaviour" initial="running">
+                        <state id="running">
+                            <transition event="delete_ball" target='.'>
+                                <parameter name="association_name" type="str"/>
+                                <raise scope="cd" event="delete_instance">
+                                    <parameter expr='association_name' />
+                                </raise>
+                            </transition>
+                        </state>
+                    </state>
+                    <state id="child_behaviour" initial="listening">
+                        <state id="listening">
+                            <transition event="button_pressed" target='.'>
+                                <parameter name="event_name" type="str" />
+                                <raise event="button_pressed" scope="narrow" target="'parent'">
+                                    <parameter expr='event_name' />
+                                </raise>
+                            </transition>
+                        </state>
+                    </state>
+                    <state id="deleting_balls_behaviour" initial="listening">
+                        <state id="listening">
+                            <transition port="field_ui" event="key_press" target="." cond="key == ui.KEYCODES.DELETE">
+                                <parameter name="key" />
+                                <raise event="delete_self" scope="narrow" target="'balls'" />
+                            </transition>
+                        </state>
+                    </state>
+                    <state id="spawn_balls" initial="spawning">
+                        <state id="spawning">
+                            <transition target="." after="(50 - self.getSimulatedTime() % 50) / 1000.0">
+                                <raise event="right_click">
+                                    <parameter expr="150" />
+                                    <parameter expr="150" />
+                                    <parameter expr="None" />
+                                </raise>
+                            </transition>
+                        </state>
+                    </state>
+                </parallel>
+                <state id="deleting">
+                    <transition target="../deleted">
+                        <raise event="delete_field" scope="narrow" target="'parent'">
+                            <parameter expr='self.association_name' />
+                        </raise>
+                    </transition>
+                </state>
+                <state id="deleted" />
+            </state>
+        </scxml>
+    </class>
+    
+    <class name="Button">
+        <relationships>
+            <association name="parent" class="Field" min="1" max="1" />
+        </relationships>
+        <inport name="button_ui"/>
+        <constructor>
+            <parameter name="parent" type="Field" />
+            <parameter name="event_name" type="str" />
+            <parameter name="button_text" type="str" />
+            <body>
+                <![CDATA[
+                self.event_name = event_name;
+                button = ui.append_button(parent.field_window, event_name);
+                ui.bind_event(button.element, ui.EVENTS.MOUSE_CLICK, self.controller, 'mouse_click', self.inports['button_ui']);
+                ]]>
+            </body>
+        </constructor>
+        <scxml initial="initializing">
+            <state id="initializing">
+                <transition target="../running">
+                    <raise event="button_created" scope="narrow" target="'parent'">
+                    </raise>
+                </transition>
+            </state>
+            <state id="running">
+                <transition port='button_ui' event="mouse_click" target='.' cond="button == ui.MOUSE_BUTTONS.LEFT">
+                    <parameter name="x" />
+                    <parameter name="y" />
+                    <parameter name="button" />
+                    <raise event="button_pressed" scope="narrow" target="'parent'">
+                        <parameter expr="self.event_name" />
+                    </raise>
+                </transition>
+            </state>
+        </scxml>
+    </class>
+    
+    <class name="Ball">
+        <atrribute name="element" />
+        <attribute name="canvas" />
+        <inport name="ball_ui" />
+        <relationships>
+            <association name="parent" class="Field" min="1" max="1" />
+        </relationships>
+        <constructor>
+            <parameter name="canvas" />
+            <parameter name="x" />
+            <parameter name="y" />
+            <body>
+                <![CDATA[
+                self.canvas = canvas;
+                self.r = 20.0;
+                self.vel = {'x': random.uniform(-5.0, 5.0), 'y': random.uniform(-5.0, 5.0)};
+                self.mouse_pos = {};
+                self.smooth = 0.4; # value between 0 and 1
+
+                circle = self.canvas.add_circle(x, y, self.r, {'fill':'#000'});
+                ui.bind_event(circle, ui.EVENTS.MOUSE_PRESS, self.controller, 'mouse_press', self.inports["ball_ui"]);
+                ui.bind_event(circle, ui.EVENTS.MOUSE_MOVE, self.controller, 'mouse_move', self.inports['ball_ui']);
+                ui.bind_event(circle, ui.EVENTS.MOUSE_RELEASE, self.controller, 'mouse_release', self.inports['ball_ui']);
+                self.element = circle;
+                ]]>
+            </body>
+        </constructor>
+        <destructor>
+            <body>
+                <![CDATA[
+                self.canvas.remove_element(self.element);
+                ]]>
+            </body>
+        </destructor>
+        <scxml initial="main_behaviour">
+            <state id="main_behaviour" initial="initializing">
+                <state id="initializing">
+                    <transition event="set_association_name" target="../bouncing">
+                        <parameter name="association_name" type="str" />
+                        <script>
+                            <![CDATA[
+                            self.association_name = association_name
+                            ]]>                            
+                        </script>
+                    </transition>
+                </state>
+                <state id="bouncing">
+                    <transition after="(1000 - self.getSimulatedTime() % 1000) / 1000.0" target=".">
+                        <script>
+                            <![CDATA[
+                            pos = self.element.get_position();    
+                            if pos.x-self.r <= 0 or pos.x+self.r >= self.canvas.width :
+                                self.vel['x'] = -self.vel['x'];
+                            if pos.y-self.r <= 0 or pos.y+self.r >= self.canvas.height :
+                                self.vel['y'] = -self.vel['y'];
+                            self.element.move(self.vel['x'], self.vel['y']);
+                            ]]>                            
+                        </script>
+                    </transition>
+                    <transition port="ball_ui" event="mouse_press" target="../selected" cond="button == ui.MOUSE_BUTTONS.LEFT">
+                        <parameter name="x" />
+                        <parameter name="y" />
+                        <parameter name="button" />
+                        <script>
+                            <![CDATA[
+                            self.element.set_color("#ff0");
+                            ]]>                            
+                        </script>
+                    </transition>
+                </state>
+                <state id="dragging">
+                    <transition port="ball_ui" event="mouse_move" target=".">
+                        <parameter name="x" />
+                        <parameter name="y" />
+                        <parameter name="button" />
+                        <script>
+                            <![CDATA[
+                            dx = x - self.mouse_pos['x'];
+                            dy = y - self.mouse_pos['y'];
+
+                            self.element.move(dx, dy);
+
+                            # keep ball within boundaries
+                            pos = self.element.get_position();
+                            if pos.x-self.r <= 0 :
+                                pos.x = self.r + 1;
+                            elif pos.x+self.r >= self.canvas.width :
+                                pos.x = self.canvas.width-self.r-1;
+                            if pos.y-self.r <= 0 :
+                                pos.y = self.r + 1;
+                            elif pos.y+self.r >= self.canvas.height :
+                                pos.y = self.canvas.height-self.r-1;
+                            self.element.set_position(pos.x, pos.y);
+                            self.mouse_pos = {'x':x, 'y':y};
+                            self.vel = {
+                                'x': (1-self.smooth)*dx + self.smooth*self.vel['x'],
+                                'y': (1-self.smooth)*dy + self.smooth*self.vel['y']
+                            };
+                            ]]>
+                        </script>
+                    </transition>
+                    <transition port="ball_ui" event="mouse_release" target="../bouncing">
+                        <parameter name="x" />
+                        <parameter name="y" />
+                        <script>
+                            <![CDATA[
+                            self.element.set_color("#f00");
+                            ]]>                            
+                        </script>
+                    </transition>
+                </state>
+                <state id='selected'>
+                    <transition port="ball_ui" event="mouse_press" target="../dragging" cond="button == ui.MOUSE_BUTTONS.LEFT">
+                        <parameter name="x" />
+                        <parameter name="y" />
+                        <parameter name="button" />
+                        <script>
+                            <![CDATA[
+                            self.mouse_pos = {'x':x, 'y':y};
+                            ]]>
+                        </script>
+                    </transition>
+                    <transition event="delete_self" target='../../deleted'>                    
+                        <raise event="delete_ball" scope="narrow" target="'parent'">
+                            <parameter expr='self.association_name' />
+                        </raise>
+                    </transition>
+                </state>
+            </state>
+            <state id='deleted' />
+        </scxml>
+    </class>
+</diagram>

+ 31 - 25
examples/bouncingballs/python/target_py/target.py

@@ -1,7 +1,7 @@
 """
 Generated by Statechart compiler by Glenn De Jonghe, Joeri Exelmans, Simon Van Mierlo, and Yentl Van Tendeloo (for the inspiration)
 
-Date:   Thu Aug 04 13:29:22 2016
+Date:   Fri Aug 05 16:11:47 2016
 
 Model author: Simon Van Mierlo+Raphael Mannadiar
 Model name:   Bouncing_Balls_Python_Version
@@ -97,38 +97,40 @@ class MainApp(RuntimeClassBase):
         # transition /running/root/main_behaviour/initializing
         _running_root_main_behaviour_initializing_0 = Transition(self, self.states["/running/root/main_behaviour/initializing"], [self.states["/running/root/main_behaviour/running"]])
         _running_root_main_behaviour_initializing_0.setAction(self._running_root_main_behaviour_initializing_0_exec)
+        _running_root_main_behaviour_initializing_0.setTrigger(None)
         self.states["/running/root/main_behaviour/initializing"].addTransition(_running_root_main_behaviour_initializing_0)
         
         # transition /running/root/main_behaviour/running
         _running_root_main_behaviour_running_0 = Transition(self, self.states["/running/root/main_behaviour/running"], [self.states["/running/root/main_behaviour/running"]])
         _running_root_main_behaviour_running_0.setAction(self._running_root_main_behaviour_running_0_exec)
-        _running_root_main_behaviour_running_0.trigger = Event("button_pressed", None)
+        _running_root_main_behaviour_running_0.setTrigger(Event("button_pressed", None))
         _running_root_main_behaviour_running_0.setGuard(self._running_root_main_behaviour_running_0_guard)
         self.states["/running/root/main_behaviour/running"].addTransition(_running_root_main_behaviour_running_0)
         
         # transition /running/root/cd_behaviour/waiting
         _running_root_cd_behaviour_waiting_0 = Transition(self, self.states["/running/root/cd_behaviour/waiting"], [self.states["/running/root/cd_behaviour/creating"]])
         _running_root_cd_behaviour_waiting_0.setAction(self._running_root_cd_behaviour_waiting_0_exec)
-        _running_root_cd_behaviour_waiting_0.trigger = Event("create_field", None)
+        _running_root_cd_behaviour_waiting_0.setTrigger(Event("create_field", None))
         self.states["/running/root/cd_behaviour/waiting"].addTransition(_running_root_cd_behaviour_waiting_0)
         _running_root_cd_behaviour_waiting_1 = Transition(self, self.states["/running/root/cd_behaviour/waiting"], [self.states["/running/root/cd_behaviour/check_nr_of_fields"]])
         _running_root_cd_behaviour_waiting_1.setAction(self._running_root_cd_behaviour_waiting_1_exec)
-        _running_root_cd_behaviour_waiting_1.trigger = Event("delete_field", None)
+        _running_root_cd_behaviour_waiting_1.setTrigger(Event("delete_field", None))
         self.states["/running/root/cd_behaviour/waiting"].addTransition(_running_root_cd_behaviour_waiting_1)
         
         # transition /running/root/cd_behaviour/creating
         _running_root_cd_behaviour_creating_0 = Transition(self, self.states["/running/root/cd_behaviour/creating"], [self.states["/running/root/cd_behaviour/waiting"]])
         _running_root_cd_behaviour_creating_0.setAction(self._running_root_cd_behaviour_creating_0_exec)
-        _running_root_cd_behaviour_creating_0.trigger = Event("instance_created", None)
+        _running_root_cd_behaviour_creating_0.setTrigger(Event("instance_created", None))
         self.states["/running/root/cd_behaviour/creating"].addTransition(_running_root_cd_behaviour_creating_0)
         
         # transition /running/root/cd_behaviour/check_nr_of_fields
         _running_root_cd_behaviour_check_nr_of_fields_0 = Transition(self, self.states["/running/root/cd_behaviour/check_nr_of_fields"], [self.states["/running/root/cd_behaviour/waiting"]])
+        _running_root_cd_behaviour_check_nr_of_fields_0.setTrigger(None)
         _running_root_cd_behaviour_check_nr_of_fields_0.setGuard(self._running_root_cd_behaviour_check_nr_of_fields_0_guard)
         self.states["/running/root/cd_behaviour/check_nr_of_fields"].addTransition(_running_root_cd_behaviour_check_nr_of_fields_0)
         _running_root_cd_behaviour_check_nr_of_fields_1 = Transition(self, self.states["/running/root/cd_behaviour/check_nr_of_fields"], [self.states["/running/stopped"]])
         _running_root_cd_behaviour_check_nr_of_fields_1.setAction(self._running_root_cd_behaviour_check_nr_of_fields_1_exec)
-        _running_root_cd_behaviour_check_nr_of_fields_1.trigger = Event("_0after")
+        _running_root_cd_behaviour_check_nr_of_fields_1.setTrigger(Event("_0after"))
         _running_root_cd_behaviour_check_nr_of_fields_1.setGuard(self._running_root_cd_behaviour_check_nr_of_fields_1_guard)
         self.states["/running/root/cd_behaviour/check_nr_of_fields"].addTransition(_running_root_cd_behaviour_check_nr_of_fields_1)
     
@@ -300,65 +302,67 @@ class Field(RuntimeClassBase):
         # transition /root/waiting
         _root_waiting_0 = Transition(self, self.states["/root/waiting"], [self.states["/root/initializing"]])
         _root_waiting_0.setAction(self._root_waiting_0_exec)
-        _root_waiting_0.trigger = Event("set_association_name", None)
+        _root_waiting_0.setTrigger(Event("set_association_name", None))
         self.states["/root/waiting"].addTransition(_root_waiting_0)
         
         # transition /root/initializing
         _root_initializing_0 = Transition(self, self.states["/root/initializing"], [self.states["/root/creating"]])
         _root_initializing_0.setAction(self._root_initializing_0_exec)
+        _root_initializing_0.setTrigger(None)
         self.states["/root/initializing"].addTransition(_root_initializing_0)
         
         # transition /root/creating
         _root_creating_0 = Transition(self, self.states["/root/creating"], [self.states["/root/packing"]])
         _root_creating_0.setAction(self._root_creating_0_exec)
-        _root_creating_0.trigger = Event("instance_created", None)
+        _root_creating_0.setTrigger(Event("instance_created", None))
         self.states["/root/creating"].addTransition(_root_creating_0)
         
         # transition /root/packing
         _root_packing_0 = Transition(self, self.states["/root/packing"], [self.states["/root/running"]])
-        _root_packing_0.trigger = Event("button_created", None)
+        _root_packing_0.setTrigger(Event("button_created", None))
         self.states["/root/packing"].addTransition(_root_packing_0)
         
         # transition /root/running/main_behaviour/running
         _root_running_main_behaviour_running_0 = Transition(self, self.states["/root/running/main_behaviour/running"], [self.states["/root/running/main_behaviour/creating"]])
         _root_running_main_behaviour_running_0.setAction(self._root_running_main_behaviour_running_0_exec)
-        _root_running_main_behaviour_running_0.trigger = Event("right_click", "field_ui")
+        _root_running_main_behaviour_running_0.setTrigger(Event("right_click", "field_ui"))
         self.states["/root/running/main_behaviour/running"].addTransition(_root_running_main_behaviour_running_0)
         
         # transition /root/running/main_behaviour/creating
         _root_running_main_behaviour_creating_0 = Transition(self, self.states["/root/running/main_behaviour/creating"], [self.states["/root/running/main_behaviour/running"]])
         _root_running_main_behaviour_creating_0.setAction(self._root_running_main_behaviour_creating_0_exec)
-        _root_running_main_behaviour_creating_0.trigger = Event("instance_created", None)
+        _root_running_main_behaviour_creating_0.setTrigger(Event("instance_created", None))
         self.states["/root/running/main_behaviour/creating"].addTransition(_root_running_main_behaviour_creating_0)
         
         # transition /root/running/deleting_behaviour/running
         _root_running_deleting_behaviour_running_0 = Transition(self, self.states["/root/running/deleting_behaviour/running"], [self.states["/root/running/deleting_behaviour/running"]])
         _root_running_deleting_behaviour_running_0.setAction(self._root_running_deleting_behaviour_running_0_exec)
-        _root_running_deleting_behaviour_running_0.trigger = Event("delete_ball", None)
+        _root_running_deleting_behaviour_running_0.setTrigger(Event("delete_ball", None))
         self.states["/root/running/deleting_behaviour/running"].addTransition(_root_running_deleting_behaviour_running_0)
         
         # transition /root/running/child_behaviour/listening
         _root_running_child_behaviour_listening_0 = Transition(self, self.states["/root/running/child_behaviour/listening"], [self.states["/root/running/child_behaviour/listening"]])
         _root_running_child_behaviour_listening_0.setAction(self._root_running_child_behaviour_listening_0_exec)
-        _root_running_child_behaviour_listening_0.trigger = Event("button_pressed", None)
+        _root_running_child_behaviour_listening_0.setTrigger(Event("button_pressed", None))
         self.states["/root/running/child_behaviour/listening"].addTransition(_root_running_child_behaviour_listening_0)
         
         # transition /root/running/deleting_balls_behaviour/listening
         _root_running_deleting_balls_behaviour_listening_0 = Transition(self, self.states["/root/running/deleting_balls_behaviour/listening"], [self.states["/root/running/deleting_balls_behaviour/listening"]])
         _root_running_deleting_balls_behaviour_listening_0.setAction(self._root_running_deleting_balls_behaviour_listening_0_exec)
-        _root_running_deleting_balls_behaviour_listening_0.trigger = Event("key_press", "field_ui")
+        _root_running_deleting_balls_behaviour_listening_0.setTrigger(Event("key_press", "field_ui"))
         _root_running_deleting_balls_behaviour_listening_0.setGuard(self._root_running_deleting_balls_behaviour_listening_0_guard)
         self.states["/root/running/deleting_balls_behaviour/listening"].addTransition(_root_running_deleting_balls_behaviour_listening_0)
         
         # transition /root/deleting
         _root_deleting_0 = Transition(self, self.states["/root/deleting"], [self.states["/root/deleted"]])
         _root_deleting_0.setAction(self._root_deleting_0_exec)
+        _root_deleting_0.setTrigger(None)
         self.states["/root/deleting"].addTransition(_root_deleting_0)
         
         # transition /root/running
         _root_running_0 = Transition(self, self.states["/root/running"], [self.states["/root/deleting"]])
         _root_running_0.setAction(self._root_running_0_exec)
-        _root_running_0.trigger = Event("window_close", "field_ui")
+        _root_running_0.setTrigger(Event("window_close", "field_ui"))
         self.states["/root/running"].addTransition(_root_running_0)
     
     def _root_running_0_exec(self, parameters):
@@ -461,12 +465,13 @@ class Button(RuntimeClassBase):
         # transition /initializing
         _initializing_0 = Transition(self, self.states["/initializing"], [self.states["/running"]])
         _initializing_0.setAction(self._initializing_0_exec)
+        _initializing_0.setTrigger(None)
         self.states["/initializing"].addTransition(_initializing_0)
         
         # transition /running
         _running_0 = Transition(self, self.states["/running"], [self.states["/running"]])
         _running_0.setAction(self._running_0_exec)
-        _running_0.trigger = Event("mouse_click", "button_ui")
+        _running_0.setTrigger(Event("mouse_click", "button_ui"))
         _running_0.setGuard(self._running_0_guard)
         self.states["/running"].addTransition(_running_0)
     
@@ -570,39 +575,39 @@ class Ball(RuntimeClassBase):
         # transition /main_behaviour/initializing
         _main_behaviour_initializing_0 = Transition(self, self.states["/main_behaviour/initializing"], [self.states["/main_behaviour/bouncing"]])
         _main_behaviour_initializing_0.setAction(self._main_behaviour_initializing_0_exec)
-        _main_behaviour_initializing_0.trigger = Event("set_association_name", None)
+        _main_behaviour_initializing_0.setTrigger(Event("set_association_name", None))
         self.states["/main_behaviour/initializing"].addTransition(_main_behaviour_initializing_0)
         
         # transition /main_behaviour/bouncing
         _main_behaviour_bouncing_0 = Transition(self, self.states["/main_behaviour/bouncing"], [self.states["/main_behaviour/bouncing"]])
         _main_behaviour_bouncing_0.setAction(self._main_behaviour_bouncing_0_exec)
-        _main_behaviour_bouncing_0.trigger = Event("_0after")
+        _main_behaviour_bouncing_0.setTrigger(Event("_0after"))
         self.states["/main_behaviour/bouncing"].addTransition(_main_behaviour_bouncing_0)
         _main_behaviour_bouncing_1 = Transition(self, self.states["/main_behaviour/bouncing"], [self.states["/main_behaviour/selected"]])
         _main_behaviour_bouncing_1.setAction(self._main_behaviour_bouncing_1_exec)
-        _main_behaviour_bouncing_1.trigger = Event("mouse_press", "ball_ui")
+        _main_behaviour_bouncing_1.setTrigger(Event("mouse_press", "ball_ui"))
         _main_behaviour_bouncing_1.setGuard(self._main_behaviour_bouncing_1_guard)
         self.states["/main_behaviour/bouncing"].addTransition(_main_behaviour_bouncing_1)
         
         # transition /main_behaviour/dragging
         _main_behaviour_dragging_0 = Transition(self, self.states["/main_behaviour/dragging"], [self.states["/main_behaviour/dragging"]])
         _main_behaviour_dragging_0.setAction(self._main_behaviour_dragging_0_exec)
-        _main_behaviour_dragging_0.trigger = Event("mouse_move", "ball_ui")
+        _main_behaviour_dragging_0.setTrigger(Event("mouse_move", "ball_ui"))
         self.states["/main_behaviour/dragging"].addTransition(_main_behaviour_dragging_0)
         _main_behaviour_dragging_1 = Transition(self, self.states["/main_behaviour/dragging"], [self.states["/main_behaviour/bouncing"]])
         _main_behaviour_dragging_1.setAction(self._main_behaviour_dragging_1_exec)
-        _main_behaviour_dragging_1.trigger = Event("mouse_release", "ball_ui")
+        _main_behaviour_dragging_1.setTrigger(Event("mouse_release", "ball_ui"))
         self.states["/main_behaviour/dragging"].addTransition(_main_behaviour_dragging_1)
         
         # transition /main_behaviour/selected
         _main_behaviour_selected_0 = Transition(self, self.states["/main_behaviour/selected"], [self.states["/main_behaviour/dragging"]])
         _main_behaviour_selected_0.setAction(self._main_behaviour_selected_0_exec)
-        _main_behaviour_selected_0.trigger = Event("mouse_press", "ball_ui")
+        _main_behaviour_selected_0.setTrigger(Event("mouse_press", "ball_ui"))
         _main_behaviour_selected_0.setGuard(self._main_behaviour_selected_0_guard)
         self.states["/main_behaviour/selected"].addTransition(_main_behaviour_selected_0)
         _main_behaviour_selected_1 = Transition(self, self.states["/main_behaviour/selected"], [self.states["/deleted"]])
         _main_behaviour_selected_1.setAction(self._main_behaviour_selected_1_exec)
-        _main_behaviour_selected_1.trigger = Event("delete_self", None)
+        _main_behaviour_selected_1.setTrigger(Event("delete_self", None))
         self.states["/main_behaviour/selected"].addTransition(_main_behaviour_selected_1)
     
     def _main_behaviour_bouncing_enter(self):
@@ -717,8 +722,9 @@ class ObjectManager(ObjectManagerBase):
         return instance
 
 class Controller(EventLoopControllerBase):
-    def __init__(self, event_loop_callbacks, finished_callback = None):
+    def __init__(self, event_loop_callbacks, finished_callback = None, behind_schedule_callback = None):
         if finished_callback == None: finished_callback = None
-        EventLoopControllerBase.__init__(self, ObjectManager(self), event_loop_callbacks, finished_callback)
+        if behind_schedule_callback == None: behind_schedule_callback = None
+        EventLoopControllerBase.__init__(self, ObjectManager(self), event_loop_callbacks, finished_callback, behind_schedule_callback)
         self.addInputPort("ui")
         self.object_manager.createInstance("MainApp", [])

+ 786 - 0
examples/bouncingballs/python/target_py/target_performance.py

@@ -0,0 +1,786 @@
+"""
+Generated by Statechart compiler by Glenn De Jonghe, Joeri Exelmans, Simon Van Mierlo, and Yentl Van Tendeloo (for the inspiration)
+
+Date:   Fri Aug 05 16:11:48 2016
+
+Model author: Simon Van Mierlo+Raphael Mannadiar
+Model name:   Bouncing_Balls_Python_Version
+Model description:
+Tkinter frame with bouncing balls in it.
+"""
+
+from sccd.runtime.statecharts_core import *
+from sccd.runtime.libs.ui import ui
+from sccd.runtime.libs.utils import utils
+import random
+
+# package "Bouncing_Balls_Python_Version"
+
+class MainApp(RuntimeClassBase):
+    def __init__(self, controller):
+        RuntimeClassBase.__init__(self, controller)
+        
+        self.semantics.big_step_maximality = StatechartSemantics.TakeMany
+        self.semantics.internal_event_lifeline = StatechartSemantics.Queue
+        self.semantics.input_event_lifeline = StatechartSemantics.FirstComboStep
+        self.semantics.priority = StatechartSemantics.SourceParent
+        self.semantics.concurrency = StatechartSemantics.Single
+        
+        # build Statechart structure
+        self.build_statechart_structure()
+        
+        # call user defined constructor
+        MainApp.user_defined_constructor(self)
+    
+    def user_defined_constructor(self):
+        self.nr_of_fields = 0
+    
+    def user_defined_destructor(self):
+        pass
+    
+    
+    # builds Statechart structure
+    def build_statechart_structure(self):
+        
+        # state <root>
+        self.states[""] = State(0, self)
+        
+        # state /running
+        self.states["/running"] = State(1, self)
+        
+        # state /running/root
+        self.states["/running/root"] = ParallelState(2, self)
+        
+        # state /running/root/main_behaviour
+        self.states["/running/root/main_behaviour"] = State(3, self)
+        
+        # state /running/root/main_behaviour/initializing
+        self.states["/running/root/main_behaviour/initializing"] = State(4, self)
+        
+        # state /running/root/main_behaviour/running
+        self.states["/running/root/main_behaviour/running"] = State(5, self)
+        
+        # state /running/root/cd_behaviour
+        self.states["/running/root/cd_behaviour"] = State(6, self)
+        
+        # state /running/root/cd_behaviour/waiting
+        self.states["/running/root/cd_behaviour/waiting"] = State(7, self)
+        
+        # state /running/root/cd_behaviour/creating
+        self.states["/running/root/cd_behaviour/creating"] = State(8, self)
+        
+        # state /running/root/cd_behaviour/check_nr_of_fields
+        self.states["/running/root/cd_behaviour/check_nr_of_fields"] = State(9, self)
+        self.states["/running/root/cd_behaviour/check_nr_of_fields"].setEnter(self._running_root_cd_behaviour_check_nr_of_fields_enter)
+        self.states["/running/root/cd_behaviour/check_nr_of_fields"].setExit(self._running_root_cd_behaviour_check_nr_of_fields_exit)
+        
+        # state /running/root/spawn_windows
+        self.states["/running/root/spawn_windows"] = State(10, self)
+        
+        # state /running/root/spawn_windows/spawning
+        self.states["/running/root/spawn_windows/spawning"] = State(11, self)
+        self.states["/running/root/spawn_windows/spawning"].setEnter(self._running_root_spawn_windows_spawning_enter)
+        self.states["/running/root/spawn_windows/spawning"].setExit(self._running_root_spawn_windows_spawning_exit)
+        
+        # state /running/stopped
+        self.states["/running/stopped"] = State(12, self)
+        
+        # add children
+        self.states[""].addChild(self.states["/running"])
+        self.states["/running"].addChild(self.states["/running/root"])
+        self.states["/running"].addChild(self.states["/running/stopped"])
+        self.states["/running/root"].addChild(self.states["/running/root/main_behaviour"])
+        self.states["/running/root"].addChild(self.states["/running/root/cd_behaviour"])
+        self.states["/running/root"].addChild(self.states["/running/root/spawn_windows"])
+        self.states["/running/root/main_behaviour"].addChild(self.states["/running/root/main_behaviour/initializing"])
+        self.states["/running/root/main_behaviour"].addChild(self.states["/running/root/main_behaviour/running"])
+        self.states["/running/root/cd_behaviour"].addChild(self.states["/running/root/cd_behaviour/waiting"])
+        self.states["/running/root/cd_behaviour"].addChild(self.states["/running/root/cd_behaviour/creating"])
+        self.states["/running/root/cd_behaviour"].addChild(self.states["/running/root/cd_behaviour/check_nr_of_fields"])
+        self.states["/running/root/spawn_windows"].addChild(self.states["/running/root/spawn_windows/spawning"])
+        self.states[""].fixTree()
+        self.states[""].default_state = self.states["/running"]
+        self.states["/running"].default_state = self.states["/running/root"]
+        self.states["/running/root/main_behaviour"].default_state = self.states["/running/root/main_behaviour/initializing"]
+        self.states["/running/root/cd_behaviour"].default_state = self.states["/running/root/cd_behaviour/waiting"]
+        self.states["/running/root/spawn_windows"].default_state = self.states["/running/root/spawn_windows/spawning"]
+        
+        # transition /running/root/main_behaviour/initializing
+        _running_root_main_behaviour_initializing_0 = Transition(self, self.states["/running/root/main_behaviour/initializing"], [self.states["/running/root/main_behaviour/running"]])
+        _running_root_main_behaviour_initializing_0.setAction(self._running_root_main_behaviour_initializing_0_exec)
+        _running_root_main_behaviour_initializing_0.setTrigger(None)
+        self.states["/running/root/main_behaviour/initializing"].addTransition(_running_root_main_behaviour_initializing_0)
+        
+        # transition /running/root/main_behaviour/running
+        _running_root_main_behaviour_running_0 = Transition(self, self.states["/running/root/main_behaviour/running"], [self.states["/running/root/main_behaviour/running"]])
+        _running_root_main_behaviour_running_0.setAction(self._running_root_main_behaviour_running_0_exec)
+        _running_root_main_behaviour_running_0.setTrigger(Event("button_pressed", None))
+        _running_root_main_behaviour_running_0.setGuard(self._running_root_main_behaviour_running_0_guard)
+        self.states["/running/root/main_behaviour/running"].addTransition(_running_root_main_behaviour_running_0)
+        
+        # transition /running/root/cd_behaviour/waiting
+        _running_root_cd_behaviour_waiting_0 = Transition(self, self.states["/running/root/cd_behaviour/waiting"], [self.states["/running/root/cd_behaviour/creating"]])
+        _running_root_cd_behaviour_waiting_0.setAction(self._running_root_cd_behaviour_waiting_0_exec)
+        _running_root_cd_behaviour_waiting_0.setTrigger(Event("create_field", None))
+        self.states["/running/root/cd_behaviour/waiting"].addTransition(_running_root_cd_behaviour_waiting_0)
+        _running_root_cd_behaviour_waiting_1 = Transition(self, self.states["/running/root/cd_behaviour/waiting"], [self.states["/running/root/cd_behaviour/check_nr_of_fields"]])
+        _running_root_cd_behaviour_waiting_1.setAction(self._running_root_cd_behaviour_waiting_1_exec)
+        _running_root_cd_behaviour_waiting_1.setTrigger(Event("delete_field", None))
+        self.states["/running/root/cd_behaviour/waiting"].addTransition(_running_root_cd_behaviour_waiting_1)
+        
+        # transition /running/root/cd_behaviour/creating
+        _running_root_cd_behaviour_creating_0 = Transition(self, self.states["/running/root/cd_behaviour/creating"], [self.states["/running/root/cd_behaviour/waiting"]])
+        _running_root_cd_behaviour_creating_0.setAction(self._running_root_cd_behaviour_creating_0_exec)
+        _running_root_cd_behaviour_creating_0.setTrigger(Event("instance_created", None))
+        self.states["/running/root/cd_behaviour/creating"].addTransition(_running_root_cd_behaviour_creating_0)
+        
+        # transition /running/root/cd_behaviour/check_nr_of_fields
+        _running_root_cd_behaviour_check_nr_of_fields_0 = Transition(self, self.states["/running/root/cd_behaviour/check_nr_of_fields"], [self.states["/running/root/cd_behaviour/waiting"]])
+        _running_root_cd_behaviour_check_nr_of_fields_0.setTrigger(None)
+        _running_root_cd_behaviour_check_nr_of_fields_0.setGuard(self._running_root_cd_behaviour_check_nr_of_fields_0_guard)
+        self.states["/running/root/cd_behaviour/check_nr_of_fields"].addTransition(_running_root_cd_behaviour_check_nr_of_fields_0)
+        _running_root_cd_behaviour_check_nr_of_fields_1 = Transition(self, self.states["/running/root/cd_behaviour/check_nr_of_fields"], [self.states["/running/stopped"]])
+        _running_root_cd_behaviour_check_nr_of_fields_1.setAction(self._running_root_cd_behaviour_check_nr_of_fields_1_exec)
+        _running_root_cd_behaviour_check_nr_of_fields_1.setTrigger(Event("_0after"))
+        _running_root_cd_behaviour_check_nr_of_fields_1.setGuard(self._running_root_cd_behaviour_check_nr_of_fields_1_guard)
+        self.states["/running/root/cd_behaviour/check_nr_of_fields"].addTransition(_running_root_cd_behaviour_check_nr_of_fields_1)
+        
+        # transition /running/root/spawn_windows/spawning
+        _running_root_spawn_windows_spawning_0 = Transition(self, self.states["/running/root/spawn_windows/spawning"], [self.states["/running/root/spawn_windows/spawning"]])
+        _running_root_spawn_windows_spawning_0.setAction(self._running_root_spawn_windows_spawning_0_exec)
+        _running_root_spawn_windows_spawning_0.setTrigger(Event("_1after"))
+        _running_root_spawn_windows_spawning_0.setGuard(self._running_root_spawn_windows_spawning_0_guard)
+        self.states["/running/root/spawn_windows/spawning"].addTransition(_running_root_spawn_windows_spawning_0)
+    
+    def _running_root_cd_behaviour_check_nr_of_fields_enter(self):
+        self.addTimer(0, 0.05)
+    
+    def _running_root_cd_behaviour_check_nr_of_fields_exit(self):
+        self.removeTimer(0)
+    
+    def _running_root_spawn_windows_spawning_enter(self):
+        self.addTimer(1, (1000 - self.getSimulatedTime() % 1000) / 1000.0)
+    
+    def _running_root_spawn_windows_spawning_exit(self):
+        self.removeTimer(1)
+    
+    def _running_root_main_behaviour_initializing_0_exec(self, parameters):
+        self.raiseInternalEvent(Event("create_field", None, []))
+    
+    def _running_root_main_behaviour_running_0_exec(self, parameters):
+        event_name = parameters[0]
+        self.raiseInternalEvent(Event("create_field", None, []))
+    
+    def _running_root_main_behaviour_running_0_guard(self, parameters):
+        event_name = parameters[0]
+        return event_name == "create_new_field"
+    
+    def _running_root_cd_behaviour_waiting_0_exec(self, parameters):
+        self.big_step.outputEventOM(Event("create_instance", None, [self, "fields"]))
+    
+    def _running_root_cd_behaviour_waiting_1_exec(self, parameters):
+        association_name = parameters[0]
+        self.big_step.outputEventOM(Event("delete_instance", None, [self, association_name]))
+        self.nr_of_fields -= 1
+    
+    def _running_root_cd_behaviour_creating_0_exec(self, parameters):
+        association_name = parameters[0]
+        self.big_step.outputEventOM(Event("start_instance", None, [self, association_name]))
+        self.big_step.outputEventOM(Event("narrow_cast", None, [self, association_name, Event("set_association_name", None, [association_name])]))
+        self.nr_of_fields += 1
+    
+    def _running_root_cd_behaviour_check_nr_of_fields_0_guard(self, parameters):
+        return self.nr_of_fields != 0
+    
+    def _running_root_cd_behaviour_check_nr_of_fields_1_exec(self, parameters):
+        ui.close_window(ui.window)
+    
+    def _running_root_cd_behaviour_check_nr_of_fields_1_guard(self, parameters):
+        return self.nr_of_fields == 0
+    
+    def _running_root_spawn_windows_spawning_0_exec(self, parameters):
+        self.raiseInternalEvent(Event("button_pressed", None, ['create_new_field']))
+    
+    def _running_root_spawn_windows_spawning_0_guard(self, parameters):
+        return self.nr_of_fields < 10
+    
+    def initializeStatechart(self):
+        # enter default state
+        states = self.states["/running"].getEffectiveTargetStates()
+        self.updateConfiguration(states)
+        for state in states:
+            if state.enter:
+                state.enter()
+
+class Field(RuntimeClassBase):
+    def __init__(self, controller):
+        RuntimeClassBase.__init__(self, controller)
+        
+        self.semantics.big_step_maximality = StatechartSemantics.TakeMany
+        self.semantics.internal_event_lifeline = StatechartSemantics.Queue
+        self.semantics.input_event_lifeline = StatechartSemantics.FirstComboStep
+        self.semantics.priority = StatechartSemantics.SourceParent
+        self.semantics.concurrency = StatechartSemantics.Single
+        
+        # build Statechart structure
+        self.build_statechart_structure()
+        self.inports["field_ui"] = controller.addInputPort("field_ui", self)
+        
+        # user defined attributes
+        self.canvas = None
+        self.field_window = None
+        
+        # call user defined constructor
+        Field.user_defined_constructor(self)
+    
+    def user_defined_constructor(self):
+        self.field_window = ui.new_window(400,450);
+        self.canvas = ui.append_canvas(self.field_window,400,400,{'background':'#eee'});
+        ui.bind_event(self.field_window, ui.EVENTS.WINDOW_CLOSE, self.controller, 'window_close', self.inports['field_ui']);
+        ui.bind_event(self.field_window, ui.EVENTS.KEY_PRESS, self.controller, 'key_press', self.inports['field_ui']);
+        ui.bind_event(self.canvas.element, ui.EVENTS.MOUSE_RIGHT_CLICK,    self.controller, 'right_click', self.inports['field_ui']);
+        ui.bind_event(self.canvas.element, ui.EVENTS.MOUSE_MOVE, self.controller, 'mouse_move', self.inports['field_ui']);
+        ui.bind_event(self.canvas.element, ui.EVENTS.MOUSE_RELEASE, self.controller, 'mouse_release', self.inports['field_ui']);
+    
+    def user_defined_destructor(self):
+        ui.close_window(self.field_window);
+    
+    
+    # builds Statechart structure
+    def build_statechart_structure(self):
+        
+        # state <root>
+        self.states[""] = State(0, self)
+        
+        # state /root
+        self.states["/root"] = State(1, self)
+        
+        # state /root/waiting
+        self.states["/root/waiting"] = State(2, self)
+        
+        # state /root/initializing
+        self.states["/root/initializing"] = State(3, self)
+        
+        # state /root/creating
+        self.states["/root/creating"] = State(4, self)
+        
+        # state /root/packing
+        self.states["/root/packing"] = State(5, self)
+        
+        # state /root/running
+        self.states["/root/running"] = ParallelState(6, self)
+        
+        # state /root/running/main_behaviour
+        self.states["/root/running/main_behaviour"] = State(7, self)
+        
+        # state /root/running/main_behaviour/running
+        self.states["/root/running/main_behaviour/running"] = State(8, self)
+        
+        # state /root/running/main_behaviour/creating
+        self.states["/root/running/main_behaviour/creating"] = State(9, self)
+        
+        # state /root/running/deleting_behaviour
+        self.states["/root/running/deleting_behaviour"] = State(10, self)
+        
+        # state /root/running/deleting_behaviour/running
+        self.states["/root/running/deleting_behaviour/running"] = State(11, self)
+        
+        # state /root/running/child_behaviour
+        self.states["/root/running/child_behaviour"] = State(12, self)
+        
+        # state /root/running/child_behaviour/listening
+        self.states["/root/running/child_behaviour/listening"] = State(13, self)
+        
+        # state /root/running/deleting_balls_behaviour
+        self.states["/root/running/deleting_balls_behaviour"] = State(14, self)
+        
+        # state /root/running/deleting_balls_behaviour/listening
+        self.states["/root/running/deleting_balls_behaviour/listening"] = State(15, self)
+        
+        # state /root/running/spawn_balls
+        self.states["/root/running/spawn_balls"] = State(16, self)
+        
+        # state /root/running/spawn_balls/spawning
+        self.states["/root/running/spawn_balls/spawning"] = State(17, self)
+        self.states["/root/running/spawn_balls/spawning"].setEnter(self._root_running_spawn_balls_spawning_enter)
+        self.states["/root/running/spawn_balls/spawning"].setExit(self._root_running_spawn_balls_spawning_exit)
+        
+        # state /root/deleting
+        self.states["/root/deleting"] = State(18, self)
+        
+        # state /root/deleted
+        self.states["/root/deleted"] = State(19, self)
+        
+        # add children
+        self.states[""].addChild(self.states["/root"])
+        self.states["/root"].addChild(self.states["/root/waiting"])
+        self.states["/root"].addChild(self.states["/root/initializing"])
+        self.states["/root"].addChild(self.states["/root/creating"])
+        self.states["/root"].addChild(self.states["/root/packing"])
+        self.states["/root"].addChild(self.states["/root/running"])
+        self.states["/root"].addChild(self.states["/root/deleting"])
+        self.states["/root"].addChild(self.states["/root/deleted"])
+        self.states["/root/running"].addChild(self.states["/root/running/main_behaviour"])
+        self.states["/root/running"].addChild(self.states["/root/running/deleting_behaviour"])
+        self.states["/root/running"].addChild(self.states["/root/running/child_behaviour"])
+        self.states["/root/running"].addChild(self.states["/root/running/deleting_balls_behaviour"])
+        self.states["/root/running"].addChild(self.states["/root/running/spawn_balls"])
+        self.states["/root/running/main_behaviour"].addChild(self.states["/root/running/main_behaviour/running"])
+        self.states["/root/running/main_behaviour"].addChild(self.states["/root/running/main_behaviour/creating"])
+        self.states["/root/running/deleting_behaviour"].addChild(self.states["/root/running/deleting_behaviour/running"])
+        self.states["/root/running/child_behaviour"].addChild(self.states["/root/running/child_behaviour/listening"])
+        self.states["/root/running/deleting_balls_behaviour"].addChild(self.states["/root/running/deleting_balls_behaviour/listening"])
+        self.states["/root/running/spawn_balls"].addChild(self.states["/root/running/spawn_balls/spawning"])
+        self.states[""].fixTree()
+        self.states[""].default_state = self.states["/root"]
+        self.states["/root"].default_state = self.states["/root/waiting"]
+        self.states["/root/running/main_behaviour"].default_state = self.states["/root/running/main_behaviour/running"]
+        self.states["/root/running/deleting_behaviour"].default_state = self.states["/root/running/deleting_behaviour/running"]
+        self.states["/root/running/child_behaviour"].default_state = self.states["/root/running/child_behaviour/listening"]
+        self.states["/root/running/deleting_balls_behaviour"].default_state = self.states["/root/running/deleting_balls_behaviour/listening"]
+        self.states["/root/running/spawn_balls"].default_state = self.states["/root/running/spawn_balls/spawning"]
+        
+        # transition /root/waiting
+        _root_waiting_0 = Transition(self, self.states["/root/waiting"], [self.states["/root/initializing"]])
+        _root_waiting_0.setAction(self._root_waiting_0_exec)
+        _root_waiting_0.setTrigger(Event("set_association_name", None))
+        self.states["/root/waiting"].addTransition(_root_waiting_0)
+        
+        # transition /root/initializing
+        _root_initializing_0 = Transition(self, self.states["/root/initializing"], [self.states["/root/creating"]])
+        _root_initializing_0.setAction(self._root_initializing_0_exec)
+        _root_initializing_0.setTrigger(None)
+        self.states["/root/initializing"].addTransition(_root_initializing_0)
+        
+        # transition /root/creating
+        _root_creating_0 = Transition(self, self.states["/root/creating"], [self.states["/root/packing"]])
+        _root_creating_0.setAction(self._root_creating_0_exec)
+        _root_creating_0.setTrigger(Event("instance_created", None))
+        self.states["/root/creating"].addTransition(_root_creating_0)
+        
+        # transition /root/packing
+        _root_packing_0 = Transition(self, self.states["/root/packing"], [self.states["/root/running"]])
+        _root_packing_0.setTrigger(Event("button_created", None))
+        self.states["/root/packing"].addTransition(_root_packing_0)
+        
+        # transition /root/running/main_behaviour/running
+        _root_running_main_behaviour_running_0 = Transition(self, self.states["/root/running/main_behaviour/running"], [self.states["/root/running/main_behaviour/creating"]])
+        _root_running_main_behaviour_running_0.setAction(self._root_running_main_behaviour_running_0_exec)
+        _root_running_main_behaviour_running_0.setTrigger(Event("right_click", None))
+        self.states["/root/running/main_behaviour/running"].addTransition(_root_running_main_behaviour_running_0)
+        
+        # transition /root/running/main_behaviour/creating
+        _root_running_main_behaviour_creating_0 = Transition(self, self.states["/root/running/main_behaviour/creating"], [self.states["/root/running/main_behaviour/running"]])
+        _root_running_main_behaviour_creating_0.setAction(self._root_running_main_behaviour_creating_0_exec)
+        _root_running_main_behaviour_creating_0.setTrigger(Event("instance_created", None))
+        self.states["/root/running/main_behaviour/creating"].addTransition(_root_running_main_behaviour_creating_0)
+        
+        # transition /root/running/deleting_behaviour/running
+        _root_running_deleting_behaviour_running_0 = Transition(self, self.states["/root/running/deleting_behaviour/running"], [self.states["/root/running/deleting_behaviour/running"]])
+        _root_running_deleting_behaviour_running_0.setAction(self._root_running_deleting_behaviour_running_0_exec)
+        _root_running_deleting_behaviour_running_0.setTrigger(Event("delete_ball", None))
+        self.states["/root/running/deleting_behaviour/running"].addTransition(_root_running_deleting_behaviour_running_0)
+        
+        # transition /root/running/child_behaviour/listening
+        _root_running_child_behaviour_listening_0 = Transition(self, self.states["/root/running/child_behaviour/listening"], [self.states["/root/running/child_behaviour/listening"]])
+        _root_running_child_behaviour_listening_0.setAction(self._root_running_child_behaviour_listening_0_exec)
+        _root_running_child_behaviour_listening_0.setTrigger(Event("button_pressed", None))
+        self.states["/root/running/child_behaviour/listening"].addTransition(_root_running_child_behaviour_listening_0)
+        
+        # transition /root/running/deleting_balls_behaviour/listening
+        _root_running_deleting_balls_behaviour_listening_0 = Transition(self, self.states["/root/running/deleting_balls_behaviour/listening"], [self.states["/root/running/deleting_balls_behaviour/listening"]])
+        _root_running_deleting_balls_behaviour_listening_0.setAction(self._root_running_deleting_balls_behaviour_listening_0_exec)
+        _root_running_deleting_balls_behaviour_listening_0.setTrigger(Event("key_press", "field_ui"))
+        _root_running_deleting_balls_behaviour_listening_0.setGuard(self._root_running_deleting_balls_behaviour_listening_0_guard)
+        self.states["/root/running/deleting_balls_behaviour/listening"].addTransition(_root_running_deleting_balls_behaviour_listening_0)
+        
+        # transition /root/running/spawn_balls/spawning
+        _root_running_spawn_balls_spawning_0 = Transition(self, self.states["/root/running/spawn_balls/spawning"], [self.states["/root/running/spawn_balls/spawning"]])
+        _root_running_spawn_balls_spawning_0.setAction(self._root_running_spawn_balls_spawning_0_exec)
+        _root_running_spawn_balls_spawning_0.setTrigger(Event("_0after"))
+        self.states["/root/running/spawn_balls/spawning"].addTransition(_root_running_spawn_balls_spawning_0)
+        
+        # transition /root/deleting
+        _root_deleting_0 = Transition(self, self.states["/root/deleting"], [self.states["/root/deleted"]])
+        _root_deleting_0.setAction(self._root_deleting_0_exec)
+        _root_deleting_0.setTrigger(None)
+        self.states["/root/deleting"].addTransition(_root_deleting_0)
+        
+        # transition /root/running
+        _root_running_0 = Transition(self, self.states["/root/running"], [self.states["/root/deleting"]])
+        _root_running_0.setAction(self._root_running_0_exec)
+        _root_running_0.setTrigger(Event("window_close", "field_ui"))
+        self.states["/root/running"].addTransition(_root_running_0)
+    
+    def _root_running_spawn_balls_spawning_enter(self):
+        self.addTimer(0, (50 - self.getSimulatedTime() % 50) / 1000.0)
+    
+    def _root_running_spawn_balls_spawning_exit(self):
+        self.removeTimer(0)
+    
+    def _root_running_0_exec(self, parameters):
+        self.big_step.outputEventOM(Event("delete_instance", None, [self, "buttons"]))
+        self.big_step.outputEventOM(Event("delete_instance", None, [self, "balls"]))
+    
+    def _root_waiting_0_exec(self, parameters):
+        association_name = parameters[0]
+        self.association_name = association_name
+    
+    def _root_initializing_0_exec(self, parameters):
+        self.big_step.outputEventOM(Event("create_instance", None, [self, "buttons", "Button", self, 'create_new_field', 'Spawn New Window']))
+    
+    def _root_creating_0_exec(self, parameters):
+        association_name = parameters[0]
+        self.big_step.outputEventOM(Event("start_instance", None, [self, association_name]))
+    
+    def _root_running_main_behaviour_running_0_exec(self, parameters):
+        x = parameters[0]
+        y = parameters[1]
+        button = parameters[2]
+        self.big_step.outputEventOM(Event("create_instance", None, [self, "balls", "Ball", self.canvas, x, y]))
+    
+    def _root_running_main_behaviour_creating_0_exec(self, parameters):
+        association_name = parameters[0]
+        self.big_step.outputEventOM(Event("start_instance", None, [self, association_name]))
+        self.big_step.outputEventOM(Event("narrow_cast", None, [self, association_name, Event("set_association_name", None, [association_name])]))
+    
+    def _root_running_deleting_behaviour_running_0_exec(self, parameters):
+        association_name = parameters[0]
+        self.big_step.outputEventOM(Event("delete_instance", None, [self, association_name]))
+    
+    def _root_running_child_behaviour_listening_0_exec(self, parameters):
+        event_name = parameters[0]
+        self.big_step.outputEventOM(Event("narrow_cast", None, [self, 'parent', Event("button_pressed", None, [event_name])]))
+    
+    def _root_running_deleting_balls_behaviour_listening_0_exec(self, parameters):
+        key = parameters[0]
+        self.big_step.outputEventOM(Event("narrow_cast", None, [self, 'balls', Event("delete_self", None, [])]))
+    
+    def _root_running_deleting_balls_behaviour_listening_0_guard(self, parameters):
+        key = parameters[0]
+        return key == ui.KEYCODES.DELETE
+    
+    def _root_running_spawn_balls_spawning_0_exec(self, parameters):
+        self.raiseInternalEvent(Event("right_click", None, [150, 150, None]))
+    
+    def _root_deleting_0_exec(self, parameters):
+        self.big_step.outputEventOM(Event("narrow_cast", None, [self, 'parent', Event("delete_field", None, [self.association_name])]))
+    
+    def initializeStatechart(self):
+        # enter default state
+        states = self.states["/root"].getEffectiveTargetStates()
+        self.updateConfiguration(states)
+        for state in states:
+            if state.enter:
+                state.enter()
+
+class Button(RuntimeClassBase):
+    def __init__(self, controller, parent, event_name, button_text):
+        RuntimeClassBase.__init__(self, controller)
+        
+        self.semantics.big_step_maximality = StatechartSemantics.TakeMany
+        self.semantics.internal_event_lifeline = StatechartSemantics.Queue
+        self.semantics.input_event_lifeline = StatechartSemantics.FirstComboStep
+        self.semantics.priority = StatechartSemantics.SourceParent
+        self.semantics.concurrency = StatechartSemantics.Single
+        
+        # build Statechart structure
+        self.build_statechart_structure()
+        self.inports["button_ui"] = controller.addInputPort("button_ui", self)
+        
+        # call user defined constructor
+        Button.user_defined_constructor(self, parent, event_name, button_text)
+    
+    def user_defined_constructor(self, parent, event_name, button_text):
+        self.event_name = event_name;
+        button = ui.append_button(parent.field_window, event_name);
+        ui.bind_event(button.element, ui.EVENTS.MOUSE_CLICK, self.controller, 'mouse_click', self.inports['button_ui']);
+    
+    def user_defined_destructor(self):
+        pass
+    
+    
+    # builds Statechart structure
+    def build_statechart_structure(self):
+        
+        # state <root>
+        self.states[""] = State(0, self)
+        
+        # state /initializing
+        self.states["/initializing"] = State(1, self)
+        
+        # state /running
+        self.states["/running"] = State(2, self)
+        
+        # add children
+        self.states[""].addChild(self.states["/initializing"])
+        self.states[""].addChild(self.states["/running"])
+        self.states[""].fixTree()
+        self.states[""].default_state = self.states["/initializing"]
+        
+        # transition /initializing
+        _initializing_0 = Transition(self, self.states["/initializing"], [self.states["/running"]])
+        _initializing_0.setAction(self._initializing_0_exec)
+        _initializing_0.setTrigger(None)
+        self.states["/initializing"].addTransition(_initializing_0)
+        
+        # transition /running
+        _running_0 = Transition(self, self.states["/running"], [self.states["/running"]])
+        _running_0.setAction(self._running_0_exec)
+        _running_0.setTrigger(Event("mouse_click", "button_ui"))
+        _running_0.setGuard(self._running_0_guard)
+        self.states["/running"].addTransition(_running_0)
+    
+    def _initializing_0_exec(self, parameters):
+        self.big_step.outputEventOM(Event("narrow_cast", None, [self, 'parent', Event("button_created", None, [])]))
+    
+    def _running_0_exec(self, parameters):
+        x = parameters[0]
+        y = parameters[1]
+        button = parameters[2]
+        self.big_step.outputEventOM(Event("narrow_cast", None, [self, 'parent', Event("button_pressed", None, [self.event_name])]))
+    
+    def _running_0_guard(self, parameters):
+        x = parameters[0]
+        y = parameters[1]
+        button = parameters[2]
+        return button == ui.MOUSE_BUTTONS.LEFT
+    
+    def initializeStatechart(self):
+        # enter default state
+        states = self.states["/initializing"].getEffectiveTargetStates()
+        self.updateConfiguration(states)
+        for state in states:
+            if state.enter:
+                state.enter()
+
+class Ball(RuntimeClassBase):
+    def __init__(self, controller, canvas, x, y):
+        RuntimeClassBase.__init__(self, controller)
+        
+        self.semantics.big_step_maximality = StatechartSemantics.TakeMany
+        self.semantics.internal_event_lifeline = StatechartSemantics.Queue
+        self.semantics.input_event_lifeline = StatechartSemantics.FirstComboStep
+        self.semantics.priority = StatechartSemantics.SourceParent
+        self.semantics.concurrency = StatechartSemantics.Single
+        
+        # build Statechart structure
+        self.build_statechart_structure()
+        self.inports["ball_ui"] = controller.addInputPort("ball_ui", self)
+        
+        # user defined attributes
+        self.canvas = None
+        
+        # call user defined constructor
+        Ball.user_defined_constructor(self, canvas, x, y)
+    
+    def user_defined_constructor(self, canvas, x, y):
+        self.canvas = canvas;
+        self.r = 20.0;
+        self.vel = {'x': random.uniform(-5.0, 5.0), 'y': random.uniform(-5.0, 5.0)};
+        self.mouse_pos = {};
+        self.smooth = 0.4; # value between 0 and 1
+        
+        circle = self.canvas.add_circle(x, y, self.r, {'fill':'#000'});
+        ui.bind_event(circle, ui.EVENTS.MOUSE_PRESS, self.controller, 'mouse_press', self.inports["ball_ui"]);
+        ui.bind_event(circle, ui.EVENTS.MOUSE_MOVE, self.controller, 'mouse_move', self.inports['ball_ui']);
+        ui.bind_event(circle, ui.EVENTS.MOUSE_RELEASE, self.controller, 'mouse_release', self.inports['ball_ui']);
+        self.element = circle;
+    
+    def user_defined_destructor(self):
+        self.canvas.remove_element(self.element);
+    
+    
+    # builds Statechart structure
+    def build_statechart_structure(self):
+        
+        # state <root>
+        self.states[""] = State(0, self)
+        
+        # state /main_behaviour
+        self.states["/main_behaviour"] = State(1, self)
+        
+        # state /main_behaviour/initializing
+        self.states["/main_behaviour/initializing"] = State(2, self)
+        
+        # state /main_behaviour/bouncing
+        self.states["/main_behaviour/bouncing"] = State(3, self)
+        self.states["/main_behaviour/bouncing"].setEnter(self._main_behaviour_bouncing_enter)
+        self.states["/main_behaviour/bouncing"].setExit(self._main_behaviour_bouncing_exit)
+        
+        # state /main_behaviour/dragging
+        self.states["/main_behaviour/dragging"] = State(4, self)
+        
+        # state /main_behaviour/selected
+        self.states["/main_behaviour/selected"] = State(5, self)
+        
+        # state /deleted
+        self.states["/deleted"] = State(6, self)
+        
+        # add children
+        self.states[""].addChild(self.states["/main_behaviour"])
+        self.states[""].addChild(self.states["/deleted"])
+        self.states["/main_behaviour"].addChild(self.states["/main_behaviour/initializing"])
+        self.states["/main_behaviour"].addChild(self.states["/main_behaviour/bouncing"])
+        self.states["/main_behaviour"].addChild(self.states["/main_behaviour/dragging"])
+        self.states["/main_behaviour"].addChild(self.states["/main_behaviour/selected"])
+        self.states[""].fixTree()
+        self.states[""].default_state = self.states["/main_behaviour"]
+        self.states["/main_behaviour"].default_state = self.states["/main_behaviour/initializing"]
+        
+        # transition /main_behaviour/initializing
+        _main_behaviour_initializing_0 = Transition(self, self.states["/main_behaviour/initializing"], [self.states["/main_behaviour/bouncing"]])
+        _main_behaviour_initializing_0.setAction(self._main_behaviour_initializing_0_exec)
+        _main_behaviour_initializing_0.setTrigger(Event("set_association_name", None))
+        self.states["/main_behaviour/initializing"].addTransition(_main_behaviour_initializing_0)
+        
+        # transition /main_behaviour/bouncing
+        _main_behaviour_bouncing_0 = Transition(self, self.states["/main_behaviour/bouncing"], [self.states["/main_behaviour/bouncing"]])
+        _main_behaviour_bouncing_0.setAction(self._main_behaviour_bouncing_0_exec)
+        _main_behaviour_bouncing_0.setTrigger(Event("_0after"))
+        self.states["/main_behaviour/bouncing"].addTransition(_main_behaviour_bouncing_0)
+        _main_behaviour_bouncing_1 = Transition(self, self.states["/main_behaviour/bouncing"], [self.states["/main_behaviour/selected"]])
+        _main_behaviour_bouncing_1.setAction(self._main_behaviour_bouncing_1_exec)
+        _main_behaviour_bouncing_1.setTrigger(Event("mouse_press", "ball_ui"))
+        _main_behaviour_bouncing_1.setGuard(self._main_behaviour_bouncing_1_guard)
+        self.states["/main_behaviour/bouncing"].addTransition(_main_behaviour_bouncing_1)
+        
+        # transition /main_behaviour/dragging
+        _main_behaviour_dragging_0 = Transition(self, self.states["/main_behaviour/dragging"], [self.states["/main_behaviour/dragging"]])
+        _main_behaviour_dragging_0.setAction(self._main_behaviour_dragging_0_exec)
+        _main_behaviour_dragging_0.setTrigger(Event("mouse_move", "ball_ui"))
+        self.states["/main_behaviour/dragging"].addTransition(_main_behaviour_dragging_0)
+        _main_behaviour_dragging_1 = Transition(self, self.states["/main_behaviour/dragging"], [self.states["/main_behaviour/bouncing"]])
+        _main_behaviour_dragging_1.setAction(self._main_behaviour_dragging_1_exec)
+        _main_behaviour_dragging_1.setTrigger(Event("mouse_release", "ball_ui"))
+        self.states["/main_behaviour/dragging"].addTransition(_main_behaviour_dragging_1)
+        
+        # transition /main_behaviour/selected
+        _main_behaviour_selected_0 = Transition(self, self.states["/main_behaviour/selected"], [self.states["/main_behaviour/dragging"]])
+        _main_behaviour_selected_0.setAction(self._main_behaviour_selected_0_exec)
+        _main_behaviour_selected_0.setTrigger(Event("mouse_press", "ball_ui"))
+        _main_behaviour_selected_0.setGuard(self._main_behaviour_selected_0_guard)
+        self.states["/main_behaviour/selected"].addTransition(_main_behaviour_selected_0)
+        _main_behaviour_selected_1 = Transition(self, self.states["/main_behaviour/selected"], [self.states["/deleted"]])
+        _main_behaviour_selected_1.setAction(self._main_behaviour_selected_1_exec)
+        _main_behaviour_selected_1.setTrigger(Event("delete_self", None))
+        self.states["/main_behaviour/selected"].addTransition(_main_behaviour_selected_1)
+    
+    def _main_behaviour_bouncing_enter(self):
+        self.addTimer(0, (1000 - self.getSimulatedTime() % 1000) / 1000.0)
+    
+    def _main_behaviour_bouncing_exit(self):
+        self.removeTimer(0)
+    
+    def _main_behaviour_initializing_0_exec(self, parameters):
+        association_name = parameters[0]
+        self.association_name = association_name
+    
+    def _main_behaviour_bouncing_0_exec(self, parameters):
+        pos = self.element.get_position();    
+        if pos.x-self.r <= 0 or pos.x+self.r >= self.canvas.width :
+            self.vel['x'] = -self.vel['x'];
+        if pos.y-self.r <= 0 or pos.y+self.r >= self.canvas.height :
+            self.vel['y'] = -self.vel['y'];
+        self.element.move(self.vel['x'], self.vel['y']);
+    
+    def _main_behaviour_bouncing_1_exec(self, parameters):
+        x = parameters[0]
+        y = parameters[1]
+        button = parameters[2]
+        self.element.set_color("#ff0");
+    
+    def _main_behaviour_bouncing_1_guard(self, parameters):
+        x = parameters[0]
+        y = parameters[1]
+        button = parameters[2]
+        return button == ui.MOUSE_BUTTONS.LEFT
+    
+    def _main_behaviour_dragging_0_exec(self, parameters):
+        x = parameters[0]
+        y = parameters[1]
+        button = parameters[2]
+        dx = x - self.mouse_pos['x'];
+        dy = y - self.mouse_pos['y'];
+        
+        self.element.move(dx, dy);
+        
+        # keep ball within boundaries
+        pos = self.element.get_position();
+        if pos.x-self.r <= 0 :
+            pos.x = self.r + 1;
+        elif pos.x+self.r >= self.canvas.width :
+            pos.x = self.canvas.width-self.r-1;
+        if pos.y-self.r <= 0 :
+            pos.y = self.r + 1;
+        elif pos.y+self.r >= self.canvas.height :
+            pos.y = self.canvas.height-self.r-1;
+        self.element.set_position(pos.x, pos.y);
+        self.mouse_pos = {'x':x, 'y':y};
+        self.vel = {
+            'x': (1-self.smooth)*dx + self.smooth*self.vel['x'],
+            'y': (1-self.smooth)*dy + self.smooth*self.vel['y']
+        };
+    
+    def _main_behaviour_dragging_1_exec(self, parameters):
+        x = parameters[0]
+        y = parameters[1]
+        self.element.set_color("#f00");
+    
+    def _main_behaviour_selected_0_exec(self, parameters):
+        x = parameters[0]
+        y = parameters[1]
+        button = parameters[2]
+        self.mouse_pos = {'x':x, 'y':y};
+    
+    def _main_behaviour_selected_0_guard(self, parameters):
+        x = parameters[0]
+        y = parameters[1]
+        button = parameters[2]
+        return button == ui.MOUSE_BUTTONS.LEFT
+    
+    def _main_behaviour_selected_1_exec(self, parameters):
+        self.big_step.outputEventOM(Event("narrow_cast", None, [self, 'parent', Event("delete_ball", None, [self.association_name])]))
+    
+    def initializeStatechart(self):
+        # enter default state
+        states = self.states["/main_behaviour"].getEffectiveTargetStates()
+        self.updateConfiguration(states)
+        for state in states:
+            if state.enter:
+                state.enter()
+
+class ObjectManager(ObjectManagerBase):
+    def __init__(self, controller):
+        ObjectManagerBase.__init__(self, controller)
+    
+    def instantiate(self, class_name, construct_params):
+        if class_name == "MainApp":
+            instance = MainApp(self.controller)
+            instance.associations = {}
+            instance.associations["fields"] = Association("Field", 0, -1)
+        elif class_name == "Field":
+            instance = Field(self.controller)
+            instance.associations = {}
+            instance.associations["balls"] = Association("Ball", 0, -1)
+            instance.associations["buttons"] = Association("Button", 0, -1)
+            instance.associations["parent"] = Association("MainApp", 1, 1)
+        elif class_name == "Button":
+            instance = Button(self.controller, construct_params[0], construct_params[1], construct_params[2])
+            instance.associations = {}
+            instance.associations["parent"] = Association("Field", 1, 1)
+        elif class_name == "Ball":
+            instance = Ball(self.controller, construct_params[0], construct_params[1], construct_params[2])
+            instance.associations = {}
+            instance.associations["parent"] = Association("Field", 1, 1)
+        else:
+            raise Exception("Cannot instantiate class " + class_name)
+        return instance
+
+class Controller(EventLoopControllerBase):
+    def __init__(self, event_loop_callbacks, finished_callback = None, behind_schedule_callback = None):
+        if finished_callback == None: finished_callback = None
+        if behind_schedule_callback == None: behind_schedule_callback = None
+        EventLoopControllerBase.__init__(self, ObjectManager(self), event_loop_callbacks, finished_callback, behind_schedule_callback)
+        self.addInputPort("ui")
+        self.object_manager.createInstance("MainApp", [])

+ 91 - 65
examples/tanks/ai_controller.py

@@ -1,7 +1,7 @@
 """
 Generated by Statechart compiler by Glenn De Jonghe, Joeri Exelmans, Simon Van Mierlo, and Yentl Van Tendeloo (for the inspiration)
 
-Date:   Thu Aug 04 13:29:22 2016
+Date:   Fri Aug 05 16:08:35 2016
 
 Model author: Glenn De Jonghe
 Model name:   AI Tank
@@ -154,116 +154,127 @@ class Main(RuntimeClassBase):
         # transition /creation/state_1
         _creation_state_1_0 = Transition(self, self.states["/creation/state_1"], [self.states["/creation/state_2"]])
         _creation_state_1_0.setAction(self._creation_state_1_0_exec)
+        _creation_state_1_0.setTrigger(None)
         self.states["/creation/state_1"].addTransition(_creation_state_1_0)
         
         # transition /creation/state_2
         _creation_state_2_0 = Transition(self, self.states["/creation/state_2"], [self.states["/creation/state_3"]])
-        _creation_state_2_0.trigger = Event("instance_created", None)
+        _creation_state_2_0.setTrigger(Event("instance_created", None))
         self.states["/creation/state_2"].addTransition(_creation_state_2_0)
         
         # transition /creation/state_3
         _creation_state_3_0 = Transition(self, self.states["/creation/state_3"], [self.states["/creation/state_4"]])
         _creation_state_3_0.setAction(self._creation_state_3_0_exec)
+        _creation_state_3_0.setTrigger(None)
         self.states["/creation/state_3"].addTransition(_creation_state_3_0)
         
         # transition /creation/state_4
         _creation_state_4_0 = Transition(self, self.states["/creation/state_4"], [self.states["/creation/state_5"]])
-        _creation_state_4_0.trigger = Event("instance_created", None)
+        _creation_state_4_0.setTrigger(Event("instance_created", None))
         self.states["/creation/state_4"].addTransition(_creation_state_4_0)
         
         # transition /creation/state_5
         _creation_state_5_0 = Transition(self, self.states["/creation/state_5"], [self.states["/creation/state_6"]])
         _creation_state_5_0.setAction(self._creation_state_5_0_exec)
+        _creation_state_5_0.setTrigger(None)
         self.states["/creation/state_5"].addTransition(_creation_state_5_0)
         
         # transition /creation/state_6
         _creation_state_6_0 = Transition(self, self.states["/creation/state_6"], [self.states["/creation/state_7"]])
-        _creation_state_6_0.trigger = Event("instance_created", None)
+        _creation_state_6_0.setTrigger(Event("instance_created", None))
         self.states["/creation/state_6"].addTransition(_creation_state_6_0)
         
         # transition /creation/state_7
         _creation_state_7_0 = Transition(self, self.states["/creation/state_7"], [self.states["/creation/state_8"]])
         _creation_state_7_0.setAction(self._creation_state_7_0_exec)
+        _creation_state_7_0.setTrigger(None)
         self.states["/creation/state_7"].addTransition(_creation_state_7_0)
         
         # transition /creation/state_8
         _creation_state_8_0 = Transition(self, self.states["/creation/state_8"], [self.states["/creation/state_9"]])
-        _creation_state_8_0.trigger = Event("instance_created", None)
+        _creation_state_8_0.setTrigger(Event("instance_created", None))
         self.states["/creation/state_8"].addTransition(_creation_state_8_0)
         
         # transition /creation/state_9
         _creation_state_9_0 = Transition(self, self.states["/creation/state_9"], [self.states["/creation/state_10"]])
         _creation_state_9_0.setAction(self._creation_state_9_0_exec)
+        _creation_state_9_0.setTrigger(None)
         self.states["/creation/state_9"].addTransition(_creation_state_9_0)
         
         # transition /creation/state_10
         _creation_state_10_0 = Transition(self, self.states["/creation/state_10"], [self.states["/creation/state_11"]])
-        _creation_state_10_0.trigger = Event("instance_created", None)
+        _creation_state_10_0.setTrigger(Event("instance_created", None))
         self.states["/creation/state_10"].addTransition(_creation_state_10_0)
         
         # transition /creation/state_11
         _creation_state_11_0 = Transition(self, self.states["/creation/state_11"], [self.states["/creation/state_12"]])
         _creation_state_11_0.setAction(self._creation_state_11_0_exec)
+        _creation_state_11_0.setTrigger(None)
         self.states["/creation/state_11"].addTransition(_creation_state_11_0)
         
         # transition /creation/state_12
         _creation_state_12_0 = Transition(self, self.states["/creation/state_12"], [self.states["/creation/state_13"]])
-        _creation_state_12_0.trigger = Event("instance_created", None)
+        _creation_state_12_0.setTrigger(Event("instance_created", None))
         self.states["/creation/state_12"].addTransition(_creation_state_12_0)
         
         # transition /creation/state_13
         _creation_state_13_0 = Transition(self, self.states["/creation/state_13"], [self.states["/creation/state_14"]])
         _creation_state_13_0.setAction(self._creation_state_13_0_exec)
+        _creation_state_13_0.setTrigger(None)
         self.states["/creation/state_13"].addTransition(_creation_state_13_0)
         
         # transition /creation/state_14
         _creation_state_14_0 = Transition(self, self.states["/creation/state_14"], [self.states["/creation/state_15"]])
-        _creation_state_14_0.trigger = Event("instance_created", None)
+        _creation_state_14_0.setTrigger(Event("instance_created", None))
         self.states["/creation/state_14"].addTransition(_creation_state_14_0)
         
         # transition /creation/state_15
         _creation_state_15_0 = Transition(self, self.states["/creation/state_15"], [self.states["/creation/state_16"]])
         _creation_state_15_0.setAction(self._creation_state_15_0_exec)
+        _creation_state_15_0.setTrigger(None)
         self.states["/creation/state_15"].addTransition(_creation_state_15_0)
         
         # transition /creation/state_16
         _creation_state_16_0 = Transition(self, self.states["/creation/state_16"], [self.states["/creation/state_17"]])
-        _creation_state_16_0.trigger = Event("instance_created", None)
+        _creation_state_16_0.setTrigger(Event("instance_created", None))
         self.states["/creation/state_16"].addTransition(_creation_state_16_0)
         
         # transition /creation/state_17
         _creation_state_17_0 = Transition(self, self.states["/creation/state_17"], [self.states["/creation/state_18"]])
         _creation_state_17_0.setAction(self._creation_state_17_0_exec)
+        _creation_state_17_0.setTrigger(None)
         self.states["/creation/state_17"].addTransition(_creation_state_17_0)
         
         # transition /creation/state_18
         _creation_state_18_0 = Transition(self, self.states["/creation/state_18"], [self.states["/creation/state_19"]])
-        _creation_state_18_0.trigger = Event("instance_created", None)
+        _creation_state_18_0.setTrigger(Event("instance_created", None))
         self.states["/creation/state_18"].addTransition(_creation_state_18_0)
         
         # transition /creation/state_19
         _creation_state_19_0 = Transition(self, self.states["/creation/state_19"], [self.states["/creation/state_20"]])
         _creation_state_19_0.setAction(self._creation_state_19_0_exec)
+        _creation_state_19_0.setTrigger(None)
         self.states["/creation/state_19"].addTransition(_creation_state_19_0)
         
         # transition /creation/state_20
         _creation_state_20_0 = Transition(self, self.states["/creation/state_20"], [self.states["/creation/state_21"]])
-        _creation_state_20_0.trigger = Event("instance_created", None)
+        _creation_state_20_0.setTrigger(Event("instance_created", None))
         self.states["/creation/state_20"].addTransition(_creation_state_20_0)
         
         # transition /creation/state_21
         _creation_state_21_0 = Transition(self, self.states["/creation/state_21"], [self.states["/creation/end"]])
         _creation_state_21_0.setAction(self._creation_state_21_0_exec)
+        _creation_state_21_0.setTrigger(None)
         self.states["/creation/state_21"].addTransition(_creation_state_21_0)
         
         # transition /creation
         _creation_0 = Transition(self, self.states["/creation"], [self.states["/error"]])
         _creation_0.setAction(self._creation_0_exec)
-        _creation_0.trigger = Event("instance_creation_error", None)
+        _creation_0.setTrigger(Event("instance_creation_error", None))
         self.states["/creation"].addTransition(_creation_0)
         _creation_1 = Transition(self, self.states["/creation"], [self.states["/error"]])
         _creation_1.setAction(self._creation_1_exec)
-        _creation_1.trigger = Event("instance_association_error", None)
+        _creation_1.setTrigger(Event("instance_association_error", None))
         self.states["/creation"].addTransition(_creation_1)
     
     def _creation_0_exec(self, parameters):
@@ -403,17 +414,19 @@ class Radar(RuntimeClassBase):
         # transition /no_enemy
         _no_enemy_0 = Transition(self, self.states["/no_enemy"], [self.states["/enemy_in_sight"]])
         _no_enemy_0.setAction(self._no_enemy_0_exec)
+        _no_enemy_0.setTrigger(None)
         _no_enemy_0.setGuard(self._no_enemy_0_guard)
         self.states["/no_enemy"].addTransition(_no_enemy_0)
         
         # transition /enemy_in_sight
         _enemy_in_sight_0 = Transition(self, self.states["/enemy_in_sight"], [self.states["/no_enemy"]])
         _enemy_in_sight_0.setAction(self._enemy_in_sight_0_exec)
+        _enemy_in_sight_0.setTrigger(None)
         _enemy_in_sight_0.setGuard(self._enemy_in_sight_0_guard)
         self.states["/enemy_in_sight"].addTransition(_enemy_in_sight_0)
         _enemy_in_sight_1 = Transition(self, self.states["/enemy_in_sight"], [self.states["/enemy_in_sight"]])
         _enemy_in_sight_1.setAction(self._enemy_in_sight_1_exec)
-        _enemy_in_sight_1.trigger = Event("update", "engine")
+        _enemy_in_sight_1.setTrigger(Event("update", "engine"))
         _enemy_in_sight_1.setGuard(self._enemy_in_sight_1_guard)
         self.states["/enemy_in_sight"].addTransition(_enemy_in_sight_1)
     
@@ -500,28 +513,28 @@ class EnemyTracker(RuntimeClassBase):
         # transition /no_enemy
         _no_enemy_0 = Transition(self, self.states["/no_enemy"], [self.states["/enemy_pos_known"]])
         _no_enemy_0.setAction(self._no_enemy_0_exec)
-        _no_enemy_0.trigger = Event("enemy_sighted", None)
+        _no_enemy_0.setTrigger(Event("enemy_sighted", None))
         self.states["/no_enemy"].addTransition(_no_enemy_0)
         
         # transition /enemy_pos_known
         _enemy_pos_known_0 = Transition(self, self.states["/enemy_pos_known"], [self.states["/enemy_pos_known"]])
         _enemy_pos_known_0.setAction(self._enemy_pos_known_0_exec)
-        _enemy_pos_known_0.trigger = Event("enemy_pos", None)
+        _enemy_pos_known_0.setTrigger(Event("enemy_pos", None))
         _enemy_pos_known_0.setGuard(self._enemy_pos_known_0_guard)
         self.states["/enemy_pos_known"].addTransition(_enemy_pos_known_0)
         _enemy_pos_known_1 = Transition(self, self.states["/enemy_pos_known"], [self.states["/enemy_pos_unsure"]])
         _enemy_pos_known_1.setAction(self._enemy_pos_known_1_exec)
-        _enemy_pos_known_1.trigger = Event("enemy_out_of_sight", None)
+        _enemy_pos_known_1.setTrigger(Event("enemy_out_of_sight", None))
         self.states["/enemy_pos_known"].addTransition(_enemy_pos_known_1)
         
         # transition /enemy_pos_unsure
         _enemy_pos_unsure_0 = Transition(self, self.states["/enemy_pos_unsure"], [self.states["/no_enemy"]])
         _enemy_pos_unsure_0.setAction(self._enemy_pos_unsure_0_exec)
-        _enemy_pos_unsure_0.trigger = Event("destination_reached", None)
+        _enemy_pos_unsure_0.setTrigger(Event("destination_reached", None))
         self.states["/enemy_pos_unsure"].addTransition(_enemy_pos_unsure_0)
         _enemy_pos_unsure_1 = Transition(self, self.states["/enemy_pos_unsure"], [self.states["/enemy_pos_known"]])
         _enemy_pos_unsure_1.setAction(self._enemy_pos_unsure_1_exec)
-        _enemy_pos_unsure_1.trigger = Event("enemy_sighted", None)
+        _enemy_pos_unsure_1.setTrigger(Event("enemy_sighted", None))
         self.states["/enemy_pos_unsure"].addTransition(_enemy_pos_unsure_1)
     
     def _no_enemy_0_exec(self, parameters):
@@ -603,13 +616,13 @@ class PilotStrategy(RuntimeClassBase):
         # transition /exploring
         _exploring_0 = Transition(self, self.states["/exploring"], [self.states["/attacking"]])
         _exploring_0.setAction(self._exploring_0_exec)
-        _exploring_0.trigger = Event("enemy_sighted", None)
+        _exploring_0.setTrigger(Event("enemy_sighted", None))
         self.states["/exploring"].addTransition(_exploring_0)
         
         # transition /attacking
         _attacking_0 = Transition(self, self.states["/attacking"], [self.states["/exploring"]])
         _attacking_0.setAction(self._attacking_0_exec)
-        _attacking_0.trigger = Event("enemy_lost", None)
+        _attacking_0.setTrigger(Event("enemy_lost", None))
         self.states["/attacking"].addTransition(_attacking_0)
     
     def _exploring_enter(self):
@@ -694,23 +707,24 @@ class ExplorePlanner(RuntimeClassBase):
         
         # transition /idle
         _idle_0 = Transition(self, self.states["/idle"], [self.states["/exploring"]])
-        _idle_0.trigger = Event("explore", None)
+        _idle_0.setTrigger(Event("explore", None))
         self.states["/idle"].addTransition(_idle_0)
         
         # transition /exploring/no_destination
         _exploring_no_destination_0 = Transition(self, self.states["/exploring/no_destination"], [self.states["/exploring/destination_set"]])
         _exploring_no_destination_0.setAction(self._exploring_no_destination_0_exec)
+        _exploring_no_destination_0.setTrigger(None)
         self.states["/exploring/no_destination"].addTransition(_exploring_no_destination_0)
         
         # transition /exploring/destination_set
         _exploring_destination_set_0 = Transition(self, self.states["/exploring/destination_set"], [self.states["/exploring/no_destination"]])
-        _exploring_destination_set_0.trigger = Event("destination_reached", None)
+        _exploring_destination_set_0.setTrigger(Event("destination_reached", None))
         self.states["/exploring/destination_set"].addTransition(_exploring_destination_set_0)
         
         # transition /exploring
         _exploring_0 = Transition(self, self.states["/exploring"], [self.states["/idle"]])
         _exploring_0.setAction(self._exploring_0_exec)
-        _exploring_0.trigger = Event("stop_exploring", None)
+        _exploring_0.setTrigger(Event("stop_exploring", None))
         self.states["/exploring"].addTransition(_exploring_0)
     
     def _exploring_0_exec(self, parameters):
@@ -795,34 +809,34 @@ class AttackPlanner(RuntimeClassBase):
         # transition /idle
         _idle_0 = Transition(self, self.states["/idle"], [self.states["/action"]])
         _idle_0.setAction(self._idle_0_exec)
-        _idle_0.trigger = Event("attack", None)
+        _idle_0.setTrigger(Event("attack", None))
         self.states["/idle"].addTransition(_idle_0)
         
         # transition /action/movement/following
         _action_movement_following_0 = Transition(self, self.states["/action/movement/following"], [self.states["/action/movement/following"]])
         _action_movement_following_0.setAction(self._action_movement_following_0_exec)
-        _action_movement_following_0.trigger = Event("enemy_pos_changed", None)
+        _action_movement_following_0.setTrigger(Event("enemy_pos_changed", None))
         self.states["/action/movement/following"].addTransition(_action_movement_following_0)
         _action_movement_following_1 = Transition(self, self.states["/action/movement/following"], [self.states["/action/movement/following"]])
         _action_movement_following_1.setAction(self._action_movement_following_1_exec)
-        _action_movement_following_1.trigger = Event("enemy_out_of_sight", None)
+        _action_movement_following_1.setTrigger(Event("enemy_out_of_sight", None))
         self.states["/action/movement/following"].addTransition(_action_movement_following_1)
         
         # transition /action/shooting/loaded
         _action_shooting_loaded_0 = Transition(self, self.states["/action/shooting/loaded"], [self.states["/action/shooting/reloading"]])
         _action_shooting_loaded_0.setAction(self._action_shooting_loaded_0_exec)
-        _action_shooting_loaded_0.trigger = Event("ready_to_shoot", None)
+        _action_shooting_loaded_0.setTrigger(Event("ready_to_shoot", None))
         self.states["/action/shooting/loaded"].addTransition(_action_shooting_loaded_0)
         
         # transition /action/shooting/reloading
         _action_shooting_reloading_0 = Transition(self, self.states["/action/shooting/reloading"], [self.states["/action/shooting/loaded"]])
-        _action_shooting_reloading_0.trigger = Event("_0after")
+        _action_shooting_reloading_0.setTrigger(Event("_0after"))
         self.states["/action/shooting/reloading"].addTransition(_action_shooting_reloading_0)
         
         # transition /action
         _action_0 = Transition(self, self.states["/action"], [self.states["/idle"]])
         _action_0.setAction(self._action_0_exec)
-        _action_0.trigger = Event("stop_attacking", None)
+        _action_0.setTrigger(Event("stop_attacking", None))
         self.states["/action"].addTransition(_action_0)
     
     def _action_shooting_reloading_enter(self):
@@ -926,21 +940,23 @@ class PathFinder(RuntimeClassBase):
         
         # transition /idle
         _idle_0 = Transition(self, self.states["/idle"], [self.states["/check_points"]])
-        _idle_0.trigger = Event("waypoint_reached", None)
+        _idle_0.setTrigger(Event("waypoint_reached", None))
         self.states["/idle"].addTransition(_idle_0)
         _idle_1 = Transition(self, self.states["/idle"], [self.states["/check_points"]])
         _idle_1.setAction(self._idle_1_exec)
-        _idle_1.trigger = Event("new_destination", None)
+        _idle_1.setTrigger(Event("new_destination", None))
         _idle_1.setGuard(self._idle_1_guard)
         self.states["/idle"].addTransition(_idle_1)
         
         # transition /check_points
         _check_points_0 = Transition(self, self.states["/check_points"], [self.states["/idle"]])
         _check_points_0.setAction(self._check_points_0_exec)
+        _check_points_0.setTrigger(None)
         _check_points_0.setGuard(self._check_points_0_guard)
         self.states["/check_points"].addTransition(_check_points_0)
         _check_points_1 = Transition(self, self.states["/check_points"], [self.states["/idle"]])
         _check_points_1.setAction(self._check_points_1_exec)
+        _check_points_1.setTrigger(None)
         _check_points_1.setGuard(self._check_points_1_guard)
         self.states["/check_points"].addTransition(_check_points_1)
     
@@ -1097,41 +1113,47 @@ class Steering(RuntimeClassBase):
         # transition /idle
         _idle_0 = Transition(self, self.states["/idle"], [self.states["/steering"]])
         _idle_0.setAction(self._idle_0_exec)
-        _idle_0.trigger = Event("new_waypoint", None)
+        _idle_0.setTrigger(Event("new_waypoint", None))
         self.states["/idle"].addTransition(_idle_0)
         
         # transition /steering/forward_backward
         _steering_forward_backward_0 = Transition(self, self.states["/steering/forward_backward"], [self.states["/steering/left_right"]])
         _steering_forward_backward_0.setAction(self._steering_forward_backward_0_exec)
+        _steering_forward_backward_0.setTrigger(None)
         _steering_forward_backward_0.setGuard(self._steering_forward_backward_0_guard)
         self.states["/steering/forward_backward"].addTransition(_steering_forward_backward_0)
         _steering_forward_backward_1 = Transition(self, self.states["/steering/forward_backward"], [self.states["/steering/left_right"]])
         _steering_forward_backward_1.setAction(self._steering_forward_backward_1_exec)
+        _steering_forward_backward_1.setTrigger(None)
         _steering_forward_backward_1.setGuard(self._steering_forward_backward_1_guard)
         self.states["/steering/forward_backward"].addTransition(_steering_forward_backward_1)
         
         # transition /steering/left_right
         _steering_left_right_0 = Transition(self, self.states["/steering/left_right"], [self.states["/steering/wait"]])
         _steering_left_right_0.setAction(self._steering_left_right_0_exec)
+        _steering_left_right_0.setTrigger(None)
         _steering_left_right_0.setGuard(self._steering_left_right_0_guard)
         self.states["/steering/left_right"].addTransition(_steering_left_right_0)
         _steering_left_right_1 = Transition(self, self.states["/steering/left_right"], [self.states["/steering/wait"]])
         _steering_left_right_1.setAction(self._steering_left_right_1_exec)
+        _steering_left_right_1.setTrigger(None)
         _steering_left_right_1.setGuard(self._steering_left_right_1_guard)
         self.states["/steering/left_right"].addTransition(_steering_left_right_1)
         _steering_left_right_2 = Transition(self, self.states["/steering/left_right"], [self.states["/steering/wait"]])
         _steering_left_right_2.setAction(self._steering_left_right_2_exec)
+        _steering_left_right_2.setTrigger(None)
         _steering_left_right_2.setGuard(self._steering_left_right_2_guard)
         self.states["/steering/left_right"].addTransition(_steering_left_right_2)
         
         # transition /steering/wait
         _steering_wait_0 = Transition(self, self.states["/steering/wait"], [self.states["/steering/forward_backward"]])
-        _steering_wait_0.trigger = Event("_0after")
+        _steering_wait_0.setTrigger(Event("_0after"))
         self.states["/steering/wait"].addTransition(_steering_wait_0)
         
         # transition /steering
         _steering_0 = Transition(self, self.states["/steering"], [self.states["/idle"]])
         _steering_0.setAction(self._steering_0_exec)
+        _steering_0.setTrigger(None)
         _steering_0.setGuard(self._steering_0_guard)
         self.states["/steering"].addTransition(_steering_0)
     
@@ -1278,36 +1300,39 @@ class TurretSteering(RuntimeClassBase):
         # transition /idle
         _idle_0 = Transition(self, self.states["/idle"], [self.states["/aiming"]])
         _idle_0.setAction(self._idle_0_exec)
-        _idle_0.trigger = Event("aim_at", None)
+        _idle_0.setTrigger(Event("aim_at", None))
         self.states["/idle"].addTransition(_idle_0)
         
         # transition /aiming/adjust
         _aiming_adjust_0 = Transition(self, self.states["/aiming/adjust"], [self.states["/aiming/wait"]])
         _aiming_adjust_0.setAction(self._aiming_adjust_0_exec)
+        _aiming_adjust_0.setTrigger(None)
         _aiming_adjust_0.setGuard(self._aiming_adjust_0_guard)
         self.states["/aiming/adjust"].addTransition(_aiming_adjust_0)
         _aiming_adjust_1 = Transition(self, self.states["/aiming/adjust"], [self.states["/aiming/wait"]])
         _aiming_adjust_1.setAction(self._aiming_adjust_1_exec)
+        _aiming_adjust_1.setTrigger(None)
         _aiming_adjust_1.setGuard(self._aiming_adjust_1_guard)
         self.states["/aiming/adjust"].addTransition(_aiming_adjust_1)
         _aiming_adjust_2 = Transition(self, self.states["/aiming/adjust"], [self.states["/aiming/wait"]])
         _aiming_adjust_2.setAction(self._aiming_adjust_2_exec)
+        _aiming_adjust_2.setTrigger(None)
         _aiming_adjust_2.setGuard(self._aiming_adjust_2_guard)
         self.states["/aiming/adjust"].addTransition(_aiming_adjust_2)
         
         # transition /aiming/wait
         _aiming_wait_0 = Transition(self, self.states["/aiming/wait"], [self.states["/aiming/adjust"]])
-        _aiming_wait_0.trigger = Event("_0after")
+        _aiming_wait_0.setTrigger(Event("_0after"))
         self.states["/aiming/wait"].addTransition(_aiming_wait_0)
         
         # transition /aiming
         _aiming_0 = Transition(self, self.states["/aiming"], [self.states["/idle"]])
         _aiming_0.setAction(self._aiming_0_exec)
-        _aiming_0.trigger = Event("stop_aiming", None)
+        _aiming_0.setTrigger(Event("stop_aiming", None))
         self.states["/aiming"].addTransition(_aiming_0)
         _aiming_1 = Transition(self, self.states["/aiming"], [self.states["/aiming"]])
         _aiming_1.setAction(self._aiming_1_exec)
-        _aiming_1.trigger = Event("aim_at", None)
+        _aiming_1.setTrigger(Event("aim_at", None))
         self.states["/aiming"].addTransition(_aiming_1)
     
     def _aiming_wait_enter(self):
@@ -1430,66 +1455,66 @@ class MotorControl(RuntimeClassBase):
         
         # transition /control/left_right/stop
         _control_left_right_stop_0 = Transition(self, self.states["/control/left_right/stop"], [self.states["/control/left_right/going_forward"]])
-        _control_left_right_stop_0.trigger = Event("forward", None)
+        _control_left_right_stop_0.setTrigger(Event("forward", None))
         self.states["/control/left_right/stop"].addTransition(_control_left_right_stop_0)
         _control_left_right_stop_1 = Transition(self, self.states["/control/left_right/stop"], [self.states["/control/left_right/going_backward"]])
-        _control_left_right_stop_1.trigger = Event("backward", None)
+        _control_left_right_stop_1.setTrigger(Event("backward", None))
         self.states["/control/left_right/stop"].addTransition(_control_left_right_stop_1)
         
         # transition /control/left_right/going_forward
         _control_left_right_going_forward_0 = Transition(self, self.states["/control/left_right/going_forward"], [self.states["/control/left_right/stop"]])
-        _control_left_right_going_forward_0.trigger = Event("stop", None)
+        _control_left_right_going_forward_0.setTrigger(Event("stop", None))
         self.states["/control/left_right/going_forward"].addTransition(_control_left_right_going_forward_0)
         _control_left_right_going_forward_1 = Transition(self, self.states["/control/left_right/going_forward"], [self.states["/control/left_right/going_backward"]])
-        _control_left_right_going_forward_1.trigger = Event("backward", None)
+        _control_left_right_going_forward_1.setTrigger(Event("backward", None))
         self.states["/control/left_right/going_forward"].addTransition(_control_left_right_going_forward_1)
         _control_left_right_going_forward_2 = Transition(self, self.states["/control/left_right/going_forward"], [self.states["/control/left_right/going_forward"]])
         _control_left_right_going_forward_2.setAction(self._control_left_right_going_forward_2_exec)
-        _control_left_right_going_forward_2.trigger = Event("update", "engine")
+        _control_left_right_going_forward_2.setTrigger(Event("update", "engine"))
         self.states["/control/left_right/going_forward"].addTransition(_control_left_right_going_forward_2)
         
         # transition /control/left_right/going_backward
         _control_left_right_going_backward_0 = Transition(self, self.states["/control/left_right/going_backward"], [self.states["/control/left_right/stop"]])
-        _control_left_right_going_backward_0.trigger = Event("stop", None)
+        _control_left_right_going_backward_0.setTrigger(Event("stop", None))
         self.states["/control/left_right/going_backward"].addTransition(_control_left_right_going_backward_0)
         _control_left_right_going_backward_1 = Transition(self, self.states["/control/left_right/going_backward"], [self.states["/control/left_right/going_forward"]])
-        _control_left_right_going_backward_1.trigger = Event("forward", None)
+        _control_left_right_going_backward_1.setTrigger(Event("forward", None))
         self.states["/control/left_right/going_backward"].addTransition(_control_left_right_going_backward_1)
         _control_left_right_going_backward_2 = Transition(self, self.states["/control/left_right/going_backward"], [self.states["/control/left_right/going_backward"]])
         _control_left_right_going_backward_2.setAction(self._control_left_right_going_backward_2_exec)
-        _control_left_right_going_backward_2.trigger = Event("update", "engine")
+        _control_left_right_going_backward_2.setTrigger(Event("update", "engine"))
         self.states["/control/left_right/going_backward"].addTransition(_control_left_right_going_backward_2)
         
         # transition /control/forward_backward/straight
         _control_forward_backward_straight_0 = Transition(self, self.states["/control/forward_backward/straight"], [self.states["/control/forward_backward/turning_right"]])
-        _control_forward_backward_straight_0.trigger = Event("turn_right", None)
+        _control_forward_backward_straight_0.setTrigger(Event("turn_right", None))
         self.states["/control/forward_backward/straight"].addTransition(_control_forward_backward_straight_0)
         _control_forward_backward_straight_1 = Transition(self, self.states["/control/forward_backward/straight"], [self.states["/control/forward_backward/turning_left"]])
-        _control_forward_backward_straight_1.trigger = Event("turn_left", None)
+        _control_forward_backward_straight_1.setTrigger(Event("turn_left", None))
         self.states["/control/forward_backward/straight"].addTransition(_control_forward_backward_straight_1)
         
         # transition /control/forward_backward/turning_left
         _control_forward_backward_turning_left_0 = Transition(self, self.states["/control/forward_backward/turning_left"], [self.states["/control/forward_backward/straight"]])
-        _control_forward_backward_turning_left_0.trigger = Event("stop_turning", None)
+        _control_forward_backward_turning_left_0.setTrigger(Event("stop_turning", None))
         self.states["/control/forward_backward/turning_left"].addTransition(_control_forward_backward_turning_left_0)
         _control_forward_backward_turning_left_1 = Transition(self, self.states["/control/forward_backward/turning_left"], [self.states["/control/forward_backward/turning_right"]])
-        _control_forward_backward_turning_left_1.trigger = Event("turn_right", None)
+        _control_forward_backward_turning_left_1.setTrigger(Event("turn_right", None))
         self.states["/control/forward_backward/turning_left"].addTransition(_control_forward_backward_turning_left_1)
         _control_forward_backward_turning_left_2 = Transition(self, self.states["/control/forward_backward/turning_left"], [self.states["/control/forward_backward/turning_left"]])
         _control_forward_backward_turning_left_2.setAction(self._control_forward_backward_turning_left_2_exec)
-        _control_forward_backward_turning_left_2.trigger = Event("update", "engine")
+        _control_forward_backward_turning_left_2.setTrigger(Event("update", "engine"))
         self.states["/control/forward_backward/turning_left"].addTransition(_control_forward_backward_turning_left_2)
         
         # transition /control/forward_backward/turning_right
         _control_forward_backward_turning_right_0 = Transition(self, self.states["/control/forward_backward/turning_right"], [self.states["/control/forward_backward/straight"]])
-        _control_forward_backward_turning_right_0.trigger = Event("stop_turning", None)
+        _control_forward_backward_turning_right_0.setTrigger(Event("stop_turning", None))
         self.states["/control/forward_backward/turning_right"].addTransition(_control_forward_backward_turning_right_0)
         _control_forward_backward_turning_right_1 = Transition(self, self.states["/control/forward_backward/turning_right"], [self.states["/control/forward_backward/turning_left"]])
-        _control_forward_backward_turning_right_1.trigger = Event("turn_left", None)
+        _control_forward_backward_turning_right_1.setTrigger(Event("turn_left", None))
         self.states["/control/forward_backward/turning_right"].addTransition(_control_forward_backward_turning_right_1)
         _control_forward_backward_turning_right_2 = Transition(self, self.states["/control/forward_backward/turning_right"], [self.states["/control/forward_backward/turning_right"]])
         _control_forward_backward_turning_right_2.setAction(self._control_forward_backward_turning_right_2_exec)
-        _control_forward_backward_turning_right_2.trigger = Event("update", "engine")
+        _control_forward_backward_turning_right_2.setTrigger(Event("update", "engine"))
         self.states["/control/forward_backward/turning_right"].addTransition(_control_forward_backward_turning_right_2)
     
     def _control_left_right_going_forward_2_exec(self, parameters):
@@ -1580,40 +1605,40 @@ class TurretControl(RuntimeClassBase):
         
         # transition /turret/rotation/none
         _turret_rotation_none_0 = Transition(self, self.states["/turret/rotation/none"], [self.states["/turret/rotation/turning_right"]])
-        _turret_rotation_none_0.trigger = Event("turn_right", None)
+        _turret_rotation_none_0.setTrigger(Event("turn_right", None))
         self.states["/turret/rotation/none"].addTransition(_turret_rotation_none_0)
         _turret_rotation_none_1 = Transition(self, self.states["/turret/rotation/none"], [self.states["/turret/rotation/turning_left"]])
-        _turret_rotation_none_1.trigger = Event("turn_left", None)
+        _turret_rotation_none_1.setTrigger(Event("turn_left", None))
         self.states["/turret/rotation/none"].addTransition(_turret_rotation_none_1)
         
         # transition /turret/rotation/turning_left
         _turret_rotation_turning_left_0 = Transition(self, self.states["/turret/rotation/turning_left"], [self.states["/turret/rotation/none"]])
-        _turret_rotation_turning_left_0.trigger = Event("stop_turning", None)
+        _turret_rotation_turning_left_0.setTrigger(Event("stop_turning", None))
         self.states["/turret/rotation/turning_left"].addTransition(_turret_rotation_turning_left_0)
         _turret_rotation_turning_left_1 = Transition(self, self.states["/turret/rotation/turning_left"], [self.states["/turret/rotation/turning_right"]])
-        _turret_rotation_turning_left_1.trigger = Event("turn_right", None)
+        _turret_rotation_turning_left_1.setTrigger(Event("turn_right", None))
         self.states["/turret/rotation/turning_left"].addTransition(_turret_rotation_turning_left_1)
         _turret_rotation_turning_left_2 = Transition(self, self.states["/turret/rotation/turning_left"], [self.states["/turret/rotation/turning_left"]])
         _turret_rotation_turning_left_2.setAction(self._turret_rotation_turning_left_2_exec)
-        _turret_rotation_turning_left_2.trigger = Event("update", "engine")
+        _turret_rotation_turning_left_2.setTrigger(Event("update", "engine"))
         self.states["/turret/rotation/turning_left"].addTransition(_turret_rotation_turning_left_2)
         
         # transition /turret/rotation/turning_right
         _turret_rotation_turning_right_0 = Transition(self, self.states["/turret/rotation/turning_right"], [self.states["/turret/rotation/none"]])
-        _turret_rotation_turning_right_0.trigger = Event("stop_turning", None)
+        _turret_rotation_turning_right_0.setTrigger(Event("stop_turning", None))
         self.states["/turret/rotation/turning_right"].addTransition(_turret_rotation_turning_right_0)
         _turret_rotation_turning_right_1 = Transition(self, self.states["/turret/rotation/turning_right"], [self.states["/turret/rotation/turning_left"]])
-        _turret_rotation_turning_right_1.trigger = Event("turn_left", None)
+        _turret_rotation_turning_right_1.setTrigger(Event("turn_left", None))
         self.states["/turret/rotation/turning_right"].addTransition(_turret_rotation_turning_right_1)
         _turret_rotation_turning_right_2 = Transition(self, self.states["/turret/rotation/turning_right"], [self.states["/turret/rotation/turning_right"]])
         _turret_rotation_turning_right_2.setAction(self._turret_rotation_turning_right_2_exec)
-        _turret_rotation_turning_right_2.trigger = Event("update", "engine")
+        _turret_rotation_turning_right_2.setTrigger(Event("update", "engine"))
         self.states["/turret/rotation/turning_right"].addTransition(_turret_rotation_turning_right_2)
         
         # transition /turret/shooting/polling
         _turret_shooting_polling_0 = Transition(self, self.states["/turret/shooting/polling"], [self.states["/turret/shooting/polling"]])
         _turret_shooting_polling_0.setAction(self._turret_shooting_polling_0_exec)
-        _turret_shooting_polling_0.trigger = Event("shoot", None)
+        _turret_shooting_polling_0.setTrigger(Event("shoot", None))
         self.states["/turret/shooting/polling"].addTransition(_turret_shooting_polling_0)
     
     def _turret_rotation_turning_left_2_exec(self, parameters):
@@ -1701,8 +1726,9 @@ class ObjectManager(ObjectManagerBase):
         return instance
 
 class Controller(EventLoopControllerBase):
-    def __init__(self, tank, event_loop_callbacks, finished_callback = None):
+    def __init__(self, tank, event_loop_callbacks, finished_callback = None, behind_schedule_callback = None):
         if finished_callback == None: finished_callback = None
-        EventLoopControllerBase.__init__(self, ObjectManager(self), event_loop_callbacks, finished_callback)
+        if behind_schedule_callback == None: behind_schedule_callback = None
+        EventLoopControllerBase.__init__(self, ObjectManager(self), event_loop_callbacks, finished_callback, behind_schedule_callback)
         self.addInputPort("engine")
         self.object_manager.createInstance("Main", [tank])

+ 43 - 40
examples/tanks/player_controller.py

@@ -1,7 +1,7 @@
 """
 Generated by Statechart compiler by Glenn De Jonghe, Joeri Exelmans, Simon Van Mierlo, and Yentl Van Tendeloo (for the inspiration)
 
-Date:   Thu Aug 04 13:29:23 2016
+Date:   Fri Aug 05 16:08:35 2016
 
 Model author: Glenn De Jonghe
 Model name:   Player Tank
@@ -72,22 +72,24 @@ class Main(RuntimeClassBase):
         # transition /state_1
         _state_1_0 = Transition(self, self.states["/state_1"], [self.states["/state_2"]])
         _state_1_0.setAction(self._state_1_0_exec)
+        _state_1_0.setTrigger(None)
         self.states["/state_1"].addTransition(_state_1_0)
         
         # transition /state_2
         _state_2_0 = Transition(self, self.states["/state_2"], [self.states["/state_3"]])
-        _state_2_0.trigger = Event("instance_created", None)
+        _state_2_0.setTrigger(Event("instance_created", None))
         self.states["/state_2"].addTransition(_state_2_0)
         
         # transition /state_3
         _state_3_0 = Transition(self, self.states["/state_3"], [self.states["/state_4"]])
         _state_3_0.setAction(self._state_3_0_exec)
+        _state_3_0.setTrigger(None)
         self.states["/state_3"].addTransition(_state_3_0)
         
         # transition /state_4
         _state_4_0 = Transition(self, self.states["/state_4"], [self.states["/end"]])
         _state_4_0.setAction(self._state_4_0_exec)
-        _state_4_0.trigger = Event("instance_created", None)
+        _state_4_0.setTrigger(Event("instance_created", None))
         self.states["/state_4"].addTransition(_state_4_0)
     
     def _state_1_0_exec(self, parameters):
@@ -201,69 +203,69 @@ class Cannon(RuntimeClassBase):
         
         # transition /container/rotating/none
         _container_rotating_none_0 = Transition(self, self.states["/container/rotating/none"], [self.states["/container/rotating/left"]])
-        _container_rotating_none_0.trigger = Event("cannon-left-pressed", "input")
+        _container_rotating_none_0.setTrigger(Event("cannon-left-pressed", "input"))
         self.states["/container/rotating/none"].addTransition(_container_rotating_none_0)
         _container_rotating_none_1 = Transition(self, self.states["/container/rotating/none"], [self.states["/container/rotating/right"]])
-        _container_rotating_none_1.trigger = Event("cannon-right-pressed", "input")
+        _container_rotating_none_1.setTrigger(Event("cannon-right-pressed", "input"))
         self.states["/container/rotating/none"].addTransition(_container_rotating_none_1)
         
         # transition /container/rotating/left
         _container_rotating_left_0 = Transition(self, self.states["/container/rotating/left"], [self.states["/container/rotating/none"]])
-        _container_rotating_left_0.trigger = Event("cannon-left-released", "input")
+        _container_rotating_left_0.setTrigger(Event("cannon-left-released", "input"))
         self.states["/container/rotating/left"].addTransition(_container_rotating_left_0)
         _container_rotating_left_1 = Transition(self, self.states["/container/rotating/left"], [self.states["/container/rotating/both"]])
-        _container_rotating_left_1.trigger = Event("cannon-right-pressed", "input")
+        _container_rotating_left_1.setTrigger(Event("cannon-right-pressed", "input"))
         self.states["/container/rotating/left"].addTransition(_container_rotating_left_1)
         _container_rotating_left_2 = Transition(self, self.states["/container/rotating/left"], [self.states["/container/rotating/left"]])
         _container_rotating_left_2.setAction(self._container_rotating_left_2_exec)
-        _container_rotating_left_2.trigger = Event("update", "engine")
+        _container_rotating_left_2.setTrigger(Event("update", "engine"))
         self.states["/container/rotating/left"].addTransition(_container_rotating_left_2)
         
         # transition /container/rotating/both
         _container_rotating_both_0 = Transition(self, self.states["/container/rotating/both"], [self.states["/container/rotating/right"]])
-        _container_rotating_both_0.trigger = Event("cannon-left-released", "input")
+        _container_rotating_both_0.setTrigger(Event("cannon-left-released", "input"))
         self.states["/container/rotating/both"].addTransition(_container_rotating_both_0)
         _container_rotating_both_1 = Transition(self, self.states["/container/rotating/both"], [self.states["/container/rotating/left"]])
-        _container_rotating_both_1.trigger = Event("cannon-right-released", "input")
+        _container_rotating_both_1.setTrigger(Event("cannon-right-released", "input"))
         self.states["/container/rotating/both"].addTransition(_container_rotating_both_1)
         
         # transition /container/rotating/right
         _container_rotating_right_0 = Transition(self, self.states["/container/rotating/right"], [self.states["/container/rotating/both"]])
-        _container_rotating_right_0.trigger = Event("cannon-left-pressed", "input")
+        _container_rotating_right_0.setTrigger(Event("cannon-left-pressed", "input"))
         self.states["/container/rotating/right"].addTransition(_container_rotating_right_0)
         _container_rotating_right_1 = Transition(self, self.states["/container/rotating/right"], [self.states["/container/rotating/none"]])
-        _container_rotating_right_1.trigger = Event("cannon-right-released", "input")
+        _container_rotating_right_1.setTrigger(Event("cannon-right-released", "input"))
         self.states["/container/rotating/right"].addTransition(_container_rotating_right_1)
         _container_rotating_right_2 = Transition(self, self.states["/container/rotating/right"], [self.states["/container/rotating/right"]])
         _container_rotating_right_2.setAction(self._container_rotating_right_2_exec)
-        _container_rotating_right_2.trigger = Event("update", "engine")
+        _container_rotating_right_2.setTrigger(Event("update", "engine"))
         self.states["/container/rotating/right"].addTransition(_container_rotating_right_2)
         
         # transition /container/shoot/hold
         _container_shoot_hold_0 = Transition(self, self.states["/container/shoot/hold"], [self.states["/container/shoot/shoot"]])
         _container_shoot_hold_0.setAction(self._container_shoot_hold_0_exec)
-        _container_shoot_hold_0.trigger = Event("shoot-pressed", "input")
+        _container_shoot_hold_0.setTrigger(Event("shoot-pressed", "input"))
         self.states["/container/shoot/hold"].addTransition(_container_shoot_hold_0)
         
         # transition /container/shoot/shoot
         _container_shoot_shoot_0 = Transition(self, self.states["/container/shoot/shoot"], [self.states["/container/shoot/hold"]])
-        _container_shoot_shoot_0.trigger = Event("shoot-released", "input")
+        _container_shoot_shoot_0.setTrigger(Event("shoot-released", "input"))
         self.states["/container/shoot/shoot"].addTransition(_container_shoot_shoot_0)
         _container_shoot_shoot_1 = Transition(self, self.states["/container/shoot/shoot"], [self.states["/container/shoot/shoot"]])
         _container_shoot_shoot_1.setAction(self._container_shoot_shoot_1_exec)
-        _container_shoot_shoot_1.trigger = Event("loaded", None)
+        _container_shoot_shoot_1.setTrigger(Event("loaded", None))
         self.states["/container/shoot/shoot"].addTransition(_container_shoot_shoot_1)
         
         # transition /container/ammo/loaded
         _container_ammo_loaded_0 = Transition(self, self.states["/container/ammo/loaded"], [self.states["/container/ammo/unloaded"]])
         _container_ammo_loaded_0.setAction(self._container_ammo_loaded_0_exec)
-        _container_ammo_loaded_0.trigger = Event("shoot", None)
+        _container_ammo_loaded_0.setTrigger(Event("shoot", None))
         self.states["/container/ammo/loaded"].addTransition(_container_ammo_loaded_0)
         
         # transition /container/ammo/unloaded
         _container_ammo_unloaded_0 = Transition(self, self.states["/container/ammo/unloaded"], [self.states["/container/ammo/loaded"]])
         _container_ammo_unloaded_0.setAction(self._container_ammo_unloaded_0_exec)
-        _container_ammo_unloaded_0.trigger = Event("_0after")
+        _container_ammo_unloaded_0.setTrigger(Event("_0after"))
         self.states["/container/ammo/unloaded"].addTransition(_container_ammo_unloaded_0)
     
     def _container_ammo_unloaded_enter(self):
@@ -384,82 +386,82 @@ class Body(RuntimeClassBase):
         
         # transition /container/horizontal/none
         _container_horizontal_none_0 = Transition(self, self.states["/container/horizontal/none"], [self.states["/container/horizontal/left"]])
-        _container_horizontal_none_0.trigger = Event("left-pressed", "input")
+        _container_horizontal_none_0.setTrigger(Event("left-pressed", "input"))
         self.states["/container/horizontal/none"].addTransition(_container_horizontal_none_0)
         _container_horizontal_none_1 = Transition(self, self.states["/container/horizontal/none"], [self.states["/container/horizontal/right"]])
-        _container_horizontal_none_1.trigger = Event("right-pressed", "input")
+        _container_horizontal_none_1.setTrigger(Event("right-pressed", "input"))
         self.states["/container/horizontal/none"].addTransition(_container_horizontal_none_1)
         
         # transition /container/horizontal/left
         _container_horizontal_left_0 = Transition(self, self.states["/container/horizontal/left"], [self.states["/container/horizontal/none"]])
-        _container_horizontal_left_0.trigger = Event("left-released", "input")
+        _container_horizontal_left_0.setTrigger(Event("left-released", "input"))
         self.states["/container/horizontal/left"].addTransition(_container_horizontal_left_0)
         _container_horizontal_left_1 = Transition(self, self.states["/container/horizontal/left"], [self.states["/container/horizontal/both"]])
-        _container_horizontal_left_1.trigger = Event("right-pressed", "input")
+        _container_horizontal_left_1.setTrigger(Event("right-pressed", "input"))
         self.states["/container/horizontal/left"].addTransition(_container_horizontal_left_1)
         _container_horizontal_left_2 = Transition(self, self.states["/container/horizontal/left"], [self.states["/container/horizontal/left"]])
         _container_horizontal_left_2.setAction(self._container_horizontal_left_2_exec)
-        _container_horizontal_left_2.trigger = Event("update", "engine")
+        _container_horizontal_left_2.setTrigger(Event("update", "engine"))
         self.states["/container/horizontal/left"].addTransition(_container_horizontal_left_2)
         
         # transition /container/horizontal/both
         _container_horizontal_both_0 = Transition(self, self.states["/container/horizontal/both"], [self.states["/container/horizontal/right"]])
-        _container_horizontal_both_0.trigger = Event("left-released", "input")
+        _container_horizontal_both_0.setTrigger(Event("left-released", "input"))
         self.states["/container/horizontal/both"].addTransition(_container_horizontal_both_0)
         _container_horizontal_both_1 = Transition(self, self.states["/container/horizontal/both"], [self.states["/container/horizontal/left"]])
-        _container_horizontal_both_1.trigger = Event("right-released", "input")
+        _container_horizontal_both_1.setTrigger(Event("right-released", "input"))
         self.states["/container/horizontal/both"].addTransition(_container_horizontal_both_1)
         
         # transition /container/horizontal/right
         _container_horizontal_right_0 = Transition(self, self.states["/container/horizontal/right"], [self.states["/container/horizontal/both"]])
-        _container_horizontal_right_0.trigger = Event("left-pressed", "input")
+        _container_horizontal_right_0.setTrigger(Event("left-pressed", "input"))
         self.states["/container/horizontal/right"].addTransition(_container_horizontal_right_0)
         _container_horizontal_right_1 = Transition(self, self.states["/container/horizontal/right"], [self.states["/container/horizontal/none"]])
-        _container_horizontal_right_1.trigger = Event("right-released", "input")
+        _container_horizontal_right_1.setTrigger(Event("right-released", "input"))
         self.states["/container/horizontal/right"].addTransition(_container_horizontal_right_1)
         _container_horizontal_right_2 = Transition(self, self.states["/container/horizontal/right"], [self.states["/container/horizontal/right"]])
         _container_horizontal_right_2.setAction(self._container_horizontal_right_2_exec)
-        _container_horizontal_right_2.trigger = Event("update", "engine")
+        _container_horizontal_right_2.setTrigger(Event("update", "engine"))
         self.states["/container/horizontal/right"].addTransition(_container_horizontal_right_2)
         
         # transition /container/vertical/none
         _container_vertical_none_0 = Transition(self, self.states["/container/vertical/none"], [self.states["/container/vertical/down"]])
-        _container_vertical_none_0.trigger = Event("down-pressed", "input")
+        _container_vertical_none_0.setTrigger(Event("down-pressed", "input"))
         self.states["/container/vertical/none"].addTransition(_container_vertical_none_0)
         _container_vertical_none_1 = Transition(self, self.states["/container/vertical/none"], [self.states["/container/vertical/up"]])
-        _container_vertical_none_1.trigger = Event("up-pressed", "input")
+        _container_vertical_none_1.setTrigger(Event("up-pressed", "input"))
         self.states["/container/vertical/none"].addTransition(_container_vertical_none_1)
         
         # transition /container/vertical/down
         _container_vertical_down_0 = Transition(self, self.states["/container/vertical/down"], [self.states["/container/vertical/none"]])
-        _container_vertical_down_0.trigger = Event("down-released", "input")
+        _container_vertical_down_0.setTrigger(Event("down-released", "input"))
         self.states["/container/vertical/down"].addTransition(_container_vertical_down_0)
         _container_vertical_down_1 = Transition(self, self.states["/container/vertical/down"], [self.states["/container/vertical/both"]])
-        _container_vertical_down_1.trigger = Event("up-pressed", "input")
+        _container_vertical_down_1.setTrigger(Event("up-pressed", "input"))
         self.states["/container/vertical/down"].addTransition(_container_vertical_down_1)
         _container_vertical_down_2 = Transition(self, self.states["/container/vertical/down"], [self.states["/container/vertical/down"]])
         _container_vertical_down_2.setAction(self._container_vertical_down_2_exec)
-        _container_vertical_down_2.trigger = Event("update", "engine")
+        _container_vertical_down_2.setTrigger(Event("update", "engine"))
         self.states["/container/vertical/down"].addTransition(_container_vertical_down_2)
         
         # transition /container/vertical/both
         _container_vertical_both_0 = Transition(self, self.states["/container/vertical/both"], [self.states["/container/vertical/up"]])
-        _container_vertical_both_0.trigger = Event("down-released", "input")
+        _container_vertical_both_0.setTrigger(Event("down-released", "input"))
         self.states["/container/vertical/both"].addTransition(_container_vertical_both_0)
         _container_vertical_both_1 = Transition(self, self.states["/container/vertical/both"], [self.states["/container/vertical/down"]])
-        _container_vertical_both_1.trigger = Event("up-released", "input")
+        _container_vertical_both_1.setTrigger(Event("up-released", "input"))
         self.states["/container/vertical/both"].addTransition(_container_vertical_both_1)
         
         # transition /container/vertical/up
         _container_vertical_up_0 = Transition(self, self.states["/container/vertical/up"], [self.states["/container/vertical/both"]])
-        _container_vertical_up_0.trigger = Event("down-pressed", "input")
+        _container_vertical_up_0.setTrigger(Event("down-pressed", "input"))
         self.states["/container/vertical/up"].addTransition(_container_vertical_up_0)
         _container_vertical_up_1 = Transition(self, self.states["/container/vertical/up"], [self.states["/container/vertical/none"]])
-        _container_vertical_up_1.trigger = Event("up-released", "input")
+        _container_vertical_up_1.setTrigger(Event("up-released", "input"))
         self.states["/container/vertical/up"].addTransition(_container_vertical_up_1)
         _container_vertical_up_2 = Transition(self, self.states["/container/vertical/up"], [self.states["/container/vertical/up"]])
         _container_vertical_up_2.setAction(self._container_vertical_up_2_exec)
-        _container_vertical_up_2.trigger = Event("update", "engine")
+        _container_vertical_up_2.setTrigger(Event("update", "engine"))
         self.states["/container/vertical/up"].addTransition(_container_vertical_up_2)
     
     def _container_horizontal_left_2_exec(self, parameters):
@@ -503,9 +505,10 @@ class ObjectManager(ObjectManagerBase):
         return instance
 
 class Controller(EventLoopControllerBase):
-    def __init__(self, tank, event_loop_callbacks, finished_callback = None):
+    def __init__(self, tank, event_loop_callbacks, finished_callback = None, behind_schedule_callback = None):
         if finished_callback == None: finished_callback = None
-        EventLoopControllerBase.__init__(self, ObjectManager(self), event_loop_callbacks, finished_callback)
+        if behind_schedule_callback == None: behind_schedule_callback = None
+        EventLoopControllerBase.__init__(self, ObjectManager(self), event_loop_callbacks, finished_callback, behind_schedule_callback)
         self.addInputPort("engine")
         self.addInputPort("input")
         self.addOutputPort("gui")

+ 7 - 7
examples/timer-parallel/python/target_py/target.py

@@ -1,7 +1,7 @@
 """
 Generated by Statechart compiler by Glenn De Jonghe, Joeri Exelmans, Simon Van Mierlo, and Yentl Van Tendeloo (for the inspiration)
 
-Date:   Thu Aug 04 13:29:23 2016
+Date:   Fri Aug 05 16:08:36 2016
 
 Model author: Simon Van Mierlo
 Model name:   Timer (Threaded Version)
@@ -89,35 +89,35 @@ class MainApp(RuntimeClassBase):
         # transition /running/print_simulated_time/print_simulated_time
         _running_print_simulated_time_print_simulated_time_0 = Transition(self, self.states["/running/print_simulated_time/print_simulated_time"], [self.states["/running/print_simulated_time/print_simulated_time"]])
         _running_print_simulated_time_print_simulated_time_0.setAction(self._running_print_simulated_time_print_simulated_time_0_exec)
-        _running_print_simulated_time_print_simulated_time_0.trigger = Event("_0after")
+        _running_print_simulated_time_print_simulated_time_0.setTrigger(Event("_0after"))
         self.states["/running/print_simulated_time/print_simulated_time"].addTransition(_running_print_simulated_time_print_simulated_time_0)
         
         # transition /running/print_wct_time/print_wct_time
         _running_print_wct_time_print_wct_time_0 = Transition(self, self.states["/running/print_wct_time/print_wct_time"], [self.states["/running/print_wct_time/print_wct_time"]])
         _running_print_wct_time_print_wct_time_0.setAction(self._running_print_wct_time_print_wct_time_0_exec)
-        _running_print_wct_time_print_wct_time_0.trigger = Event("_1after")
+        _running_print_wct_time_print_wct_time_0.setTrigger(Event("_1after"))
         self.states["/running/print_wct_time/print_wct_time"].addTransition(_running_print_wct_time_print_wct_time_0)
         
         # transition /interrupted
         _interrupted_0 = Transition(self, self.states["/interrupted"], [self.states["/interrupted"]])
         _interrupted_0.setAction(self._interrupted_0_exec)
-        _interrupted_0.trigger = Event("interrupt", "input")
+        _interrupted_0.setTrigger(Event("interrupt", "input"))
         self.states["/interrupted"].addTransition(_interrupted_0)
         _interrupted_1 = Transition(self, self.states["/interrupted"], [self.states["/running"]])
         _interrupted_1.setAction(self._interrupted_1_exec)
-        _interrupted_1.trigger = Event("continue", "input")
+        _interrupted_1.setTrigger(Event("continue", "input"))
         self.states["/interrupted"].addTransition(_interrupted_1)
         
         # transition /running
         _running_0 = Transition(self, self.states["/running"], [self.states["/interrupted"]])
         _running_0.setAction(self._running_0_exec)
-        _running_0.trigger = Event("interrupt", "input")
+        _running_0.setTrigger(Event("interrupt", "input"))
         self.states["/running"].addTransition(_running_0)
         
         # transition /running/print_simulated_time
         _running_print_simulated_time_0 = Transition(self, self.states["/running/print_simulated_time"], [self.states["/running/print_simulated_time"]])
         _running_print_simulated_time_0.setAction(self._running_print_simulated_time_0_exec)
-        _running_print_simulated_time_0.trigger = Event("interrupt", "input")
+        _running_print_simulated_time_0.setTrigger(Event("interrupt", "input"))
         self.states["/running/print_simulated_time"].addTransition(_running_print_simulated_time_0)
     
     def _running_print_simulated_time_print_simulated_time_enter(self):

+ 5 - 5
examples/timer-threads/python/target_py/target.py

@@ -1,7 +1,7 @@
 """
 Generated by Statechart compiler by Glenn De Jonghe, Joeri Exelmans, Simon Van Mierlo, and Yentl Van Tendeloo (for the inspiration)
 
-Date:   Thu Aug 04 13:29:23 2016
+Date:   Fri Aug 05 16:08:36 2016
 
 Model author: Simon Van Mierlo
 Model name:   Timer (Threaded Version)
@@ -65,21 +65,21 @@ class MainApp(RuntimeClassBase):
         # transition /running
         _running_0 = Transition(self, self.states["/running"], [self.states["/running"]])
         _running_0.setAction(self._running_0_exec)
-        _running_0.trigger = Event("_0after")
+        _running_0.setTrigger(Event("_0after"))
         self.states["/running"].addTransition(_running_0)
         _running_1 = Transition(self, self.states["/running"], [self.states["/interrupted"]])
         _running_1.setAction(self._running_1_exec)
-        _running_1.trigger = Event("interrupt", "input")
+        _running_1.setTrigger(Event("interrupt", "input"))
         self.states["/running"].addTransition(_running_1)
         
         # transition /interrupted
         _interrupted_0 = Transition(self, self.states["/interrupted"], [self.states["/interrupted"]])
         _interrupted_0.setAction(self._interrupted_0_exec)
-        _interrupted_0.trigger = Event("interrupt", "input")
+        _interrupted_0.setTrigger(Event("interrupt", "input"))
         self.states["/interrupted"].addTransition(_interrupted_0)
         _interrupted_1 = Transition(self, self.states["/interrupted"], [self.states["/running"]])
         _interrupted_1.setAction(self._interrupted_1_exec)
-        _interrupted_1.trigger = Event("continue", "input")
+        _interrupted_1.setTrigger(Event("continue", "input"))
         self.states["/interrupted"].addTransition(_interrupted_1)
     
     def _running_enter(self):

+ 8 - 7
examples/timer/js/target_js/target.js

@@ -1,6 +1,6 @@
 /* Generated by Statechart compiler by Glenn De Jonghe, Joeri Exelmans, Simon Van Mierlo, and Yentl Van Tendeloo (for the inspiration)
 
-Date:   Thu Aug 04 13:29:23 2016
+Date:   Fri Aug 05 16:08:36 2016
 
 Model author: Simon Van Mierlo
 Model name:   Timer
@@ -80,21 +80,21 @@ MainApp.prototype.build_statechart_structure = function() {
     // transition /running
     var _running_0 = new Transition(this, this.states["/running"], [this.states["/running"]]);
     _running_0.setAction(this._running_0_exec);
-    _running_0.trigger = new Event("_0after");
+    _running_0.setTrigger(new Event("_0after"));
     this.states["/running"].addTransition(_running_0);
     var _running_1 = new Transition(this, this.states["/running"], [this.states["/interrupted"]]);
     _running_1.setAction(this._running_1_exec);
-    _running_1.trigger = new Event("interrupt_clicked", "ui");
+    _running_1.setTrigger(new Event("interrupt_clicked", "ui"));
     this.states["/running"].addTransition(_running_1);
     
     // transition /interrupted
     var _interrupted_0 = new Transition(this, this.states["/interrupted"], [this.states["/interrupted"]]);
     _interrupted_0.setAction(this._interrupted_0_exec);
-    _interrupted_0.trigger = new Event("interrupt_clicked", "ui");
+    _interrupted_0.setTrigger(new Event("interrupt_clicked", "ui"));
     this.states["/interrupted"].addTransition(_interrupted_0);
     var _interrupted_1 = new Transition(this, this.states["/interrupted"], [this.states["/running"]]);
     _interrupted_1.setAction(this._interrupted_1_exec);
-    _interrupted_1.trigger = new Event("continue_clicked", "ui");
+    _interrupted_1.setTrigger(new Event("continue_clicked", "ui"));
     this.states["/interrupted"].addTransition(_interrupted_1);
 };
 
@@ -170,9 +170,10 @@ ObjectManager.prototype.instantiate = function(class_name, construct_params) {
 // add symbol 'ObjectManager' to package 'Timer'
 Timer.ObjectManager = ObjectManager;
 
-var Controller = function(event_loop_callbacks, finished_callback) {
+var Controller = function(event_loop_callbacks, finished_callback, behind_schedule_callback) {
     if (finished_callback === undefined) finished_callback = null;
-    EventLoopControllerBase.call(this, new ObjectManager(this), event_loop_callbacks, finished_callback);
+    if (behind_schedule_callback === undefined) behind_schedule_callback = null;
+    EventLoopControllerBase.call(this, new ObjectManager(this), event_loop_callbacks, finished_callback, behind_schedule_callback);
     this.addInputPort("ui");
     this.object_manager.createInstance("MainApp", new Array());
 };

+ 8 - 7
examples/timer/python/target_py/target.py

@@ -1,7 +1,7 @@
 """
 Generated by Statechart compiler by Glenn De Jonghe, Joeri Exelmans, Simon Van Mierlo, and Yentl Van Tendeloo (for the inspiration)
 
-Date:   Thu Aug 04 13:29:23 2016
+Date:   Fri Aug 05 16:08:36 2016
 
 Model author: Simon Van Mierlo
 Model name:   Timer
@@ -73,21 +73,21 @@ class MainApp(RuntimeClassBase):
         # transition /running
         _running_0 = Transition(self, self.states["/running"], [self.states["/running"]])
         _running_0.setAction(self._running_0_exec)
-        _running_0.trigger = Event("_0after")
+        _running_0.setTrigger(Event("_0after"))
         self.states["/running"].addTransition(_running_0)
         _running_1 = Transition(self, self.states["/running"], [self.states["/interrupted"]])
         _running_1.setAction(self._running_1_exec)
-        _running_1.trigger = Event("interrupt_clicked", "ui")
+        _running_1.setTrigger(Event("interrupt_clicked", "ui"))
         self.states["/running"].addTransition(_running_1)
         
         # transition /interrupted
         _interrupted_0 = Transition(self, self.states["/interrupted"], [self.states["/interrupted"]])
         _interrupted_0.setAction(self._interrupted_0_exec)
-        _interrupted_0.trigger = Event("interrupt_clicked", "ui")
+        _interrupted_0.setTrigger(Event("interrupt_clicked", "ui"))
         self.states["/interrupted"].addTransition(_interrupted_0)
         _interrupted_1 = Transition(self, self.states["/interrupted"], [self.states["/running"]])
         _interrupted_1.setAction(self._interrupted_1_exec)
-        _interrupted_1.trigger = Event("continue_clicked", "ui")
+        _interrupted_1.setTrigger(Event("continue_clicked", "ui"))
         self.states["/interrupted"].addTransition(_interrupted_1)
     
     def _running_enter(self):
@@ -129,8 +129,9 @@ class ObjectManager(ObjectManagerBase):
         return instance
 
 class Controller(EventLoopControllerBase):
-    def __init__(self, event_loop_callbacks, finished_callback = None):
+    def __init__(self, event_loop_callbacks, finished_callback = None, behind_schedule_callback = None):
         if finished_callback == None: finished_callback = None
-        EventLoopControllerBase.__init__(self, ObjectManager(self), event_loop_callbacks, finished_callback)
+        if behind_schedule_callback == None: behind_schedule_callback = None
+        EventLoopControllerBase.__init__(self, ObjectManager(self), event_loop_callbacks, finished_callback, behind_schedule_callback)
         self.addInputPort("ui")
         self.object_manager.createInstance("MainApp", [])

+ 14 - 12
examples/trafficlights/js/target_js/target.js

@@ -1,6 +1,6 @@
 /* Generated by Statechart compiler by Glenn De Jonghe, Joeri Exelmans, Simon Van Mierlo, and Yentl Van Tendeloo (for the inspiration)
 
-Date:   Thu Aug 04 13:32:47 2016
+Date:   Fri Aug 05 16:08:36 2016
 
 Model author: Raphael Mannadiar
 Model name:   Traffic_Light_JavaScript_Version
@@ -71,12 +71,13 @@ MainApp.prototype.build_statechart_structure = function() {
     // transition /initializing
     var _initializing_0 = new Transition(this, this.states["/initializing"], [this.states["/creating"]]);
     _initializing_0.setAction(this._initializing_0_exec);
+    _initializing_0.setTrigger(null);
     this.states["/initializing"].addTransition(_initializing_0);
     
     // transition /creating
     var _creating_0 = new Transition(this, this.states["/creating"], [this.states["/initialized"]]);
     _creating_0.setAction(this._creating_0_exec);
-    _creating_0.trigger = new Event("instance_created", null);
+    _creating_0.setTrigger(new Event("instance_created", null));
     this.states["/creating"].addTransition(_creating_0);
 };
 
@@ -240,42 +241,42 @@ TrafficLight.prototype.build_statechart_structure = function() {
     
     // transition /on/normal/red
     var _on_normal_red_0 = new Transition(this, this.states["/on/normal/red"], [this.states["/on/normal/green"]]);
-    _on_normal_red_0.trigger = new Event("_0after");
+    _on_normal_red_0.setTrigger(new Event("_0after"));
     this.states["/on/normal/red"].addTransition(_on_normal_red_0);
     
     // transition /on/normal/green
     var _on_normal_green_0 = new Transition(this, this.states["/on/normal/green"], [this.states["/on/normal/yellow"]]);
-    _on_normal_green_0.trigger = new Event("_1after");
+    _on_normal_green_0.setTrigger(new Event("_1after"));
     this.states["/on/normal/green"].addTransition(_on_normal_green_0);
     
     // transition /on/normal/yellow
     var _on_normal_yellow_0 = new Transition(this, this.states["/on/normal/yellow"], [this.states["/on/normal/red"]]);
-    _on_normal_yellow_0.trigger = new Event("_2after");
+    _on_normal_yellow_0.setTrigger(new Event("_2after"));
     this.states["/on/normal/yellow"].addTransition(_on_normal_yellow_0);
     
     // transition /on/interrupted/yellow
     var _on_interrupted_yellow_0 = new Transition(this, this.states["/on/interrupted/yellow"], [this.states["/on/interrupted/black"]]);
-    _on_interrupted_yellow_0.trigger = new Event("_3after");
+    _on_interrupted_yellow_0.setTrigger(new Event("_3after"));
     this.states["/on/interrupted/yellow"].addTransition(_on_interrupted_yellow_0);
     
     // transition /on/interrupted/black
     var _on_interrupted_black_0 = new Transition(this, this.states["/on/interrupted/black"], [this.states["/on/interrupted/yellow"]]);
-    _on_interrupted_black_0.trigger = new Event("_4after");
+    _on_interrupted_black_0.setTrigger(new Event("_4after"));
     this.states["/on/interrupted/black"].addTransition(_on_interrupted_black_0);
     
     // transition /on
     var _on_0 = new Transition(this, this.states["/on"], [this.states["/off"]]);
-    _on_0.trigger = new Event("quit_clicked", "ui");
+    _on_0.setTrigger(new Event("quit_clicked", "ui"));
     this.states["/on"].addTransition(_on_0);
     
     // transition /on/normal
     var _on_normal_0 = new Transition(this, this.states["/on/normal"], [this.states["/on/interrupted"]]);
-    _on_normal_0.trigger = new Event("police_interrupt_clicked", "ui");
+    _on_normal_0.setTrigger(new Event("police_interrupt_clicked", "ui"));
     this.states["/on/normal"].addTransition(_on_normal_0);
     
     // transition /on/interrupted
     var _on_interrupted_0 = new Transition(this, this.states["/on/interrupted"], [this.states["/on/normal/history"]]);
-    _on_interrupted_0.trigger = new Event("police_interrupt_clicked", "ui");
+    _on_interrupted_0.setTrigger(new Event("police_interrupt_clicked", "ui"));
     this.states["/on/interrupted"].addTransition(_on_interrupted_0);
 };
 
@@ -372,9 +373,10 @@ ObjectManager.prototype.instantiate = function(class_name, construct_params) {
 // add symbol 'ObjectManager' to package 'Traffic_Light_JavaScript_Version'
 Traffic_Light_JavaScript_Version.ObjectManager = ObjectManager;
 
-var Controller = function(event_loop_callbacks, finished_callback) {
+var Controller = function(event_loop_callbacks, finished_callback, behind_schedule_callback) {
     if (finished_callback === undefined) finished_callback = null;
-    EventLoopControllerBase.call(this, new ObjectManager(this), event_loop_callbacks, finished_callback);
+    if (behind_schedule_callback === undefined) behind_schedule_callback = null;
+    EventLoopControllerBase.call(this, new ObjectManager(this), event_loop_callbacks, finished_callback, behind_schedule_callback);
     this.addInputPort("ui");
     this.object_manager.createInstance("MainApp", new Array());
 };

+ 14 - 12
examples/trafficlights/python/target_py/target.py

@@ -1,7 +1,7 @@
 """
 Generated by Statechart compiler by Glenn De Jonghe, Joeri Exelmans, Simon Van Mierlo, and Yentl Van Tendeloo (for the inspiration)
 
-Date:   Thu Aug 04 13:29:24 2016
+Date:   Fri Aug 05 16:08:37 2016
 
 Model author: Raphael Mannadiar
 Model name:   Traffic_Light_Python_Version
@@ -65,12 +65,13 @@ class MainApp(RuntimeClassBase):
         # transition /initializing
         _initializing_0 = Transition(self, self.states["/initializing"], [self.states["/creating"]])
         _initializing_0.setAction(self._initializing_0_exec)
+        _initializing_0.setTrigger(None)
         self.states["/initializing"].addTransition(_initializing_0)
         
         # transition /creating
         _creating_0 = Transition(self, self.states["/creating"], [self.states["/initialized"]])
         _creating_0.setAction(self._creating_0_exec)
-        _creating_0.trigger = Event("instance_created", None)
+        _creating_0.setTrigger(Event("instance_created", None))
         self.states["/creating"].addTransition(_creating_0)
     
     def _initializing_0_exec(self, parameters):
@@ -212,42 +213,42 @@ class TrafficLight(RuntimeClassBase):
         
         # transition /on/normal/red
         _on_normal_red_0 = Transition(self, self.states["/on/normal/red"], [self.states["/on/normal/green"]])
-        _on_normal_red_0.trigger = Event("_0after")
+        _on_normal_red_0.setTrigger(Event("_0after"))
         self.states["/on/normal/red"].addTransition(_on_normal_red_0)
         
         # transition /on/normal/green
         _on_normal_green_0 = Transition(self, self.states["/on/normal/green"], [self.states["/on/normal/yellow"]])
-        _on_normal_green_0.trigger = Event("_1after")
+        _on_normal_green_0.setTrigger(Event("_1after"))
         self.states["/on/normal/green"].addTransition(_on_normal_green_0)
         
         # transition /on/normal/yellow
         _on_normal_yellow_0 = Transition(self, self.states["/on/normal/yellow"], [self.states["/on/normal/red"]])
-        _on_normal_yellow_0.trigger = Event("_2after")
+        _on_normal_yellow_0.setTrigger(Event("_2after"))
         self.states["/on/normal/yellow"].addTransition(_on_normal_yellow_0)
         
         # transition /on/interrupted/yellow
         _on_interrupted_yellow_0 = Transition(self, self.states["/on/interrupted/yellow"], [self.states["/on/interrupted/black"]])
-        _on_interrupted_yellow_0.trigger = Event("_3after")
+        _on_interrupted_yellow_0.setTrigger(Event("_3after"))
         self.states["/on/interrupted/yellow"].addTransition(_on_interrupted_yellow_0)
         
         # transition /on/interrupted/black
         _on_interrupted_black_0 = Transition(self, self.states["/on/interrupted/black"], [self.states["/on/interrupted/yellow"]])
-        _on_interrupted_black_0.trigger = Event("_4after")
+        _on_interrupted_black_0.setTrigger(Event("_4after"))
         self.states["/on/interrupted/black"].addTransition(_on_interrupted_black_0)
         
         # transition /on
         _on_0 = Transition(self, self.states["/on"], [self.states["/off"]])
-        _on_0.trigger = Event("quit_clicked", "ui")
+        _on_0.setTrigger(Event("quit_clicked", "ui"))
         self.states["/on"].addTransition(_on_0)
         
         # transition /on/normal
         _on_normal_0 = Transition(self, self.states["/on/normal"], [self.states["/on/interrupted"]])
-        _on_normal_0.trigger = Event("police_interrupt_clicked", "ui")
+        _on_normal_0.setTrigger(Event("police_interrupt_clicked", "ui"))
         self.states["/on/normal"].addTransition(_on_normal_0)
         
         # transition /on/interrupted
         _on_interrupted_0 = Transition(self, self.states["/on/interrupted"], [self.states["/on/normal/history"]])
-        _on_interrupted_0.trigger = Event("police_interrupt_clicked", "ui")
+        _on_interrupted_0.setTrigger(Event("police_interrupt_clicked", "ui"))
         self.states["/on/interrupted"].addTransition(_on_interrupted_0)
     
     def _on_normal_red_enter(self):
@@ -313,8 +314,9 @@ class ObjectManager(ObjectManagerBase):
         return instance
 
 class Controller(EventLoopControllerBase):
-    def __init__(self, event_loop_callbacks, finished_callback = None):
+    def __init__(self, event_loop_callbacks, finished_callback = None, behind_schedule_callback = None):
         if finished_callback == None: finished_callback = None
-        EventLoopControllerBase.__init__(self, ObjectManager(self), event_loop_callbacks, finished_callback)
+        if behind_schedule_callback == None: behind_schedule_callback = None
+        EventLoopControllerBase.__init__(self, ObjectManager(self), event_loop_callbacks, finished_callback, behind_schedule_callback)
         self.addInputPort("ui")
         self.object_manager.createInstance("MainApp", [])

+ 29 - 24
examples/train/python/target_py/target.py

@@ -1,7 +1,7 @@
 """
 Generated by Statechart compiler by Glenn De Jonghe, Joeri Exelmans, Simon Van Mierlo, and Yentl Van Tendeloo (for the inspiration)
 
-Date:   Thu Aug 04 13:29:24 2016
+Date:   Fri Aug 05 16:08:37 2016
 
 """
 
@@ -180,126 +180,130 @@ class Train(RuntimeClassBase):
         
         # transition /normal_operation/for_history/train/train/stopped/opened_doors
         _normal_operation_for_history_train_train_stopped_opened_doors_0 = Transition(self, self.states["/normal_operation/for_history/train/train/stopped/opened_doors"], [self.states["/normal_operation/for_history/train/train/stopped/allow_closing"]])
-        _normal_operation_for_history_train_train_stopped_opened_doors_0.trigger = Event("_0after")
+        _normal_operation_for_history_train_train_stopped_opened_doors_0.setTrigger(Event("_0after"))
         self.states["/normal_operation/for_history/train/train/stopped/opened_doors"].addTransition(_normal_operation_for_history_train_train_stopped_opened_doors_0)
         
         # transition /normal_operation/for_history/train/train/stopped/in_station
         _normal_operation_for_history_train_train_stopped_in_station_0 = Transition(self, self.states["/normal_operation/for_history/train/train/stopped/in_station"], [self.states["/normal_operation/for_history/train/train/stopped/opened_doors"]])
         _normal_operation_for_history_train_train_stopped_in_station_0.setAction(self._normal_operation_for_history_train_train_stopped_in_station_0_exec)
-        _normal_operation_for_history_train_train_stopped_in_station_0.trigger = Event("open", "tkinter_input")
+        _normal_operation_for_history_train_train_stopped_in_station_0.setTrigger(Event("open", "tkinter_input"))
         self.states["/normal_operation/for_history/train/train/stopped/in_station"].addTransition(_normal_operation_for_history_train_train_stopped_in_station_0)
         
         # transition /normal_operation/for_history/train/train/stopped/allow_closing
         _normal_operation_for_history_train_train_stopped_allow_closing_0 = Transition(self, self.states["/normal_operation/for_history/train/train/stopped/allow_closing"], [self.states["/normal_operation/for_history/train/train/stopped/ready_to_leave"]])
         _normal_operation_for_history_train_train_stopped_allow_closing_0.setAction(self._normal_operation_for_history_train_train_stopped_allow_closing_0_exec)
-        _normal_operation_for_history_train_train_stopped_allow_closing_0.trigger = Event("close", "tkinter_input")
+        _normal_operation_for_history_train_train_stopped_allow_closing_0.setTrigger(Event("close", "tkinter_input"))
         self.states["/normal_operation/for_history/train/train/stopped/allow_closing"].addTransition(_normal_operation_for_history_train_train_stopped_allow_closing_0)
         
         # transition /normal_operation/for_history/train/train/stopped/ready_to_leave
         _normal_operation_for_history_train_train_stopped_ready_to_leave_0 = Transition(self, self.states["/normal_operation/for_history/train/train/stopped/ready_to_leave"], [self.states["/normal_operation/for_history/train/train/driving"]])
         _normal_operation_for_history_train_train_stopped_ready_to_leave_0.setAction(self._normal_operation_for_history_train_train_stopped_ready_to_leave_0_exec)
-        _normal_operation_for_history_train_train_stopped_ready_to_leave_0.trigger = Event("accel", "tkinter_input")
+        _normal_operation_for_history_train_train_stopped_ready_to_leave_0.setTrigger(Event("accel", "tkinter_input"))
         _normal_operation_for_history_train_train_stopped_ready_to_leave_0.setGuard(self._normal_operation_for_history_train_train_stopped_ready_to_leave_0_guard)
         self.states["/normal_operation/for_history/train/train/stopped/ready_to_leave"].addTransition(_normal_operation_for_history_train_train_stopped_ready_to_leave_0)
         
         # transition /normal_operation/for_history/train/train/approaching_station
         _normal_operation_for_history_train_train_approaching_station_0 = Transition(self, self.states["/normal_operation/for_history/train/train/approaching_station"], [self.states["/normal_operation/for_history/train/train/stopped/in_station"]])
+        _normal_operation_for_history_train_train_approaching_station_0.setTrigger(None)
         _normal_operation_for_history_train_train_approaching_station_0.setGuard(self._normal_operation_for_history_train_train_approaching_station_0_guard)
         self.states["/normal_operation/for_history/train/train/approaching_station"].addTransition(_normal_operation_for_history_train_train_approaching_station_0)
         _normal_operation_for_history_train_train_approaching_station_1 = Transition(self, self.states["/normal_operation/for_history/train/train/approaching_station"], [self.states["/normal_operation/for_history/train/train/approaching_station"]])
         _normal_operation_for_history_train_train_approaching_station_1.setAction(self._normal_operation_for_history_train_train_approaching_station_1_exec)
-        _normal_operation_for_history_train_train_approaching_station_1.trigger = Event("accel", "tkinter_input")
+        _normal_operation_for_history_train_train_approaching_station_1.setTrigger(Event("accel", "tkinter_input"))
         self.states["/normal_operation/for_history/train/train/approaching_station"].addTransition(_normal_operation_for_history_train_train_approaching_station_1)
         _normal_operation_for_history_train_train_approaching_station_2 = Transition(self, self.states["/normal_operation/for_history/train/train/approaching_station"], [self.states["/normal_operation/for_history/train/train/approaching_station"]])
         _normal_operation_for_history_train_train_approaching_station_2.setAction(self._normal_operation_for_history_train_train_approaching_station_2_exec)
-        _normal_operation_for_history_train_train_approaching_station_2.trigger = Event("leave", "tkinter_input")
+        _normal_operation_for_history_train_train_approaching_station_2.setTrigger(Event("leave", "tkinter_input"))
         self.states["/normal_operation/for_history/train/train/approaching_station"].addTransition(_normal_operation_for_history_train_train_approaching_station_2)
         
         # transition /normal_operation/for_history/train/train/driving
         _normal_operation_for_history_train_train_driving_0 = Transition(self, self.states["/normal_operation/for_history/train/train/driving"], [self.states["/normal_operation/for_history/train/train/max_speed"]])
+        _normal_operation_for_history_train_train_driving_0.setTrigger(None)
         _normal_operation_for_history_train_train_driving_0.setGuard(self._normal_operation_for_history_train_train_driving_0_guard)
         self.states["/normal_operation/for_history/train/train/driving"].addTransition(_normal_operation_for_history_train_train_driving_0)
         _normal_operation_for_history_train_train_driving_1 = Transition(self, self.states["/normal_operation/for_history/train/train/driving"], [self.states["/normal_operation/for_history/train/train/stopped/ready_to_leave"]])
+        _normal_operation_for_history_train_train_driving_1.setTrigger(None)
         _normal_operation_for_history_train_train_driving_1.setGuard(self._normal_operation_for_history_train_train_driving_1_guard)
         self.states["/normal_operation/for_history/train/train/driving"].addTransition(_normal_operation_for_history_train_train_driving_1)
         _normal_operation_for_history_train_train_driving_2 = Transition(self, self.states["/normal_operation/for_history/train/train/driving"], [self.states["/normal_operation/for_history/train/train/approaching_station"]])
-        _normal_operation_for_history_train_train_driving_2.trigger = Event("enter", "tkinter_input")
+        _normal_operation_for_history_train_train_driving_2.setTrigger(Event("enter", "tkinter_input"))
         _normal_operation_for_history_train_train_driving_2.setGuard(self._normal_operation_for_history_train_train_driving_2_guard)
         self.states["/normal_operation/for_history/train/train/driving"].addTransition(_normal_operation_for_history_train_train_driving_2)
         _normal_operation_for_history_train_train_driving_3 = Transition(self, self.states["/normal_operation/for_history/train/train/driving"], [self.states["/normal_operation/for_history/train/train/driving"]])
         _normal_operation_for_history_train_train_driving_3.setAction(self._normal_operation_for_history_train_train_driving_3_exec)
-        _normal_operation_for_history_train_train_driving_3.trigger = Event("accel", "tkinter_input")
+        _normal_operation_for_history_train_train_driving_3.setTrigger(Event("accel", "tkinter_input"))
         self.states["/normal_operation/for_history/train/train/driving"].addTransition(_normal_operation_for_history_train_train_driving_3)
         _normal_operation_for_history_train_train_driving_4 = Transition(self, self.states["/normal_operation/for_history/train/train/driving"], [self.states["/normal_operation/for_history/train/train/approaching_station"]])
         _normal_operation_for_history_train_train_driving_4.setAction(self._normal_operation_for_history_train_train_driving_4_exec)
-        _normal_operation_for_history_train_train_driving_4.trigger = Event("enter", None)
+        _normal_operation_for_history_train_train_driving_4.setTrigger(Event("enter", None))
         _normal_operation_for_history_train_train_driving_4.setGuard(self._normal_operation_for_history_train_train_driving_4_guard)
         self.states["/normal_operation/for_history/train/train/driving"].addTransition(_normal_operation_for_history_train_train_driving_4)
         
         # transition /normal_operation/for_history/train/train/max_speed
         _normal_operation_for_history_train_train_max_speed_0 = Transition(self, self.states["/normal_operation/for_history/train/train/max_speed"], [self.states["/normal_operation/for_history/train/train/driving"]])
         _normal_operation_for_history_train_train_max_speed_0.setAction(self._normal_operation_for_history_train_train_max_speed_0_exec)
-        _normal_operation_for_history_train_train_max_speed_0.trigger = Event("accel", "tkinter_input")
+        _normal_operation_for_history_train_train_max_speed_0.setTrigger(Event("accel", "tkinter_input"))
         _normal_operation_for_history_train_train_max_speed_0.setGuard(self._normal_operation_for_history_train_train_max_speed_0_guard)
         self.states["/normal_operation/for_history/train/train/max_speed"].addTransition(_normal_operation_for_history_train_train_max_speed_0)
         _normal_operation_for_history_train_train_max_speed_1 = Transition(self, self.states["/normal_operation/for_history/train/train/max_speed"], [self.states["/normal_operation/for_history/train/train/max_speed"]])
         _normal_operation_for_history_train_train_max_speed_1.setAction(self._normal_operation_for_history_train_train_max_speed_1_exec)
-        _normal_operation_for_history_train_train_max_speed_1.trigger = Event("enter", "tkinter_input")
+        _normal_operation_for_history_train_train_max_speed_1.setTrigger(Event("enter", "tkinter_input"))
         self.states["/normal_operation/for_history/train/train/max_speed"].addTransition(_normal_operation_for_history_train_train_max_speed_1)
         
         # transition /normal_operation/for_history/GUI_update/S_/updating
         _normal_operation_for_history_GUI_update_S__updating_0 = Transition(self, self.states["/normal_operation/for_history/GUI_update/S_/updating"], [self.states["/normal_operation/for_history/GUI_update/S_/updating"]])
         _normal_operation_for_history_GUI_update_S__updating_0.setAction(self._normal_operation_for_history_GUI_update_S__updating_0_exec)
-        _normal_operation_for_history_GUI_update_S__updating_0.trigger = Event("_1after")
+        _normal_operation_for_history_GUI_update_S__updating_0.setTrigger(Event("_1after"))
         self.states["/normal_operation/for_history/GUI_update/S_/updating"].addTransition(_normal_operation_for_history_GUI_update_S__updating_0)
         
         # transition /normal_operation/for_history/polling/S_/okay
         _normal_operation_for_history_polling_S__okay_0 = Transition(self, self.states["/normal_operation/for_history/polling/S_/okay"], [self.states["/normal_operation/for_history/polling/S_/warn"]])
         _normal_operation_for_history_polling_S__okay_0.setAction(self._normal_operation_for_history_polling_S__okay_0_exec)
-        _normal_operation_for_history_polling_S__okay_0.trigger = Event("_2after")
+        _normal_operation_for_history_polling_S__okay_0.setTrigger(Event("_2after"))
         self.states["/normal_operation/for_history/polling/S_/okay"].addTransition(_normal_operation_for_history_polling_S__okay_0)
         
         # transition /normal_operation/for_history/polling/S_/warn
         _normal_operation_for_history_polling_S__warn_0 = Transition(self, self.states["/normal_operation/for_history/polling/S_/warn"], [self.states["/normal_operation/for_history/polling/S_/okay"]])
         _normal_operation_for_history_polling_S__warn_0.setAction(self._normal_operation_for_history_polling_S__warn_0_exec)
-        _normal_operation_for_history_polling_S__warn_0.trigger = Event("awake", "tkinter_input")
+        _normal_operation_for_history_polling_S__warn_0.setTrigger(Event("awake", "tkinter_input"))
         self.states["/normal_operation/for_history/polling/S_/warn"].addTransition(_normal_operation_for_history_polling_S__warn_0)
         _normal_operation_for_history_polling_S__warn_1 = Transition(self, self.states["/normal_operation/for_history/polling/S_/warn"], [self.states["/normal_operation/for_history/polling/S_/warn"]])
         _normal_operation_for_history_polling_S__warn_1.setAction(self._normal_operation_for_history_polling_S__warn_1_exec)
-        _normal_operation_for_history_polling_S__warn_1.trigger = Event("_3after")
+        _normal_operation_for_history_polling_S__warn_1.setTrigger(Event("_3after"))
         self.states["/normal_operation/for_history/polling/S_/warn"].addTransition(_normal_operation_for_history_polling_S__warn_1)
         
         # transition /emergency_stop
         _emergency_stop_0 = Transition(self, self.states["/emergency_stop"], [self.states["/finished"]])
+        _emergency_stop_0.setTrigger(None)
         _emergency_stop_0.setGuard(self._emergency_stop_0_guard)
         self.states["/emergency_stop"].addTransition(_emergency_stop_0)
         _emergency_stop_1 = Transition(self, self.states["/emergency_stop"], [self.states["/emergency_stop"]])
         _emergency_stop_1.setAction(self._emergency_stop_1_exec)
-        _emergency_stop_1.trigger = Event("_4after")
+        _emergency_stop_1.setTrigger(Event("_4after"))
         self.states["/emergency_stop"].addTransition(_emergency_stop_1)
         
         # transition /paused
         _paused_0 = Transition(self, self.states["/paused"], [self.states["/normal_operation/H"]])
         _paused_0.setAction(self._paused_0_exec)
-        _paused_0.trigger = Event("continue", "tkinter_input")
+        _paused_0.setTrigger(Event("continue", "tkinter_input"))
         self.states["/paused"].addTransition(_paused_0)
         
         # transition /normal_operation
         _normal_operation_0 = Transition(self, self.states["/normal_operation"], [self.states["/emergency_stop"]])
         _normal_operation_0.setAction(self._normal_operation_0_exec)
-        _normal_operation_0.trigger = Event("red_light", "tkinter_input")
+        _normal_operation_0.setTrigger(Event("red_light", "tkinter_input"))
         self.states["/normal_operation"].addTransition(_normal_operation_0)
         _normal_operation_1 = Transition(self, self.states["/normal_operation"], [self.states["/emergency_stop"]])
         _normal_operation_1.setAction(self._normal_operation_1_exec)
-        _normal_operation_1.trigger = Event("yellow_light", "tkinter_input")
+        _normal_operation_1.setTrigger(Event("yellow_light", "tkinter_input"))
         _normal_operation_1.setGuard(self._normal_operation_1_guard)
         self.states["/normal_operation"].addTransition(_normal_operation_1)
         _normal_operation_2 = Transition(self, self.states["/normal_operation"], [self.states["/emergency_stop"]])
-        _normal_operation_2.trigger = Event("error", None)
+        _normal_operation_2.setTrigger(Event("error", None))
         self.states["/normal_operation"].addTransition(_normal_operation_2)
         _normal_operation_3 = Transition(self, self.states["/normal_operation"], [self.states["/paused"]])
         _normal_operation_3.setAction(self._normal_operation_3_exec)
-        _normal_operation_3.trigger = Event("pause", "tkinter_input")
+        _normal_operation_3.setTrigger(Event("pause", "tkinter_input"))
         self.states["/normal_operation"].addTransition(_normal_operation_3)
     
     def _normal_operation_for_history_train_train_stopped_enter(self):
@@ -465,8 +469,9 @@ class ObjectManager(ObjectManagerBase):
         return instance
 
 class Controller(EventLoopControllerBase):
-    def __init__(self, root, event_loop_callbacks, finished_callback = None):
+    def __init__(self, root, event_loop_callbacks, finished_callback = None, behind_schedule_callback = None):
         if finished_callback == None: finished_callback = None
-        EventLoopControllerBase.__init__(self, ObjectManager(self), event_loop_callbacks, finished_callback)
+        if behind_schedule_callback == None: behind_schedule_callback = None
+        EventLoopControllerBase.__init__(self, ObjectManager(self), event_loop_callbacks, finished_callback, behind_schedule_callback)
         self.addInputPort("tkinter_input")
         self.object_manager.createInstance("Train", [root])

+ 60 - 38
src/javascript_sccd_runtime/statecharts_core.js

@@ -5,17 +5,9 @@ function objectId(obj) {
     return obj.__obj_id;
 }
 
-simulated_time = 0.0
-function get_simulated_time() {
-    return simulated_time
-}
-
 start_time = undefined
 function time() {
-    if (start_time == undefined) {
-        start_time = (new Date).getTime() / 1000
-    }
-	return (new Date).getTime() / 1000 - start_time;
+    return (new Date).getTime() - start_time;
 }
 
 // Exception
@@ -150,12 +142,12 @@ function ObjectManagerBase(controller) {
 }
 
 ObjectManagerBase.prototype.addEvent = function(the_event, time_offset) {
-	if (time_offset === undefined) time_offset = 0.0;
-	this.events.add(new EventQueueEntry(simulated_time + time_offset, the_event));
+	if (time_offset === undefined) time_offset = 0;
+	this.events.add(new EventQueueEntry(this.controller.simulated_time + time_offset, the_event));
 };
 
 ObjectManagerBase.prototype.broadcast = function(new_event, time_offset) {
-	if (time_offset === undefined) time_offset = 0.0;
+	if (time_offset === undefined) time_offset = 0;
 	for (var i in this.instances) {
 		if (!this.instances.hasOwnProperty(i)) continue;
 		this.instances[i].addEvent(new_event, time_offset);
@@ -176,7 +168,7 @@ ObjectManagerBase.prototype.stepAll = function() {
 	for (var i in this.instances) {
 		if (!this.instances.hasOwnProperty(i)) continue;
         var instance = this.instances[i];
-        if (instance.active) {
+        if (instance.active && (instance.getEarliestEventTime() <= this.controller.simulated_time || instance.eventlessTransitions())) {
             instance.step();
         }
 	}
@@ -426,6 +418,8 @@ ObjectManagerBase.prototype.createInstance = function(to_class, construct_params
 
 // Event
 function Event(name, port, parameters) {
+    if (port === undefined) port = "";
+    if (parameters === undefined) parameters = [];
 	this.name = name;
 	this.port = port;
 	this.parameters = parameters;
@@ -464,6 +458,12 @@ function ControllerBase(object_manager) {
     // keep track of output ports
 	this.output_ports = new Array();
 	this.output_listeners = new Array();
+
+    this.simulated_time = 0
+}
+
+ControllerBase.prototype.getSimulatedTime = function() {
+    return this.simulated_time
 }
 
 ControllerBase.prototype.addInputPort = function(virtual_name, instance) {
@@ -484,11 +484,12 @@ ControllerBase.prototype.addOutputPort = function(port_name) {
 };
 
 ControllerBase.prototype.broadcast = function(new_event, time_offset) {
-    if (time_offset === undefined) time_offset = 0.0
+    if (time_offset === undefined) time_offset = 0
 	this.object_manager.broadcast(new_event, time_offset);
 };
 
 ControllerBase.prototype.start = function() {
+    start_time = (new Date()).getTime();
 	this.object_manager.start();
 };
 
@@ -496,7 +497,7 @@ ControllerBase.prototype.stop = function() {
 };
 
 ControllerBase.prototype.addInput = function(input_event_list, time_offset) {
-    if (time_offset === undefined) time_offset = 0.0
+    if (time_offset === undefined) time_offset = 0
 	if (!(input_event_list instanceof Array)) {
 		input_event_list = [input_event_list];
     }
@@ -509,7 +510,7 @@ ControllerBase.prototype.addInput = function(input_event_list, time_offset) {
 		if (input_port === undefined) {
 			throw new InputException("Input port mismatch, no such port: " + input_event_list[e].port + ".");
 		}
-        this.input_queue.add(new EventQueueEntry(time() + time_offset, input_event_list[e]));
+        this.input_queue.add(new EventQueueEntry((this.simulated_time ? time() : 0) + time_offset, input_event_list[e]));
 	}
 };
 
@@ -519,15 +520,15 @@ ControllerBase.prototype.getEarliestEventTime = function() {
 
 ControllerBase.prototype.handleInput = function() {
 	var event_time = this.input_queue.getEarliestTime();
-	while (event_time <= simulated_time) {
+	while (event_time <= this.simulated_time) {
 		var e = this.input_queue.pop();
         input_port = this.input_ports[e.port];
         e.port = input_port.virtual_name
         var target_instance = input_port.instance;
         if (target_instance === undefined) {
-            this.broadcast(e, event_time - simulated_time);
+            this.broadcast(e, event_time - this.simulated_time);
         } else {
-            target_instance.addEvent(e, event_time - simulated_time);
+            target_instance.addEvent(e, event_time - this.simulated_time);
         }
         event_time = this.input_queue.getEarliestTime();
 	}
@@ -561,7 +562,7 @@ GameLoopControllerBase.prototype.update = function(delta) {
 	this.handleInput();
     earliest_event_time = this.getEarliestEventTime();
     if (earliest_event_time > time()) {
-        simulated_time = earliest_event_time;
+        this.simulated_time = earliest_event_time;
         this.object_manager.stepAll();
     }
 };
@@ -612,7 +613,8 @@ EventLoopControllerBase.prototype = new ControllerBase();
 EventLoopControllerBase.prototype.addInput = function(input_event, time_offset) {
 	ControllerBase.prototype.addInput.call(this, input_event, time_offset);
 	this.event_loop.clear();
-    this.set_time_and_run();
+    this.simulated_time = ControllerBase.prototype.getEarliestEventTime.call(this);
+    this.run();
 };
 
 EventLoopControllerBase.prototype.start = function() {
@@ -625,11 +627,6 @@ EventLoopControllerBase.prototype.stop = function() {
 	ControllerBase.prototype.stop.call(this);
 };
 
-EventLoopControllerBase.prototype.set_time_and_run = function() {
-    simulated_time = ControllerBase.prototype.getEarliestEventTime.call(this);
-    this.run();
-}
-
 EventLoopControllerBase.prototype.run = function() {
     var start_time = time();
 	while (true) {
@@ -645,15 +642,16 @@ EventLoopControllerBase.prototype.run = function() {
             return;
 		}
         var now = time();
-        if (now - start_time > 0.01 || earliest_event_time - now > 0.0) {
-            this.event_loop.schedule(this.set_time_and_run.bind(this), (earliest_event_time - now) * 1000, now - start_time > 0.05);
-            if (now - earliest_event_time > 0.1 && now - this.last_print_time >= 1) {
-                console.log('running ' + ((now - earliest_event_time) * 1000) + ' ms behind schedule');
+        if (now - start_time > 10 || earliest_event_time - now > 0.0) {
+            this.event_loop.schedule(this.run.bind(this), earliest_event_time - now, now - start_time > 10);
+            if (now - earliest_event_time > 10 && now - this.last_print_time >= 1) {
+                console.log('running ' + (now - earliest_event_time) + ' ms behind schedule');
                 this.last_print_time = now;
             }
-            return
+            this.simulated_time = earliest_event_time;
+            return;
         } else {
-            simulated_time = ControllerBase.prototype.getEarliestEventTime.call(this);
+            this.simulated_time = earliest_event_time;
         }
 	}
 };
@@ -711,6 +709,7 @@ function State(state_id, obj) {
     this.default_state = null;
     this.transitions = new Array();
     this.my_history = new Array();
+    this.has_eventless_transitions = false;
 }
 
 State.prototype.getEffectiveTargetStates = function() {
@@ -822,6 +821,7 @@ function Transition(obj, source, targets) {
     this.targets = targets;
     this.obj = obj;
     this.enabled_event = null; // the event that enabled this transition
+    this.optimize();
 }
 
 Transition.prototype.isEnabled = function(events) {
@@ -831,7 +831,7 @@ Transition.prototype.isEnabled = function(events) {
     } else {
         for (var i in events) {
             the_event = events[i];
-            if ((this.trigger === null || (this.trigger.name == the_event.name && this.trigger.port == the_event.port)) && (this.guard === null || this.guard(the_event.parameters))) {
+            if ((this.trigger === null || (this.trigger.name == the_event.name && (!this.trigger.port || this.trigger.port == the_event.port))) && (this.guard === null || this.guard(the_event.parameters))) {
                 this.enabled_event = the_event;
                 return true;
             }
@@ -944,6 +944,17 @@ Transition.prototype.setAction = function(action) {
     this.action = action.bind(this.obj);
 }
 
+Transition.prototype.setTrigger = function(trigger) {
+    this.trigger = trigger;
+    if (this.trigger === null) {
+        this.source.has_eventless_transitions = true;
+    }
+}
+
+Transition.prototype.optimize = function() {
+    // TODO: implement many optimizations
+}
+
 // RuntimeClassBase
 function RuntimeClassBase(controller) {
 	this.active = false;
@@ -958,6 +969,13 @@ function RuntimeClassBase(controller) {
 	this.semantics = new DefaultStatechartSemantics();
 }
 
+RuntimeClassBase.prototype.eventlessTransitions = function() {
+    for (let s of this.configuration) {
+        if (s.has_eventless_transitions) return true;
+    }
+    return false;
+}
+
 RuntimeClassBase.prototype.start = function() {
     this.configuration = new Array();
     
@@ -976,6 +994,10 @@ RuntimeClassBase.prototype.start = function() {
 	this.processBigStepOutput();
 };
 
+RuntimeClassBase.prototype.getSimulatedTime = function() {
+    return this.controller.simulated_time;
+}
+
 RuntimeClassBase.prototype.updateConfiguration = function(states) {
     this.configuration = states.slice(0);
 };
@@ -986,7 +1008,7 @@ RuntimeClassBase.prototype.stop = function() {
 };
 
 RuntimeClassBase.prototype.addTimer = function(index, timeout) {
-	this.timers[index] = this.events.add(new EventQueueEntry(simulated_time + timeout, new Event("_" + index + "after")));
+	this.timers[index] = this.events.add(new EventQueueEntry(this.controller.simulated_time + Math.trunc(timeout * 1000), new Event("_" + index + "after")));
 };
 
 RuntimeClassBase.prototype.removeTimer = function(index) {
@@ -995,8 +1017,8 @@ RuntimeClassBase.prototype.removeTimer = function(index) {
 };
 
 RuntimeClassBase.prototype.addEvent = function(event_list, time_offset) {
-	if (time_offset == undefined) time_offset = 0.0;
-    var event_time = simulated_time + time_offset;
+	if (time_offset == undefined) time_offset = 0;
+    var event_time = this.controller.simulated_time + time_offset;
     if (event_time < this.earliest_event_time) {
         this.earliest_event_time = event_time;
     }
@@ -1005,7 +1027,7 @@ RuntimeClassBase.prototype.addEvent = function(event_list, time_offset) {
 	}
     for (i in event_list) {
         if (!event_list.hasOwnProperty(i)) continue;
-        this.events.add(new EventQueueEntry(simulated_time + time_offset, event_list[i]));
+        this.events.add(new EventQueueEntry(this.controller.simulated_time + time_offset, event_list[i]));
     }
 };
 
@@ -1042,7 +1064,7 @@ RuntimeClassBase.prototype.step = function(delta) {
 	var is_stable = false;
     while (!is_stable) {
         var due = [];
-        if (this.events.getEarliestTime() <= simulated_time) {
+        if (this.events.getEarliestTime() <= this.controller.simulated_time) {
             due = [this.events.pop()];
         }
         is_stable = !this.bigStep(due);

+ 12 - 6
src/python_sccd/python_sccd_compiler/generic_generator.py

@@ -118,6 +118,7 @@ class GenericGenerator(Visitor):
         if self.platform == Platforms.EventLoop:
             self.writer.addFormalParameter("event_loop_callbacks")
             self.writer.addFormalParameter("finished_callback", GLC.NoneExpression())
+            self.writer.addFormalParameter("behind_schedule_callback", GLC.NoneExpression())
         elif self.platform == Platforms.Threads:
             self.writer.addFormalParameter("keep_running", GLC.TrueExpression())
         self.writer.beginMethodBody()
@@ -126,6 +127,7 @@ class GenericGenerator(Visitor):
         if self.platform == Platforms.EventLoop:
             self.writer.addActualParameter("event_loop_callbacks")
             self.writer.addActualParameter("finished_callback")
+            self.writer.addActualParameter("behind_schedule_callback")
         elif self.platform == Platforms.Threads:
             self.writer.addActualParameter("keep_running")
         self.writer.endSuperClassConstructorCall()
@@ -575,13 +577,17 @@ class GenericGenerator(Visitor):
                     trigger = GLC.NewExpression("Event", [GLC.String("_%iafter" % (t.trigger.getAfterIndex()))])
                 elif t.trigger.event:
                     trigger = GLC.NewExpression("Event", [GLC.String(t.trigger.event), GLC.NoneExpression() if t.trigger.port is None else GLC.String(t.trigger.port)])
+                else:
+                    trigger = GLC.NoneExpression()
                 if trigger:
-                    self.writer.addAssignment(
-                        GLC.Property(
-                            "%s_%i" % (s.friendly_name, i),
-                            "trigger"
-                        ),
-                        trigger
+                    self.writer.add(
+                        GLC.FunctionCall(
+                            GLC.Property(
+                                "%s_%i" % (s.friendly_name, i),
+                                "setTrigger"
+                            ),
+                            [trigger]
+                        )
                     )
                 # if any guard associated with transition: set guard to correct function (generated later)
                 if t.guard:

+ 5 - 6
src/python_sccd/python_sccd_runtime/accurate_time.py

@@ -2,14 +2,13 @@ import time as t
 import os
 
 global start_time
-start_time = None
+def set_start_time():
+    global start_time
+    start_time = t.time()
 
 if os.name == 'posix':
     def time():
-        global start_time
-        if start_time is None:
-            start_time = t.time()
-        return t.time() - start_time
+        return int((t.time() - start_time) * 1000)
 elif os.name == 'nt':
     def time():
-        return t.clock()
+        return int(t.clock() * 1000)

+ 1 - 1
src/python_sccd/python_sccd_runtime/event_queue.py

@@ -15,7 +15,7 @@ class EventQueue(object):
     
     def add(self, event):
         self.event_list.append(event)
-        self.event_list.sort()
+        self.event_list.sort(key=lambda i: i[0])
         return id(event)
     
     def remove(self, event_id):

+ 61 - 47
src/python_sccd/python_sccd_runtime/statecharts_core.py

@@ -7,13 +7,7 @@ from infinity import INFINITY
 from Queue import Queue, Empty
 
 from sccd.runtime.event_queue import EventQueue
-from sccd.runtime.accurate_time import time
-
-global simulated_time
-simulated_time = 0.0
-def get_simulated_time():
-    global simulated_time
-    return simulated_time
+from sccd.runtime.accurate_time import time, set_start_time
 
 class RuntimeException(Exception):
     def __init__(self, message):
@@ -85,11 +79,11 @@ class ObjectManagerBase(object):
         self.events = EventQueue()
         self.instances = set() # a set of RuntimeClassBase instances
         
-    def addEvent(self, event, time_offset = 0.0):
-        self.events.add((simulated_time + time_offset, event))
+    def addEvent(self, event, time_offset = 0):
+        self.events.add((self.controller.simulated_time + time_offset, event))
         
     # broadcast an event to all instances
-    def broadcast(self, new_event, time_offset = 0.0):
+    def broadcast(self, new_event, time_offset = 0):
         for i in self.instances:
             i.addEvent(new_event, time_offset)
         
@@ -104,7 +98,7 @@ class ObjectManagerBase(object):
     def stepAll(self):
         self.step()
         for i in self.instances:
-            if i.active:
+            if i.active and (i.getEarliestEventTime() <= self.controller.simulated_time or i.eventlessTransitions()):
                 i.step()
 
     def step(self):
@@ -170,14 +164,14 @@ class ObjectManagerBase(object):
         association_name = parameters[1]
         
         association = source.associations[association_name]
-        #association = self.instances_map[source].getAssociation(association_name)
+        # association = self.instances_map[source].getAssociation(association_name)
         if association.allowedToAdd() :
             ''' allow subclasses to be instantiated '''
             class_name = association.to_class if len(parameters) == 2 else parameters[2]
             new_instance = self.createInstance(class_name, parameters[3:])
             if not new_instance:
                 raise ParameterException("Creating instance: no such class: " + class_name)
-            #index = association.addInstance(new_instance)
+            # index = association.addInstance(new_instance)
             try:
                 index = association.addInstance(new_instance)
             except AssociationException as exception:
@@ -197,7 +191,7 @@ class ObjectManagerBase(object):
             association_name = parameters[1]
             traversal_list = self.processAssociationReference(association_name)
             instances = self.getInstances(source, traversal_list)
-            #association = self.instances_map[source].getAssociation(traversal_list[0][0])
+            # association = self.instances_map[source].getAssociation(traversal_list[0][0])
             association = source.associations[traversal_list[0][0]]
             for i in instances:
                 try:
@@ -206,7 +200,7 @@ class ObjectManagerBase(object):
                 except AssociationException as exception:
                     raise RuntimeException("Error removing instance from association '" + association_name + "': " + str(exception))
                 i["instance"].stop()
-                #if hasattr(i.instance, 'user_defined_destructor'):
+                # if hasattr(i.instance, 'user_defined_destructor'):
                 i["instance"].user_defined_destructor()
             source.addEvent(Event("instance_deleted", parameters = [parameters[1]]))
                 
@@ -245,7 +239,7 @@ class ObjectManagerBase(object):
             "assoc_name" : None,
             "assoc_index" : None
         }]
-        #currents = [source]
+        # currents = [source]
         for (name, index) in traversal_list :
             nexts = []
             for current in currents :
@@ -333,6 +327,7 @@ class InputPortEntry(object):
         
 class ControllerBase(object):
     def __init__(self, object_manager):
+    
         self.object_manager = object_manager
 
         self.private_port_counter = 0
@@ -345,7 +340,10 @@ class ControllerBase(object):
         self.output_ports = []
         self.output_listeners = []
         
-        self.started = False
+        self.simulated_time = 0
+        
+    def getSimulatedTime(self):
+        return self.simulated_time
             
     def addInputPort(self, virtual_name, instance = None):
         if instance == None :
@@ -359,17 +357,17 @@ class ControllerBase(object):
     def addOutputPort(self, port_name):
         self.output_ports.append(port_name)
 
-    def broadcast(self, new_event, time_offset = 0.0):
+    def broadcast(self, new_event, time_offset = 0):
         self.object_manager.broadcast(new_event, time_offset)
         
     def start(self):
-        self.started = True
+        set_start_time()
         self.object_manager.start()
     
     def stop(self):
         pass
 
-    def addInput(self, input_event_list, time_offset = 0.0):
+    def addInput(self, input_event_list, time_offset = 0):
         if not isinstance(input_event_list, list):
             input_event_list = [input_event_list]
 
@@ -380,7 +378,7 @@ class ControllerBase(object):
             if e.getPort() not in self.input_ports :
                 raise InputException("Input port mismatch, no such port: " + e.getPort() + ".")
             
-            self.input_queue.add((time() + time_offset, e))
+            self.input_queue.add(((time() if self.simulated_time else 0) + time_offset, e))
 
     def getEarliestEventTime(self):
         return min(self.object_manager.getEarliestEventTime(), self.input_queue.getEarliestTime())
@@ -393,9 +391,9 @@ class ControllerBase(object):
             e.port = input_port.virtual_name
             target_instance = input_port.instance
             if target_instance == None:
-                self.broadcast(e, event_time - simulated_time)
+                self.broadcast(e, event_time - self.simulated_time)
             else:
-                target_instance.addEvent(e, event_time - simulated_time)
+                target_instance.addEvent(e, event_time - self.simulated_time)
 
     def outputEvent(self, event):
         for listener in self.output_listeners :
@@ -420,8 +418,7 @@ class GameLoopControllerBase(ControllerBase):
         self.handleInput()
         earliest_event_time = self.getEarliestEventTime()
         if earliest_event_time > time():
-            global simulated_time
-            simulated_time = earliest_event_time
+            self.simulated_time = earliest_event_time
             self.object_manager.stepAll()
 
 class EventLoop:
@@ -457,18 +454,18 @@ class EventLoop:
             self.scheduled_id = None
 
 class EventLoopControllerBase(ControllerBase):
-    def __init__(self, object_manager, event_loop, finished_callback = None):
+    def __init__(self, object_manager, event_loop, finished_callback = None, behind_schedule_callback = None):
         ControllerBase.__init__(self, object_manager)
         self.event_loop = event_loop
         self.finished_callback = finished_callback
+        self.behind_schedule_callback = behind_schedule_callback
         self.last_print_time = 0.0
         self.behind = False
 
-    def addInput(self, input_event, time_offset = 0.0):
+    def addInput(self, input_event, time_offset = 0):
         ControllerBase.addInput(self, input_event, time_offset)
         self.event_loop.clear()
-        global simulated_time
-        simulated_time = self.getEarliestEventTime()
+        self.simulated_time = self.getEarliestEventTime()
         self.run()
 
     def start(self):
@@ -480,7 +477,6 @@ class EventLoopControllerBase(ControllerBase):
         ControllerBase.stop(self)
 
     def run(self):
-        global simulated_time
         start_time = time()
         while 1:
             # clear existing timeout
@@ -494,19 +490,21 @@ class EventLoopControllerBase(ControllerBase):
                 if self.finished_callback: self.finished_callback() # TODO: This is not necessarily correct (keep_running necessary?)
                 return
             now = time()
-            if now - start_time > 0.01 or earliest_event_time - now > 0.0:
-                self.event_loop.schedule(self.run, earliest_event_time - now, now - start_time > 0.01)
-                if now - earliest_event_time > 0.1 and now - self.last_print_time >= 1:
-                    print '\rrunning %ims behind schedule' % ((now - earliest_event_time) * 1000),
+            if now - start_time > 10 or earliest_event_time - now > 0:
+                self.event_loop.schedule(self.run, earliest_event_time - now, now - start_time > 10)
+                if now - earliest_event_time > 10 and now - self.last_print_time >= 1:
+                    if self.behind_schedule_callback:
+                        self.behind_schedule_callback(self, now - earliest_event_time)
+                    print '\rrunning %ims behind schedule' % (now - earliest_event_time),
                     self.last_print_time = now
                     self.behind = True
-                elif now - earliest_event_time < 0.1 and self.behind:
+                elif now - earliest_event_time < 10 and self.behind:
                     print '\r' + ' ' * 80,
                     self.behind = False
-                simulated_time = earliest_event_time
+                self.simulated_time = earliest_event_time
                 return
             else:
-                simulated_time = earliest_event_time
+                self.simulated_time = earliest_event_time
         
 class ThreadsControllerBase(ControllerBase):
     def __init__(self, object_manager, keep_running):
@@ -515,7 +513,7 @@ class ThreadsControllerBase(ControllerBase):
         self.input_condition = threading.Condition()
         self.stop_thread = False
 
-    def addInput(self, input_event, time_offset = 0.0):
+    def addInput(self, input_event, time_offset = 0):
         with self.input_condition:
             ControllerBase.addInput(self, input_event, time_offset)
             self.input_condition.notifyAll()
@@ -545,7 +543,7 @@ class ThreadsControllerBase(ControllerBase):
             if earliest_event_time == INFINITY and not self.keep_running:
                 return
             with self.input_condition:
-                self.input_condition.wait(earliest_event_time - time())
+                self.input_condition.wait((earliest_event_time - time()) / 1000.0)
             earliest_event_time = self.getEarliestEventTime()
             if earliest_event_time == INFINITY:
                 if self.keep_running:
@@ -556,8 +554,7 @@ class ThreadsControllerBase(ControllerBase):
             if self.stop_thread:
                 break
             earliest_event_time = self.getEarliestEventTime()
-            global simulated_time
-            simulated_time = earliest_event_time
+            self.simulated_time = earliest_event_time
 
 class StatechartSemantics:
     # Big Step Maximality
@@ -604,6 +601,7 @@ class State:
         self.default_state = None
         self.transitions = []
         self.history = []
+        self.has_eventless_transitions = False
         
     def getEffectiveTargetStates(self):
         targets = [self]
@@ -699,6 +697,7 @@ class Transition:
         self.targets = targets
         self.obj = obj
         self.enabled_event = None # the event that enabled this transition
+        self.optimize()
     
     def isEnabled(self, events):
         if self.trigger is None:
@@ -706,7 +705,7 @@ class Transition:
             return (self.guard is None) or self.guard([])
         else:
             for event in events:
-                if ((self.trigger is None) or (self.trigger.name == event.name and self.trigger.port == event.port)) and ((self.guard is None) or self.guard(event.parameters)):
+                if ((self.trigger is None) or (self.trigger.name == event.name and (not self.trigger.port or self.trigger.port == event.port))) and ((self.guard is None) or self.guard(event.parameters)):
                     self.enabled_event = event
                     return True
     
@@ -775,13 +774,22 @@ class Transition:
             yield target
     
     def conflicts(self, transition):
-        return self.__exitSet() & transition.__exitSet()
+        return self.__exitSet(self.__getEffectiveTargetStates()) & transition.__exitSet(transition.__getEffectiveTargetStates())
         
     def setGuard(self, guard):
         self.guard = guard
         
     def setAction(self, action):
         self.action = action
+    
+    def setTrigger(self, trigger):
+        self.trigger = trigger
+        if self.trigger is None:
+            self.source.has_eventless_transitions = True
+        
+    def optimize(self):
+        # TODO: many optimizations.
+        pass
         
     def __repr__(self):
         return "Transition(%i, %s)" % (self.source.state_id, [target.state_id for target in self.targets])
@@ -817,6 +825,12 @@ class RuntimeClassBase(object):
 
         self.initializeStatechart()
         self.processBigStepOutput()
+        
+    def getSimulatedTime(self):
+        return self.controller.simulated_time
+        
+    def eventlessTransitions(self):
+        return sum(map(lambda x: x.has_eventless_transitions, self.configuration))
     
     def updateConfiguration(self, states):
         self.configuration.extend(states)
@@ -826,14 +840,14 @@ class RuntimeClassBase(object):
         self.__set_stable(True)
     
     def addTimer(self, index, timeout):
-        self.timers[index] = self.events.add((simulated_time + timeout, Event("_%iafter" % index)))
+        self.timers[index] = self.events.add((self.controller.simulated_time + int(timeout * 1000), Event("_%iafter" % index)))
     
     def removeTimer(self, index):
         self.events.remove(self.timers[index])
         del self.timers[index]
         
-    def addEvent(self, event_list, time_offset = 0.0):
-        event_time = simulated_time + time_offset
+    def addEvent(self, event_list, time_offset = 0):
+        event_time = self.controller.simulated_time + time_offset
         if event_time < self.earliest_event_time:
             self.earliest_event_time = event_time
         if not isinstance(event_list, list):
@@ -864,7 +878,7 @@ class RuntimeClassBase(object):
         is_stable = False
         while not is_stable:
             due = []
-            if self.events.getEarliestTime() <= simulated_time:
+            if self.events.getEarliestTime() <= self.controller.simulated_time:
                 due = [self.events.pop()]
             is_stable = not self.bigStep(due)
             self.processBigStepOutput()

+ 1 - 1
src/python_sccd/python_sccd_runtime/tkinter_eventloop.py

@@ -11,7 +11,7 @@ class TkEventLoop(EventLoop):
         def schedule(callback, timeout, behind = False):
             if behind:
                 tk.update_idletasks()
-            return tk.after(int(math.ceil(timeout * 1000.0)), callback)
+            return tk.after(timeout, callback)
 
         EventLoop.__init__(self, schedule, tk.after_cancel)
 

+ 1 - 1
test/run_tests.py

@@ -23,7 +23,7 @@ class PyTestCase(unittest.TestCase):
 
         if inputs:
             for i in inputs:
-                controller.addInput(Event(i.name, i.port, i.parameters), i.time_offset)
+                controller.addInput(Event(i.name, i.port, i.parameters), int(i.time_offset * 1000))
 
         if not expected:
             controller.start()

+ 6 - 3
test/target_js/big_step_maximality/00_take_one.js

@@ -1,6 +1,6 @@
 /* Generated by Statechart compiler by Glenn De Jonghe, Joeri Exelmans, Simon Van Mierlo, and Yentl Van Tendeloo (for the inspiration)
 
-Date:   Thu Aug 04 12:50:57 2016
+Date:   Fri Aug 05 16:13:26 2016
 
 Model author: Herr Joeri Exelmans
 Model name:   take_one
@@ -69,10 +69,12 @@ c.prototype.build_statechart_structure = function() {
     
     // transition /a
     var _a_0 = new Transition(this, this.states["/a"], [this.states["/b"]]);
+    _a_0.setTrigger(null);
     this.states["/a"].addTransition(_a_0);
     
     // transition /b
     var _b_0 = new Transition(this, this.states["/b"], [this.states["/c"]]);
+    _b_0.setTrigger(null);
     this.states["/b"].addTransition(_b_0);
 };
 
@@ -128,9 +130,10 @@ ObjectManager.prototype.instantiate = function(class_name, construct_params) {
 // add symbol 'ObjectManager' to package 'take_one'
 take_one.ObjectManager = ObjectManager;
 
-var Controller = function(event_loop_callbacks, finished_callback) {
+var Controller = function(event_loop_callbacks, finished_callback, behind_schedule_callback) {
     if (finished_callback === undefined) finished_callback = null;
-    EventLoopControllerBase.call(this, new ObjectManager(this), event_loop_callbacks, finished_callback);
+    if (behind_schedule_callback === undefined) behind_schedule_callback = null;
+    EventLoopControllerBase.call(this, new ObjectManager(this), event_loop_callbacks, finished_callback, behind_schedule_callback);
     this.addInputPort("in");
     this.addOutputPort("out");
     this.object_manager.createInstance("c", new Array());

+ 6 - 3
test/target_js/big_step_maximality/01_take_many.js

@@ -1,6 +1,6 @@
 /* Generated by Statechart compiler by Glenn De Jonghe, Joeri Exelmans, Simon Van Mierlo, and Yentl Van Tendeloo (for the inspiration)
 
-Date:   Thu Aug 04 12:50:58 2016
+Date:   Fri Aug 05 16:13:26 2016
 
 Model author: Herr Joeri Exelmans
 Model name:   take_many
@@ -69,10 +69,12 @@ c.prototype.build_statechart_structure = function() {
     
     // transition /a
     var _a_0 = new Transition(this, this.states["/a"], [this.states["/b"]]);
+    _a_0.setTrigger(null);
     this.states["/a"].addTransition(_a_0);
     
     // transition /b
     var _b_0 = new Transition(this, this.states["/b"], [this.states["/c"]]);
+    _b_0.setTrigger(null);
     this.states["/b"].addTransition(_b_0);
 };
 
@@ -128,9 +130,10 @@ ObjectManager.prototype.instantiate = function(class_name, construct_params) {
 // add symbol 'ObjectManager' to package 'take_many'
 take_many.ObjectManager = ObjectManager;
 
-var Controller = function(event_loop_callbacks, finished_callback) {
+var Controller = function(event_loop_callbacks, finished_callback, behind_schedule_callback) {
     if (finished_callback === undefined) finished_callback = null;
-    EventLoopControllerBase.call(this, new ObjectManager(this), event_loop_callbacks, finished_callback);
+    if (behind_schedule_callback === undefined) behind_schedule_callback = null;
+    EventLoopControllerBase.call(this, new ObjectManager(this), event_loop_callbacks, finished_callback, behind_schedule_callback);
     this.addInputPort("in");
     this.addOutputPort("out");
     this.object_manager.createInstance("c", new Array());

+ 8 - 3
test/target_js/big_step_maximality/10_orthogonal_take_one.js

@@ -1,6 +1,6 @@
 /* Generated by Statechart compiler by Glenn De Jonghe, Joeri Exelmans, Simon Van Mierlo, and Yentl Van Tendeloo (for the inspiration)
 
-Date:   Thu Aug 04 12:50:58 2016
+Date:   Fri Aug 05 16:13:26 2016
 
 Model author: Herr Joeri Exelmans
 Model name:   orthogonal_take_one
@@ -98,18 +98,22 @@ c.prototype.build_statechart_structure = function() {
     
     // transition /p/o0/sa
     var _p_o0_sa_0 = new Transition(this, this.states["/p/o0/sa"], [this.states["/p/o0/sb"]]);
+    _p_o0_sa_0.setTrigger(null);
     this.states["/p/o0/sa"].addTransition(_p_o0_sa_0);
     
     // transition /p/o0/sb
     var _p_o0_sb_0 = new Transition(this, this.states["/p/o0/sb"], [this.states["/p/o0/sc"]]);
+    _p_o0_sb_0.setTrigger(null);
     this.states["/p/o0/sb"].addTransition(_p_o0_sb_0);
     
     // transition /p/o1/sd
     var _p_o1_sd_0 = new Transition(this, this.states["/p/o1/sd"], [this.states["/p/o1/se"]]);
+    _p_o1_sd_0.setTrigger(null);
     this.states["/p/o1/sd"].addTransition(_p_o1_sd_0);
     
     // transition /p/o1/se
     var _p_o1_se_0 = new Transition(this, this.states["/p/o1/se"], [this.states["/p/o1/sf"]]);
+    _p_o1_se_0.setTrigger(null);
     this.states["/p/o1/se"].addTransition(_p_o1_se_0);
 };
 
@@ -177,9 +181,10 @@ ObjectManager.prototype.instantiate = function(class_name, construct_params) {
 // add symbol 'ObjectManager' to package 'orthogonal_take_one'
 orthogonal_take_one.ObjectManager = ObjectManager;
 
-var Controller = function(event_loop_callbacks, finished_callback) {
+var Controller = function(event_loop_callbacks, finished_callback, behind_schedule_callback) {
     if (finished_callback === undefined) finished_callback = null;
-    EventLoopControllerBase.call(this, new ObjectManager(this), event_loop_callbacks, finished_callback);
+    if (behind_schedule_callback === undefined) behind_schedule_callback = null;
+    EventLoopControllerBase.call(this, new ObjectManager(this), event_loop_callbacks, finished_callback, behind_schedule_callback);
     this.addInputPort("in");
     this.addOutputPort("out");
     this.object_manager.createInstance("c", new Array());

+ 8 - 3
test/target_js/big_step_maximality/11_orthogonal_take_many.js

@@ -1,6 +1,6 @@
 /* Generated by Statechart compiler by Glenn De Jonghe, Joeri Exelmans, Simon Van Mierlo, and Yentl Van Tendeloo (for the inspiration)
 
-Date:   Thu Aug 04 12:50:58 2016
+Date:   Fri Aug 05 16:13:26 2016
 
 Model author: Herr Joeri Exelmans
 Model name:   orthogonal_take_many
@@ -98,18 +98,22 @@ c.prototype.build_statechart_structure = function() {
     
     // transition /p/o0/sa
     var _p_o0_sa_0 = new Transition(this, this.states["/p/o0/sa"], [this.states["/p/o0/sb"]]);
+    _p_o0_sa_0.setTrigger(null);
     this.states["/p/o0/sa"].addTransition(_p_o0_sa_0);
     
     // transition /p/o0/sb
     var _p_o0_sb_0 = new Transition(this, this.states["/p/o0/sb"], [this.states["/p/o0/sc"]]);
+    _p_o0_sb_0.setTrigger(null);
     this.states["/p/o0/sb"].addTransition(_p_o0_sb_0);
     
     // transition /p/o1/sd
     var _p_o1_sd_0 = new Transition(this, this.states["/p/o1/sd"], [this.states["/p/o1/se"]]);
+    _p_o1_sd_0.setTrigger(null);
     this.states["/p/o1/sd"].addTransition(_p_o1_sd_0);
     
     // transition /p/o1/se
     var _p_o1_se_0 = new Transition(this, this.states["/p/o1/se"], [this.states["/p/o1/sf"]]);
+    _p_o1_se_0.setTrigger(null);
     this.states["/p/o1/se"].addTransition(_p_o1_se_0);
 };
 
@@ -177,9 +181,10 @@ ObjectManager.prototype.instantiate = function(class_name, construct_params) {
 // add symbol 'ObjectManager' to package 'orthogonal_take_many'
 orthogonal_take_many.ObjectManager = ObjectManager;
 
-var Controller = function(event_loop_callbacks, finished_callback) {
+var Controller = function(event_loop_callbacks, finished_callback, behind_schedule_callback) {
     if (finished_callback === undefined) finished_callback = null;
-    EventLoopControllerBase.call(this, new ObjectManager(this), event_loop_callbacks, finished_callback);
+    if (behind_schedule_callback === undefined) behind_schedule_callback = null;
+    EventLoopControllerBase.call(this, new ObjectManager(this), event_loop_callbacks, finished_callback, behind_schedule_callback);
     this.addInputPort("in");
     this.addOutputPort("out");
     this.object_manager.createInstance("c", new Array());

+ 6 - 5
test/target_js/event_lifeline/00_take_one_next_small_step.js

@@ -1,6 +1,6 @@
 /* Generated by Statechart compiler by Glenn De Jonghe, Joeri Exelmans, Simon Van Mierlo, and Yentl Van Tendeloo (for the inspiration)
 
-Date:   Thu Aug 04 12:50:58 2016
+Date:   Fri Aug 05 16:13:26 2016
 
 Model author: Herr Joeri Exelmans
 Model name:   take_one_next_small_step
@@ -70,12 +70,12 @@ c.prototype.build_statechart_structure = function() {
     // transition /a
     var _a_0 = new Transition(this, this.states["/a"], [this.states["/b"]]);
     _a_0.setAction(this._a_0_exec);
-    _a_0.trigger = new Event("e", "in");
+    _a_0.setTrigger(new Event("e", "in"));
     this.states["/a"].addTransition(_a_0);
     
     // transition /b
     var _b_0 = new Transition(this, this.states["/b"], [this.states["/c"]]);
-    _b_0.trigger = new Event("f", null);
+    _b_0.setTrigger(new Event("f", null));
     this.states["/b"].addTransition(_b_0);
 };
 
@@ -135,9 +135,10 @@ ObjectManager.prototype.instantiate = function(class_name, construct_params) {
 // add symbol 'ObjectManager' to package 'take_one_next_small_step'
 take_one_next_small_step.ObjectManager = ObjectManager;
 
-var Controller = function(event_loop_callbacks, finished_callback) {
+var Controller = function(event_loop_callbacks, finished_callback, behind_schedule_callback) {
     if (finished_callback === undefined) finished_callback = null;
-    EventLoopControllerBase.call(this, new ObjectManager(this), event_loop_callbacks, finished_callback);
+    if (behind_schedule_callback === undefined) behind_schedule_callback = null;
+    EventLoopControllerBase.call(this, new ObjectManager(this), event_loop_callbacks, finished_callback, behind_schedule_callback);
     this.addInputPort("in");
     this.addOutputPort("out");
     this.object_manager.createInstance("c", new Array());

+ 6 - 5
test/target_js/event_lifeline/02_take_one_queue.js

@@ -1,6 +1,6 @@
 /* Generated by Statechart compiler by Glenn De Jonghe, Joeri Exelmans, Simon Van Mierlo, and Yentl Van Tendeloo (for the inspiration)
 
-Date:   Thu Aug 04 12:50:58 2016
+Date:   Fri Aug 05 16:13:26 2016
 
 Model author: Herr Joeri Exelmans
 Model name:   take_one_queue
@@ -70,12 +70,12 @@ c.prototype.build_statechart_structure = function() {
     // transition /a
     var _a_0 = new Transition(this, this.states["/a"], [this.states["/b"]]);
     _a_0.setAction(this._a_0_exec);
-    _a_0.trigger = new Event("e", "in");
+    _a_0.setTrigger(new Event("e", "in"));
     this.states["/a"].addTransition(_a_0);
     
     // transition /b
     var _b_0 = new Transition(this, this.states["/b"], [this.states["/c"]]);
-    _b_0.trigger = new Event("f", null);
+    _b_0.setTrigger(new Event("f", null));
     this.states["/b"].addTransition(_b_0);
 };
 
@@ -135,9 +135,10 @@ ObjectManager.prototype.instantiate = function(class_name, construct_params) {
 // add symbol 'ObjectManager' to package 'take_one_queue'
 take_one_queue.ObjectManager = ObjectManager;
 
-var Controller = function(event_loop_callbacks, finished_callback) {
+var Controller = function(event_loop_callbacks, finished_callback, behind_schedule_callback) {
     if (finished_callback === undefined) finished_callback = null;
-    EventLoopControllerBase.call(this, new ObjectManager(this), event_loop_callbacks, finished_callback);
+    if (behind_schedule_callback === undefined) behind_schedule_callback = null;
+    EventLoopControllerBase.call(this, new ObjectManager(this), event_loop_callbacks, finished_callback, behind_schedule_callback);
     this.addInputPort("in");
     this.addOutputPort("out");
     this.object_manager.createInstance("c", new Array());

+ 6 - 5
test/target_js/event_lifeline/10_take_many_next_small_step.js

@@ -1,6 +1,6 @@
 /* Generated by Statechart compiler by Glenn De Jonghe, Joeri Exelmans, Simon Van Mierlo, and Yentl Van Tendeloo (for the inspiration)
 
-Date:   Thu Aug 04 12:50:58 2016
+Date:   Fri Aug 05 16:13:27 2016
 
 Model author: Herr Joeri Exelmans
 Model name:   take_many_next_small_step
@@ -70,12 +70,12 @@ c.prototype.build_statechart_structure = function() {
     // transition /a
     var _a_0 = new Transition(this, this.states["/a"], [this.states["/b"]]);
     _a_0.setAction(this._a_0_exec);
-    _a_0.trigger = new Event("e", "in");
+    _a_0.setTrigger(new Event("e", "in"));
     this.states["/a"].addTransition(_a_0);
     
     // transition /b
     var _b_0 = new Transition(this, this.states["/b"], [this.states["/c"]]);
-    _b_0.trigger = new Event("f", null);
+    _b_0.setTrigger(new Event("f", null));
     this.states["/b"].addTransition(_b_0);
 };
 
@@ -135,9 +135,10 @@ ObjectManager.prototype.instantiate = function(class_name, construct_params) {
 // add symbol 'ObjectManager' to package 'take_many_next_small_step'
 take_many_next_small_step.ObjectManager = ObjectManager;
 
-var Controller = function(event_loop_callbacks, finished_callback) {
+var Controller = function(event_loop_callbacks, finished_callback, behind_schedule_callback) {
     if (finished_callback === undefined) finished_callback = null;
-    EventLoopControllerBase.call(this, new ObjectManager(this), event_loop_callbacks, finished_callback);
+    if (behind_schedule_callback === undefined) behind_schedule_callback = null;
+    EventLoopControllerBase.call(this, new ObjectManager(this), event_loop_callbacks, finished_callback, behind_schedule_callback);
     this.addInputPort("in");
     this.addOutputPort("out");
     this.object_manager.createInstance("c", new Array());

+ 6 - 5
test/target_js/event_lifeline/11_take_many_next_combo_step.js

@@ -1,6 +1,6 @@
 /* Generated by Statechart compiler by Glenn De Jonghe, Joeri Exelmans, Simon Van Mierlo, and Yentl Van Tendeloo (for the inspiration)
 
-Date:   Thu Aug 04 12:50:59 2016
+Date:   Fri Aug 05 16:13:27 2016
 
 Model author: Herr Joeri Exelmans
 Model name:   take_many_next_combo_step
@@ -70,12 +70,12 @@ c.prototype.build_statechart_structure = function() {
     // transition /a
     var _a_0 = new Transition(this, this.states["/a"], [this.states["/b"]]);
     _a_0.setAction(this._a_0_exec);
-    _a_0.trigger = new Event("e", "in");
+    _a_0.setTrigger(new Event("e", "in"));
     this.states["/a"].addTransition(_a_0);
     
     // transition /b
     var _b_0 = new Transition(this, this.states["/b"], [this.states["/c"]]);
-    _b_0.trigger = new Event("f", null);
+    _b_0.setTrigger(new Event("f", null));
     this.states["/b"].addTransition(_b_0);
 };
 
@@ -135,9 +135,10 @@ ObjectManager.prototype.instantiate = function(class_name, construct_params) {
 // add symbol 'ObjectManager' to package 'take_many_next_combo_step'
 take_many_next_combo_step.ObjectManager = ObjectManager;
 
-var Controller = function(event_loop_callbacks, finished_callback) {
+var Controller = function(event_loop_callbacks, finished_callback, behind_schedule_callback) {
     if (finished_callback === undefined) finished_callback = null;
-    EventLoopControllerBase.call(this, new ObjectManager(this), event_loop_callbacks, finished_callback);
+    if (behind_schedule_callback === undefined) behind_schedule_callback = null;
+    EventLoopControllerBase.call(this, new ObjectManager(this), event_loop_callbacks, finished_callback, behind_schedule_callback);
     this.addInputPort("in");
     this.addOutputPort("out");
     this.object_manager.createInstance("c", new Array());

+ 6 - 5
test/target_js/event_lifeline/12_take_many_queue.js

@@ -1,6 +1,6 @@
 /* Generated by Statechart compiler by Glenn De Jonghe, Joeri Exelmans, Simon Van Mierlo, and Yentl Van Tendeloo (for the inspiration)
 
-Date:   Thu Aug 04 12:50:59 2016
+Date:   Fri Aug 05 16:13:27 2016
 
 Model author: Herr Joeri Exelmans
 Model name:   take_many_queue
@@ -70,12 +70,12 @@ c.prototype.build_statechart_structure = function() {
     // transition /a
     var _a_0 = new Transition(this, this.states["/a"], [this.states["/b"]]);
     _a_0.setAction(this._a_0_exec);
-    _a_0.trigger = new Event("e", "in");
+    _a_0.setTrigger(new Event("e", "in"));
     this.states["/a"].addTransition(_a_0);
     
     // transition /b
     var _b_0 = new Transition(this, this.states["/b"], [this.states["/c"]]);
-    _b_0.trigger = new Event("f", null);
+    _b_0.setTrigger(new Event("f", null));
     this.states["/b"].addTransition(_b_0);
 };
 
@@ -135,9 +135,10 @@ ObjectManager.prototype.instantiate = function(class_name, construct_params) {
 // add symbol 'ObjectManager' to package 'take_many_queue'
 take_many_queue.ObjectManager = ObjectManager;
 
-var Controller = function(event_loop_callbacks, finished_callback) {
+var Controller = function(event_loop_callbacks, finished_callback, behind_schedule_callback) {
     if (finished_callback === undefined) finished_callback = null;
-    EventLoopControllerBase.call(this, new ObjectManager(this), event_loop_callbacks, finished_callback);
+    if (behind_schedule_callback === undefined) behind_schedule_callback = null;
+    EventLoopControllerBase.call(this, new ObjectManager(this), event_loop_callbacks, finished_callback, behind_schedule_callback);
     this.addInputPort("in");
     this.addOutputPort("out");
     this.object_manager.createInstance("c", new Array());

+ 8 - 6
test/target_js/event_lifeline/20_orthogonal_take_one_next_small_step.js

@@ -1,6 +1,6 @@
 /* Generated by Statechart compiler by Glenn De Jonghe, Joeri Exelmans, Simon Van Mierlo, and Yentl Van Tendeloo (for the inspiration)
 
-Date:   Thu Aug 04 12:50:59 2016
+Date:   Fri Aug 05 16:13:27 2016
 
 Model author: Herr Joeri Exelmans
 Model name:   orthogonal_take_one_next_small_step
@@ -96,22 +96,23 @@ c.prototype.build_statechart_structure = function() {
     // transition /p/o0/sa
     var _p_o0_sa_0 = new Transition(this, this.states["/p/o0/sa"], [this.states["/p/o0/sb"]]);
     _p_o0_sa_0.setAction(this._p_o0_sa_0_exec);
-    _p_o0_sa_0.trigger = new Event("f", null);
+    _p_o0_sa_0.setTrigger(new Event("f", null));
     this.states["/p/o0/sa"].addTransition(_p_o0_sa_0);
     
     // transition /p/o0/sb
     var _p_o0_sb_0 = new Transition(this, this.states["/p/o0/sb"], [this.states["/p/o0/sa"]]);
+    _p_o0_sb_0.setTrigger(null);
     this.states["/p/o0/sb"].addTransition(_p_o0_sb_0);
     
     // transition /p/o1/sc
     var _p_o1_sc_0 = new Transition(this, this.states["/p/o1/sc"], [this.states["/p/o1/sd"]]);
     _p_o1_sc_0.setAction(this._p_o1_sc_0_exec);
-    _p_o1_sc_0.trigger = new Event("e", "in");
+    _p_o1_sc_0.setTrigger(new Event("e", "in"));
     this.states["/p/o1/sc"].addTransition(_p_o1_sc_0);
     
     // transition /p/o1/sd
     var _p_o1_sd_0 = new Transition(this, this.states["/p/o1/sd"], [this.states["/p/o1/se"]]);
-    _p_o1_sd_0.trigger = new Event("g", null);
+    _p_o1_sd_0.setTrigger(new Event("g", null));
     this.states["/p/o1/sd"].addTransition(_p_o1_sd_0);
 };
 
@@ -183,9 +184,10 @@ ObjectManager.prototype.instantiate = function(class_name, construct_params) {
 // add symbol 'ObjectManager' to package 'orthogonal_take_one_next_small_step'
 orthogonal_take_one_next_small_step.ObjectManager = ObjectManager;
 
-var Controller = function(event_loop_callbacks, finished_callback) {
+var Controller = function(event_loop_callbacks, finished_callback, behind_schedule_callback) {
     if (finished_callback === undefined) finished_callback = null;
-    EventLoopControllerBase.call(this, new ObjectManager(this), event_loop_callbacks, finished_callback);
+    if (behind_schedule_callback === undefined) behind_schedule_callback = null;
+    EventLoopControllerBase.call(this, new ObjectManager(this), event_loop_callbacks, finished_callback, behind_schedule_callback);
     this.addInputPort("in");
     this.addOutputPort("out");
     this.object_manager.createInstance("c", new Array());

+ 8 - 6
test/target_js/event_lifeline/21_orthogonal_take_one_queue.js

@@ -1,6 +1,6 @@
 /* Generated by Statechart compiler by Glenn De Jonghe, Joeri Exelmans, Simon Van Mierlo, and Yentl Van Tendeloo (for the inspiration)
 
-Date:   Thu Aug 04 12:50:59 2016
+Date:   Fri Aug 05 16:13:27 2016
 
 Model author: Herr Joeri Exelmans
 Model name:   orthogonal_take_one_queue
@@ -94,22 +94,23 @@ c.prototype.build_statechart_structure = function() {
     // transition /p/o0/sa
     var _p_o0_sa_0 = new Transition(this, this.states["/p/o0/sa"], [this.states["/p/o0/sb"]]);
     _p_o0_sa_0.setAction(this._p_o0_sa_0_exec);
-    _p_o0_sa_0.trigger = new Event("f", null);
+    _p_o0_sa_0.setTrigger(new Event("f", null));
     this.states["/p/o0/sa"].addTransition(_p_o0_sa_0);
     
     // transition /p/o0/sb
     var _p_o0_sb_0 = new Transition(this, this.states["/p/o0/sb"], [this.states["/p/o0/sa"]]);
+    _p_o0_sb_0.setTrigger(null);
     this.states["/p/o0/sb"].addTransition(_p_o0_sb_0);
     
     // transition /p/o1/sc
     var _p_o1_sc_0 = new Transition(this, this.states["/p/o1/sc"], [this.states["/p/o1/sd"]]);
     _p_o1_sc_0.setAction(this._p_o1_sc_0_exec);
-    _p_o1_sc_0.trigger = new Event("e", "in");
+    _p_o1_sc_0.setTrigger(new Event("e", "in"));
     this.states["/p/o1/sc"].addTransition(_p_o1_sc_0);
     
     // transition /p/o1/sd
     var _p_o1_sd_0 = new Transition(this, this.states["/p/o1/sd"], [this.states["/p/o1/se"]]);
-    _p_o1_sd_0.trigger = new Event("g", null);
+    _p_o1_sd_0.setTrigger(new Event("g", null));
     this.states["/p/o1/sd"].addTransition(_p_o1_sd_0);
 };
 
@@ -181,9 +182,10 @@ ObjectManager.prototype.instantiate = function(class_name, construct_params) {
 // add symbol 'ObjectManager' to package 'orthogonal_take_one_queue'
 orthogonal_take_one_queue.ObjectManager = ObjectManager;
 
-var Controller = function(event_loop_callbacks, finished_callback) {
+var Controller = function(event_loop_callbacks, finished_callback, behind_schedule_callback) {
     if (finished_callback === undefined) finished_callback = null;
-    EventLoopControllerBase.call(this, new ObjectManager(this), event_loop_callbacks, finished_callback);
+    if (behind_schedule_callback === undefined) behind_schedule_callback = null;
+    EventLoopControllerBase.call(this, new ObjectManager(this), event_loop_callbacks, finished_callback, behind_schedule_callback);
     this.addInputPort("in");
     this.addOutputPort("out");
     this.object_manager.createInstance("c", new Array());

+ 8 - 6
test/target_js/event_lifeline/30_orthogonal_take_many_next_small_step.js

@@ -1,6 +1,6 @@
 /* Generated by Statechart compiler by Glenn De Jonghe, Joeri Exelmans, Simon Van Mierlo, and Yentl Van Tendeloo (for the inspiration)
 
-Date:   Thu Aug 04 12:50:59 2016
+Date:   Fri Aug 05 16:13:27 2016
 
 Model author: Herr Joeri Exelmans
 Model name:   orthogonal_take_many_next_small_step
@@ -98,22 +98,23 @@ c.prototype.build_statechart_structure = function() {
     // transition /p/o0/sa
     var _p_o0_sa_0 = new Transition(this, this.states["/p/o0/sa"], [this.states["/p/o0/sb"]]);
     _p_o0_sa_0.setAction(this._p_o0_sa_0_exec);
-    _p_o0_sa_0.trigger = new Event("f", null);
+    _p_o0_sa_0.setTrigger(new Event("f", null));
     this.states["/p/o0/sa"].addTransition(_p_o0_sa_0);
     
     // transition /p/o0/sb
     var _p_o0_sb_0 = new Transition(this, this.states["/p/o0/sb"], [this.states["/p/o0/sa"]]);
+    _p_o0_sb_0.setTrigger(null);
     this.states["/p/o0/sb"].addTransition(_p_o0_sb_0);
     
     // transition /p/o1/sc
     var _p_o1_sc_0 = new Transition(this, this.states["/p/o1/sc"], [this.states["/p/o1/sd"]]);
     _p_o1_sc_0.setAction(this._p_o1_sc_0_exec);
-    _p_o1_sc_0.trigger = new Event("e", "in");
+    _p_o1_sc_0.setTrigger(new Event("e", "in"));
     this.states["/p/o1/sc"].addTransition(_p_o1_sc_0);
     
     // transition /p/o1/sd
     var _p_o1_sd_0 = new Transition(this, this.states["/p/o1/sd"], [this.states["/p/o1/se"]]);
-    _p_o1_sd_0.trigger = new Event("g", null);
+    _p_o1_sd_0.setTrigger(new Event("g", null));
     this.states["/p/o1/sd"].addTransition(_p_o1_sd_0);
 };
 
@@ -185,9 +186,10 @@ ObjectManager.prototype.instantiate = function(class_name, construct_params) {
 // add symbol 'ObjectManager' to package 'orthogonal_take_many_next_small_step'
 orthogonal_take_many_next_small_step.ObjectManager = ObjectManager;
 
-var Controller = function(event_loop_callbacks, finished_callback) {
+var Controller = function(event_loop_callbacks, finished_callback, behind_schedule_callback) {
     if (finished_callback === undefined) finished_callback = null;
-    EventLoopControllerBase.call(this, new ObjectManager(this), event_loop_callbacks, finished_callback);
+    if (behind_schedule_callback === undefined) behind_schedule_callback = null;
+    EventLoopControllerBase.call(this, new ObjectManager(this), event_loop_callbacks, finished_callback, behind_schedule_callback);
     this.addInputPort("in");
     this.addOutputPort("out");
     this.object_manager.createInstance("c", new Array());

+ 8 - 6
test/target_js/event_lifeline/31_orthogonal_take_many_next_combo_step.js

@@ -1,6 +1,6 @@
 /* Generated by Statechart compiler by Glenn De Jonghe, Joeri Exelmans, Simon Van Mierlo, and Yentl Van Tendeloo (for the inspiration)
 
-Date:   Thu Aug 04 12:50:59 2016
+Date:   Fri Aug 05 16:13:28 2016
 
 Model author: Herr Joeri Exelmans
 Model name:   orthogonal_take_many_next_combo_step
@@ -93,22 +93,23 @@ c.prototype.build_statechart_structure = function() {
     // transition /p/o0/sa
     var _p_o0_sa_0 = new Transition(this, this.states["/p/o0/sa"], [this.states["/p/o0/sb"]]);
     _p_o0_sa_0.setAction(this._p_o0_sa_0_exec);
-    _p_o0_sa_0.trigger = new Event("f", null);
+    _p_o0_sa_0.setTrigger(new Event("f", null));
     this.states["/p/o0/sa"].addTransition(_p_o0_sa_0);
     
     // transition /p/o0/sb
     var _p_o0_sb_0 = new Transition(this, this.states["/p/o0/sb"], [this.states["/p/o0/sa"]]);
+    _p_o0_sb_0.setTrigger(null);
     this.states["/p/o0/sb"].addTransition(_p_o0_sb_0);
     
     // transition /p/o1/sc
     var _p_o1_sc_0 = new Transition(this, this.states["/p/o1/sc"], [this.states["/p/o1/sd"]]);
     _p_o1_sc_0.setAction(this._p_o1_sc_0_exec);
-    _p_o1_sc_0.trigger = new Event("e", "in");
+    _p_o1_sc_0.setTrigger(new Event("e", "in"));
     this.states["/p/o1/sc"].addTransition(_p_o1_sc_0);
     
     // transition /p/o1/sd
     var _p_o1_sd_0 = new Transition(this, this.states["/p/o1/sd"], [this.states["/p/o1/se"]]);
-    _p_o1_sd_0.trigger = new Event("g", null);
+    _p_o1_sd_0.setTrigger(new Event("g", null));
     this.states["/p/o1/sd"].addTransition(_p_o1_sd_0);
 };
 
@@ -180,9 +181,10 @@ ObjectManager.prototype.instantiate = function(class_name, construct_params) {
 // add symbol 'ObjectManager' to package 'orthogonal_take_many_next_combo_step'
 orthogonal_take_many_next_combo_step.ObjectManager = ObjectManager;
 
-var Controller = function(event_loop_callbacks, finished_callback) {
+var Controller = function(event_loop_callbacks, finished_callback, behind_schedule_callback) {
     if (finished_callback === undefined) finished_callback = null;
-    EventLoopControllerBase.call(this, new ObjectManager(this), event_loop_callbacks, finished_callback);
+    if (behind_schedule_callback === undefined) behind_schedule_callback = null;
+    EventLoopControllerBase.call(this, new ObjectManager(this), event_loop_callbacks, finished_callback, behind_schedule_callback);
     this.addInputPort("in");
     this.addOutputPort("out");
     this.object_manager.createInstance("c", new Array());

+ 8 - 6
test/target_js/event_lifeline/32_orthogonal_take_many_queue.js

@@ -1,6 +1,6 @@
 /* Generated by Statechart compiler by Glenn De Jonghe, Joeri Exelmans, Simon Van Mierlo, and Yentl Van Tendeloo (for the inspiration)
 
-Date:   Thu Aug 04 12:50:59 2016
+Date:   Fri Aug 05 16:13:28 2016
 
 Model author: Herr Joeri Exelmans
 Model name:   orthogonal_take_many_queue
@@ -94,22 +94,23 @@ c.prototype.build_statechart_structure = function() {
     // transition /p/o0/sa
     var _p_o0_sa_0 = new Transition(this, this.states["/p/o0/sa"], [this.states["/p/o0/sb"]]);
     _p_o0_sa_0.setAction(this._p_o0_sa_0_exec);
-    _p_o0_sa_0.trigger = new Event("f", null);
+    _p_o0_sa_0.setTrigger(new Event("f", null));
     this.states["/p/o0/sa"].addTransition(_p_o0_sa_0);
     
     // transition /p/o0/sb
     var _p_o0_sb_0 = new Transition(this, this.states["/p/o0/sb"], [this.states["/p/o0/sa"]]);
+    _p_o0_sb_0.setTrigger(null);
     this.states["/p/o0/sb"].addTransition(_p_o0_sb_0);
     
     // transition /p/o1/sc
     var _p_o1_sc_0 = new Transition(this, this.states["/p/o1/sc"], [this.states["/p/o1/sd"]]);
     _p_o1_sc_0.setAction(this._p_o1_sc_0_exec);
-    _p_o1_sc_0.trigger = new Event("e", "in");
+    _p_o1_sc_0.setTrigger(new Event("e", "in"));
     this.states["/p/o1/sc"].addTransition(_p_o1_sc_0);
     
     // transition /p/o1/sd
     var _p_o1_sd_0 = new Transition(this, this.states["/p/o1/sd"], [this.states["/p/o1/se"]]);
-    _p_o1_sd_0.trigger = new Event("g", null);
+    _p_o1_sd_0.setTrigger(new Event("g", null));
     this.states["/p/o1/sd"].addTransition(_p_o1_sd_0);
 };
 
@@ -181,9 +182,10 @@ ObjectManager.prototype.instantiate = function(class_name, construct_params) {
 // add symbol 'ObjectManager' to package 'orthogonal_take_many_queue'
 orthogonal_take_many_queue.ObjectManager = ObjectManager;
 
-var Controller = function(event_loop_callbacks, finished_callback) {
+var Controller = function(event_loop_callbacks, finished_callback, behind_schedule_callback) {
     if (finished_callback === undefined) finished_callback = null;
-    EventLoopControllerBase.call(this, new ObjectManager(this), event_loop_callbacks, finished_callback);
+    if (behind_schedule_callback === undefined) behind_schedule_callback = null;
+    EventLoopControllerBase.call(this, new ObjectManager(this), event_loop_callbacks, finished_callback, behind_schedule_callback);
     this.addInputPort("in");
     this.addOutputPort("out");
     this.object_manager.createInstance("c", new Array());

+ 6 - 5
test/target_js/no_statechart/00_no_statechart_js.js

@@ -1,6 +1,6 @@
 /* Generated by Statechart compiler by Glenn De Jonghe, Joeri Exelmans, Simon Van Mierlo, and Yentl Van Tendeloo (for the inspiration)
 
-Date:   Thu Aug 04 12:50:59 2016
+Date:   Fri Aug 05 16:13:28 2016
 
 Model author: Herr Joeri Exelmans
 Model name:   no_statechart
@@ -89,14 +89,14 @@ my_class.prototype.build_statechart_structure = function() {
     // transition /a
     var _a_0 = new Transition(this, this.states["/a"], [this.states["/b"]]);
     _a_0.setAction(this._a_0_exec);
-    _a_0.trigger = new Event("_0after");
+    _a_0.setTrigger(new Event("_0after"));
     _a_0.setGuard(this._a_0_guard);
     this.states["/a"].addTransition(_a_0);
     
     // transition /b
     var _b_0 = new Transition(this, this.states["/b"], [this.states["/a"]]);
     _b_0.setAction(this._b_0_exec);
-    _b_0.trigger = new Event("_1after");
+    _b_0.setTrigger(new Event("_1after"));
     _b_0.setGuard(this._b_0_guard);
     this.states["/b"].addTransition(_b_0);
 };
@@ -178,9 +178,10 @@ ObjectManager.prototype.instantiate = function(class_name, construct_params) {
 // add symbol 'ObjectManager' to package 'no_statechart'
 no_statechart.ObjectManager = ObjectManager;
 
-var Controller = function(event_loop_callbacks, finished_callback) {
+var Controller = function(event_loop_callbacks, finished_callback, behind_schedule_callback) {
     if (finished_callback === undefined) finished_callback = null;
-    EventLoopControllerBase.call(this, new ObjectManager(this), event_loop_callbacks, finished_callback);
+    if (behind_schedule_callback === undefined) behind_schedule_callback = null;
+    EventLoopControllerBase.call(this, new ObjectManager(this), event_loop_callbacks, finished_callback, behind_schedule_callback);
     this.addInputPort("in");
     this.addOutputPort("out");
     this.object_manager.createInstance("my_class", new Array());

+ 6 - 5
test/target_js/original_semantics/after.js

@@ -1,6 +1,6 @@
 /* Generated by Statechart compiler by Glenn De Jonghe, Joeri Exelmans, Simon Van Mierlo, and Yentl Van Tendeloo (for the inspiration)
 
-Date:   Thu Aug 04 12:51:00 2016
+Date:   Fri Aug 05 16:13:28 2016
 
 Model author: Glenn De Jonghe
 Model name:   TestAfter
@@ -75,10 +75,10 @@ Class1.prototype.build_statechart_structure = function() {
     
     // transition /composite/state_1
     var _composite_state_1_0 = new Transition(this, this.states["/composite/state_1"], [this.states["/composite/state_2"]]);
-    _composite_state_1_0.trigger = new Event("_0after");
+    _composite_state_1_0.setTrigger(new Event("_0after"));
     this.states["/composite/state_1"].addTransition(_composite_state_1_0);
     var _composite_state_1_1 = new Transition(this, this.states["/composite/state_1"], [this.states["/composite/state_3"]]);
-    _composite_state_1_1.trigger = new Event("_1after");
+    _composite_state_1_1.setTrigger(new Event("_1after"));
     this.states["/composite/state_1"].addTransition(_composite_state_1_1);
 };
 
@@ -140,9 +140,10 @@ ObjectManager.prototype.instantiate = function(class_name, construct_params) {
 // add symbol 'ObjectManager' to package 'TestAfter'
 TestAfter.ObjectManager = ObjectManager;
 
-var Controller = function(event_loop_callbacks, finished_callback) {
+var Controller = function(event_loop_callbacks, finished_callback, behind_schedule_callback) {
     if (finished_callback === undefined) finished_callback = null;
-    EventLoopControllerBase.call(this, new ObjectManager(this), event_loop_callbacks, finished_callback);
+    if (behind_schedule_callback === undefined) behind_schedule_callback = null;
+    EventLoopControllerBase.call(this, new ObjectManager(this), event_loop_callbacks, finished_callback, behind_schedule_callback);
     this.addInputPort("test_input");
     this.addOutputPort("test_output");
     this.object_manager.createInstance("Class1", new Array());

+ 7 - 6
test/target_js/original_semantics/associate_event.js

@@ -1,6 +1,6 @@
 /* Generated by Statechart compiler by Glenn De Jonghe, Joeri Exelmans, Simon Van Mierlo, and Yentl Van Tendeloo (for the inspiration)
 
-Date:   Thu Aug 04 12:51:00 2016
+Date:   Fri Aug 05 16:13:28 2016
 
 Model author: Glenn De Jonghe
 Model name:   TestAssociateEvent
@@ -63,13 +63,13 @@ Class1.prototype.build_statechart_structure = function() {
     // transition /start
     var _start_0 = new Transition(this, this.states["/start"], [this.states["/wait"]]);
     _start_0.setAction(this._start_0_exec);
-    _start_0.trigger = new Event("create", "test_input");
+    _start_0.setTrigger(new Event("create", "test_input"));
     this.states["/start"].addTransition(_start_0);
     
     // transition /wait
     var _wait_0 = new Transition(this, this.states["/wait"], [this.states["/start"]]);
     _wait_0.setAction(this._wait_0_exec);
-    _wait_0.trigger = new Event("instance_created", null);
+    _wait_0.setTrigger(new Event("instance_created", null));
     this.states["/wait"].addTransition(_wait_0);
 };
 
@@ -149,7 +149,7 @@ Class2.prototype.build_statechart_structure = function() {
     // transition /start
     var _start_0 = new Transition(this, this.states["/start"], [this.states["/start"]]);
     _start_0.setAction(this._start_0_exec);
-    _start_0.trigger = new Event("hello", null);
+    _start_0.setTrigger(new Event("hello", null));
     this.states["/start"].addTransition(_start_0);
 };
 
@@ -202,9 +202,10 @@ ObjectManager.prototype.instantiate = function(class_name, construct_params) {
 // add symbol 'ObjectManager' to package 'TestAssociateEvent'
 TestAssociateEvent.ObjectManager = ObjectManager;
 
-var Controller = function(event_loop_callbacks, finished_callback) {
+var Controller = function(event_loop_callbacks, finished_callback, behind_schedule_callback) {
     if (finished_callback === undefined) finished_callback = null;
-    EventLoopControllerBase.call(this, new ObjectManager(this), event_loop_callbacks, finished_callback);
+    if (behind_schedule_callback === undefined) behind_schedule_callback = null;
+    EventLoopControllerBase.call(this, new ObjectManager(this), event_loop_callbacks, finished_callback, behind_schedule_callback);
     this.addInputPort("test_input");
     this.addOutputPort("test_output");
     this.object_manager.createInstance("Class1", new Array());

+ 4 - 3
test/target_js/original_semantics/correct_duplicate_state_id.js

@@ -1,6 +1,6 @@
 /* Generated by Statechart compiler by Glenn De Jonghe, Joeri Exelmans, Simon Van Mierlo, and Yentl Van Tendeloo (for the inspiration)
 
-Date:   Thu Aug 04 12:51:00 2016
+Date:   Fri Aug 05 16:13:28 2016
 
 Model author: Glenn De Jonghe
 Model name:   TestCorrectDuplicateStateId
@@ -119,9 +119,10 @@ ObjectManager.prototype.instantiate = function(class_name, construct_params) {
 // add symbol 'ObjectManager' to package 'TestCorrectDuplicateStateId'
 TestCorrectDuplicateStateId.ObjectManager = ObjectManager;
 
-var Controller = function(event_loop_callbacks, finished_callback) {
+var Controller = function(event_loop_callbacks, finished_callback, behind_schedule_callback) {
     if (finished_callback === undefined) finished_callback = null;
-    EventLoopControllerBase.call(this, new ObjectManager(this), event_loop_callbacks, finished_callback);
+    if (behind_schedule_callback === undefined) behind_schedule_callback = null;
+    EventLoopControllerBase.call(this, new ObjectManager(this), event_loop_callbacks, finished_callback, behind_schedule_callback);
     this.object_manager.createInstance("Class1", new Array());
 };
 Controller.prototype = new Object();

+ 9 - 8
test/target_js/original_semantics/enter_exit_hierarchy.js

@@ -1,6 +1,6 @@
 /* Generated by Statechart compiler by Glenn De Jonghe, Joeri Exelmans, Simon Van Mierlo, and Yentl Van Tendeloo (for the inspiration)
 
-Date:   Thu Aug 04 12:51:00 2016
+Date:   Fri Aug 05 16:13:28 2016
 
 Model author: Glenn De Jonghe
 Model name:   TestEnterExitHierarchy
@@ -101,23 +101,23 @@ Class1.prototype.build_statechart_structure = function() {
     
     // transition /outside
     var _outside_0 = new Transition(this, this.states["/outside"], [this.states["/composite"]]);
-    _outside_0.trigger = new Event("to_composite", "test_input");
+    _outside_0.setTrigger(new Event("to_composite", "test_input"));
     this.states["/outside"].addTransition(_outside_0);
     var _outside_1 = new Transition(this, this.states["/outside"], [this.states["/composite/state2/inner3"]]);
-    _outside_1.trigger = new Event("to_inner3", "test_input");
+    _outside_1.setTrigger(new Event("to_inner3", "test_input"));
     this.states["/outside"].addTransition(_outside_1);
     var _outside_2 = new Transition(this, this.states["/outside"], [this.states["/composite/state2/inner4"]]);
-    _outside_2.trigger = new Event("to_inner4", "test_input");
+    _outside_2.setTrigger(new Event("to_inner4", "test_input"));
     this.states["/outside"].addTransition(_outside_2);
     
     // transition /composite/state1/inner1
     var _composite_state1_inner1_0 = new Transition(this, this.states["/composite/state1/inner1"], [this.states["/composite/state1/inner2"]]);
-    _composite_state1_inner1_0.trigger = new Event("to_inner2", "test_input");
+    _composite_state1_inner1_0.setTrigger(new Event("to_inner2", "test_input"));
     this.states["/composite/state1/inner1"].addTransition(_composite_state1_inner1_0);
     
     // transition /composite
     var _composite_0 = new Transition(this, this.states["/composite"], [this.states["/outside"]]);
-    _composite_0.trigger = new Event("to_outside", "test_input");
+    _composite_0.setTrigger(new Event("to_outside", "test_input"));
     this.states["/composite"].addTransition(_composite_0);
 };
 
@@ -209,9 +209,10 @@ ObjectManager.prototype.instantiate = function(class_name, construct_params) {
 // add symbol 'ObjectManager' to package 'TestEnterExitHierarchy'
 TestEnterExitHierarchy.ObjectManager = ObjectManager;
 
-var Controller = function(event_loop_callbacks, finished_callback) {
+var Controller = function(event_loop_callbacks, finished_callback, behind_schedule_callback) {
     if (finished_callback === undefined) finished_callback = null;
-    EventLoopControllerBase.call(this, new ObjectManager(this), event_loop_callbacks, finished_callback);
+    if (behind_schedule_callback === undefined) behind_schedule_callback = null;
+    EventLoopControllerBase.call(this, new ObjectManager(this), event_loop_callbacks, finished_callback, behind_schedule_callback);
     this.addInputPort("test_input");
     this.addOutputPort("test_output");
     this.object_manager.createInstance("Class1", new Array());

+ 7 - 3
test/target_js/original_semantics/guard.js

@@ -1,6 +1,6 @@
 /* Generated by Statechart compiler by Glenn De Jonghe, Joeri Exelmans, Simon Van Mierlo, and Yentl Van Tendeloo (for the inspiration)
 
-Date:   Thu Aug 04 12:51:00 2016
+Date:   Fri Aug 05 16:13:29 2016
 
 Model author: Glenn De Jonghe
 Model name:   TestGuard
@@ -71,13 +71,16 @@ Class1.prototype.build_statechart_structure = function() {
     
     // transition /state_1
     var _state_1_0 = new Transition(this, this.states["/state_1"], [this.states["/state_2"]]);
+    _state_1_0.setTrigger(null);
     this.states["/state_1"].addTransition(_state_1_0);
     
     // transition /state_2
     var _state_2_0 = new Transition(this, this.states["/state_2"], [this.states["/state_1"]]);
+    _state_2_0.setTrigger(null);
     _state_2_0.setGuard(this._state_2_0_guard);
     this.states["/state_2"].addTransition(_state_2_0);
     var _state_2_1 = new Transition(this, this.states["/state_2"], [this.states["/state_3"]]);
+    _state_2_1.setTrigger(null);
     _state_2_1.setGuard(this._state_2_1_guard);
     this.states["/state_2"].addTransition(_state_2_1);
 };
@@ -138,9 +141,10 @@ ObjectManager.prototype.instantiate = function(class_name, construct_params) {
 // add symbol 'ObjectManager' to package 'TestGuard'
 TestGuard.ObjectManager = ObjectManager;
 
-var Controller = function(event_loop_callbacks, finished_callback) {
+var Controller = function(event_loop_callbacks, finished_callback, behind_schedule_callback) {
     if (finished_callback === undefined) finished_callback = null;
-    EventLoopControllerBase.call(this, new ObjectManager(this), event_loop_callbacks, finished_callback);
+    if (behind_schedule_callback === undefined) behind_schedule_callback = null;
+    EventLoopControllerBase.call(this, new ObjectManager(this), event_loop_callbacks, finished_callback, behind_schedule_callback);
     this.addOutputPort("test_output");
     this.object_manager.createInstance("Class1", new Array());
 };

+ 7 - 5
test/target_js/original_semantics/history.js

@@ -1,6 +1,6 @@
 /* Generated by Statechart compiler by Glenn De Jonghe, Joeri Exelmans, Simon Van Mierlo, and Yentl Van Tendeloo (for the inspiration)
 
-Date:   Thu Aug 04 12:51:00 2016
+Date:   Fri Aug 05 16:13:29 2016
 
 Model author: Glenn De Jonghe
 Model name:   TestHistory
@@ -78,16 +78,17 @@ Class1.prototype.build_statechart_structure = function() {
     
     // transition /composite_1/state_1
     var _composite_1_state_1_0 = new Transition(this, this.states["/composite_1/state_1"], [this.states["/composite_1/state_2"]]);
-    _composite_1_state_1_0.trigger = new Event("to_state_2", "test_input");
+    _composite_1_state_1_0.setTrigger(new Event("to_state_2", "test_input"));
     this.states["/composite_1/state_1"].addTransition(_composite_1_state_1_0);
     
     // transition /state_3
     var _state_3_0 = new Transition(this, this.states["/state_3"], [this.states["/composite_1/composite_history"]]);
+    _state_3_0.setTrigger(null);
     this.states["/state_3"].addTransition(_state_3_0);
     
     // transition /composite_1
     var _composite_1_0 = new Transition(this, this.states["/composite_1"], [this.states["/state_3"]]);
-    _composite_1_0.trigger = new Event("to_state_3", "test_input");
+    _composite_1_0.setTrigger(new Event("to_state_3", "test_input"));
     this.states["/composite_1"].addTransition(_composite_1_0);
 };
 
@@ -143,9 +144,10 @@ ObjectManager.prototype.instantiate = function(class_name, construct_params) {
 // add symbol 'ObjectManager' to package 'TestHistory'
 TestHistory.ObjectManager = ObjectManager;
 
-var Controller = function(event_loop_callbacks, finished_callback) {
+var Controller = function(event_loop_callbacks, finished_callback, behind_schedule_callback) {
     if (finished_callback === undefined) finished_callback = null;
-    EventLoopControllerBase.call(this, new ObjectManager(this), event_loop_callbacks, finished_callback);
+    if (behind_schedule_callback === undefined) behind_schedule_callback = null;
+    EventLoopControllerBase.call(this, new ObjectManager(this), event_loop_callbacks, finished_callback, behind_schedule_callback);
     this.addInputPort("test_input");
     this.addOutputPort("test_output");
     this.object_manager.createInstance("Class1", new Array());

+ 12 - 7
test/target_js/original_semantics/history_deep.js

@@ -1,6 +1,6 @@
 /* Generated by Statechart compiler by Glenn De Jonghe, Joeri Exelmans, Simon Van Mierlo, and Yentl Van Tendeloo (for the inspiration)
 
-Date:   Thu Aug 04 12:51:00 2016
+Date:   Fri Aug 05 16:13:29 2016
 
 Model author: Glenn De Jonghe
 Model name:   TestHistoryDeep
@@ -127,45 +127,49 @@ Class1.prototype.build_statechart_structure = function() {
     
     // transition /parallel/orthogonal/wrapper/state_2/inner_3
     var _parallel_orthogonal_wrapper_state_2_inner_3_0 = new Transition(this, this.states["/parallel/orthogonal/wrapper/state_2/inner_3"], [this.states["/parallel/orthogonal/wrapper/state_2/inner_4"]]);
-    _parallel_orthogonal_wrapper_state_2_inner_3_0.trigger = new Event("to_inner_4", null);
+    _parallel_orthogonal_wrapper_state_2_inner_3_0.setTrigger(new Event("to_inner_4", null));
     this.states["/parallel/orthogonal/wrapper/state_2/inner_3"].addTransition(_parallel_orthogonal_wrapper_state_2_inner_3_0);
     
     // transition /parallel/orthogonal/outer
     var _parallel_orthogonal_outer_0 = new Transition(this, this.states["/parallel/orthogonal/outer"], [this.states["/parallel/orthogonal/wrapper/history"]]);
-    _parallel_orthogonal_outer_0.trigger = new Event("to_history", null);
+    _parallel_orthogonal_outer_0.setTrigger(new Event("to_history", null));
     this.states["/parallel/orthogonal/outer"].addTransition(_parallel_orthogonal_outer_0);
     
     // transition /parallel/orthogonal_tester/start
     var _parallel_orthogonal_tester_start_0 = new Transition(this, this.states["/parallel/orthogonal_tester/start"], [this.states["/parallel/orthogonal_tester/step1"]]);
     _parallel_orthogonal_tester_start_0.setAction(this._parallel_orthogonal_tester_start_0_exec);
+    _parallel_orthogonal_tester_start_0.setTrigger(null);
     this.states["/parallel/orthogonal_tester/start"].addTransition(_parallel_orthogonal_tester_start_0);
     
     // transition /parallel/orthogonal_tester/step1
     var _parallel_orthogonal_tester_step1_0 = new Transition(this, this.states["/parallel/orthogonal_tester/step1"], [this.states["/parallel/orthogonal_tester/step2"]]);
     _parallel_orthogonal_tester_step1_0.setAction(this._parallel_orthogonal_tester_step1_0_exec);
+    _parallel_orthogonal_tester_step1_0.setTrigger(null);
     _parallel_orthogonal_tester_step1_0.setGuard(this._parallel_orthogonal_tester_step1_0_guard);
     this.states["/parallel/orthogonal_tester/step1"].addTransition(_parallel_orthogonal_tester_step1_0);
     
     // transition /parallel/orthogonal_tester/step2
     var _parallel_orthogonal_tester_step2_0 = new Transition(this, this.states["/parallel/orthogonal_tester/step2"], [this.states["/parallel/orthogonal_tester/step3"]]);
     _parallel_orthogonal_tester_step2_0.setAction(this._parallel_orthogonal_tester_step2_0_exec);
+    _parallel_orthogonal_tester_step2_0.setTrigger(null);
     _parallel_orthogonal_tester_step2_0.setGuard(this._parallel_orthogonal_tester_step2_0_guard);
     this.states["/parallel/orthogonal_tester/step2"].addTransition(_parallel_orthogonal_tester_step2_0);
     
     // transition /parallel/orthogonal_tester/step3
     var _parallel_orthogonal_tester_step3_0 = new Transition(this, this.states["/parallel/orthogonal_tester/step3"], [this.states["/parallel/orthogonal_tester/end"]]);
     _parallel_orthogonal_tester_step3_0.setAction(this._parallel_orthogonal_tester_step3_0_exec);
+    _parallel_orthogonal_tester_step3_0.setTrigger(null);
     _parallel_orthogonal_tester_step3_0.setGuard(this._parallel_orthogonal_tester_step3_0_guard);
     this.states["/parallel/orthogonal_tester/step3"].addTransition(_parallel_orthogonal_tester_step3_0);
     
     // transition /parallel/orthogonal/wrapper
     var _parallel_orthogonal_wrapper_0 = new Transition(this, this.states["/parallel/orthogonal/wrapper"], [this.states["/parallel/orthogonal/outer"]]);
-    _parallel_orthogonal_wrapper_0.trigger = new Event("to_outer", null);
+    _parallel_orthogonal_wrapper_0.setTrigger(new Event("to_outer", null));
     this.states["/parallel/orthogonal/wrapper"].addTransition(_parallel_orthogonal_wrapper_0);
     
     // transition /parallel/orthogonal/wrapper/state_1
     var _parallel_orthogonal_wrapper_state_1_0 = new Transition(this, this.states["/parallel/orthogonal/wrapper/state_1"], [this.states["/parallel/orthogonal/wrapper/state_2"]]);
-    _parallel_orthogonal_wrapper_state_1_0.trigger = new Event("to_state_2", null);
+    _parallel_orthogonal_wrapper_state_1_0.setTrigger(new Event("to_state_2", null));
     this.states["/parallel/orthogonal/wrapper/state_1"].addTransition(_parallel_orthogonal_wrapper_state_1_0);
 };
 
@@ -240,9 +244,10 @@ ObjectManager.prototype.instantiate = function(class_name, construct_params) {
 // add symbol 'ObjectManager' to package 'TestHistoryDeep'
 TestHistoryDeep.ObjectManager = ObjectManager;
 
-var Controller = function(event_loop_callbacks, finished_callback) {
+var Controller = function(event_loop_callbacks, finished_callback, behind_schedule_callback) {
     if (finished_callback === undefined) finished_callback = null;
-    EventLoopControllerBase.call(this, new ObjectManager(this), event_loop_callbacks, finished_callback);
+    if (behind_schedule_callback === undefined) behind_schedule_callback = null;
+    EventLoopControllerBase.call(this, new ObjectManager(this), event_loop_callbacks, finished_callback, behind_schedule_callback);
     this.addOutputPort("test_output");
     this.object_manager.createInstance("Class1", new Array());
 };

+ 12 - 7
test/target_js/original_semantics/history_parallel_deep.js

@@ -1,6 +1,6 @@
 /* Generated by Statechart compiler by Glenn De Jonghe, Joeri Exelmans, Simon Van Mierlo, and Yentl Van Tendeloo (for the inspiration)
 
-Date:   Thu Aug 04 12:51:01 2016
+Date:   Fri Aug 05 16:13:29 2016
 
 Model author: Glenn De Jonghe
 Model name:   TestHistoryParallelDeep
@@ -126,45 +126,49 @@ Class1.prototype.build_statechart_structure = function() {
     
     // transition /parallel/orthogonal/wrapper/state_1/inner_1
     var _parallel_orthogonal_wrapper_state_1_inner_1_0 = new Transition(this, this.states["/parallel/orthogonal/wrapper/state_1/inner_1"], [this.states["/parallel/orthogonal/wrapper/state_1/inner_2"]]);
-    _parallel_orthogonal_wrapper_state_1_inner_1_0.trigger = new Event("to_inner_2", null);
+    _parallel_orthogonal_wrapper_state_1_inner_1_0.setTrigger(new Event("to_inner_2", null));
     this.states["/parallel/orthogonal/wrapper/state_1/inner_1"].addTransition(_parallel_orthogonal_wrapper_state_1_inner_1_0);
     
     // transition /parallel/orthogonal/wrapper/state_2/inner_3
     var _parallel_orthogonal_wrapper_state_2_inner_3_0 = new Transition(this, this.states["/parallel/orthogonal/wrapper/state_2/inner_3"], [this.states["/parallel/orthogonal/wrapper/state_2/inner_4"]]);
-    _parallel_orthogonal_wrapper_state_2_inner_3_0.trigger = new Event("to_inner_4", null);
+    _parallel_orthogonal_wrapper_state_2_inner_3_0.setTrigger(new Event("to_inner_4", null));
     this.states["/parallel/orthogonal/wrapper/state_2/inner_3"].addTransition(_parallel_orthogonal_wrapper_state_2_inner_3_0);
     
     // transition /parallel/orthogonal/outer
     var _parallel_orthogonal_outer_0 = new Transition(this, this.states["/parallel/orthogonal/outer"], [this.states["/parallel/orthogonal/wrapper/history"]]);
-    _parallel_orthogonal_outer_0.trigger = new Event("to_history", null);
+    _parallel_orthogonal_outer_0.setTrigger(new Event("to_history", null));
     this.states["/parallel/orthogonal/outer"].addTransition(_parallel_orthogonal_outer_0);
     
     // transition /parallel/orthogonal_tester/start
     var _parallel_orthogonal_tester_start_0 = new Transition(this, this.states["/parallel/orthogonal_tester/start"], [this.states["/parallel/orthogonal_tester/step1"]]);
     _parallel_orthogonal_tester_start_0.setAction(this._parallel_orthogonal_tester_start_0_exec);
+    _parallel_orthogonal_tester_start_0.setTrigger(null);
     this.states["/parallel/orthogonal_tester/start"].addTransition(_parallel_orthogonal_tester_start_0);
     
     // transition /parallel/orthogonal_tester/step1
     var _parallel_orthogonal_tester_step1_0 = new Transition(this, this.states["/parallel/orthogonal_tester/step1"], [this.states["/parallel/orthogonal_tester/step2"]]);
     _parallel_orthogonal_tester_step1_0.setAction(this._parallel_orthogonal_tester_step1_0_exec);
+    _parallel_orthogonal_tester_step1_0.setTrigger(null);
     _parallel_orthogonal_tester_step1_0.setGuard(this._parallel_orthogonal_tester_step1_0_guard);
     this.states["/parallel/orthogonal_tester/step1"].addTransition(_parallel_orthogonal_tester_step1_0);
     
     // transition /parallel/orthogonal_tester/step2
     var _parallel_orthogonal_tester_step2_0 = new Transition(this, this.states["/parallel/orthogonal_tester/step2"], [this.states["/parallel/orthogonal_tester/step3"]]);
     _parallel_orthogonal_tester_step2_0.setAction(this._parallel_orthogonal_tester_step2_0_exec);
+    _parallel_orthogonal_tester_step2_0.setTrigger(null);
     _parallel_orthogonal_tester_step2_0.setGuard(this._parallel_orthogonal_tester_step2_0_guard);
     this.states["/parallel/orthogonal_tester/step2"].addTransition(_parallel_orthogonal_tester_step2_0);
     
     // transition /parallel/orthogonal_tester/step3
     var _parallel_orthogonal_tester_step3_0 = new Transition(this, this.states["/parallel/orthogonal_tester/step3"], [this.states["/parallel/orthogonal_tester/end"]]);
     _parallel_orthogonal_tester_step3_0.setAction(this._parallel_orthogonal_tester_step3_0_exec);
+    _parallel_orthogonal_tester_step3_0.setTrigger(null);
     _parallel_orthogonal_tester_step3_0.setGuard(this._parallel_orthogonal_tester_step3_0_guard);
     this.states["/parallel/orthogonal_tester/step3"].addTransition(_parallel_orthogonal_tester_step3_0);
     
     // transition /parallel/orthogonal/wrapper
     var _parallel_orthogonal_wrapper_0 = new Transition(this, this.states["/parallel/orthogonal/wrapper"], [this.states["/parallel/orthogonal/outer"]]);
-    _parallel_orthogonal_wrapper_0.trigger = new Event("to_outer", null);
+    _parallel_orthogonal_wrapper_0.setTrigger(new Event("to_outer", null));
     this.states["/parallel/orthogonal/wrapper"].addTransition(_parallel_orthogonal_wrapper_0);
 };
 
@@ -239,9 +243,10 @@ ObjectManager.prototype.instantiate = function(class_name, construct_params) {
 // add symbol 'ObjectManager' to package 'TestHistoryParallelDeep'
 TestHistoryParallelDeep.ObjectManager = ObjectManager;
 
-var Controller = function(event_loop_callbacks, finished_callback) {
+var Controller = function(event_loop_callbacks, finished_callback, behind_schedule_callback) {
     if (finished_callback === undefined) finished_callback = null;
-    EventLoopControllerBase.call(this, new ObjectManager(this), event_loop_callbacks, finished_callback);
+    if (behind_schedule_callback === undefined) behind_schedule_callback = null;
+    EventLoopControllerBase.call(this, new ObjectManager(this), event_loop_callbacks, finished_callback, behind_schedule_callback);
     this.addOutputPort("test_output");
     this.object_manager.createInstance("Class1", new Array());
 };

+ 6 - 5
test/target_js/original_semantics/inner_first.js

@@ -1,6 +1,6 @@
 /* Generated by Statechart compiler by Glenn De Jonghe, Joeri Exelmans, Simon Van Mierlo, and Yentl Van Tendeloo (for the inspiration)
 
-Date:   Thu Aug 04 12:51:01 2016
+Date:   Fri Aug 05 16:13:29 2016
 
 Model author: Glenn De Jonghe
 Model name:   TestInnerFirst
@@ -73,12 +73,12 @@ Class1.prototype.build_statechart_structure = function() {
     
     // transition /state1/state1
     var _state1_state1_0 = new Transition(this, this.states["/state1/state1"], [this.states["/state1/statea"]]);
-    _state1_state1_0.trigger = new Event("event", "test_input");
+    _state1_state1_0.setTrigger(new Event("event", "test_input"));
     this.states["/state1/state1"].addTransition(_state1_state1_0);
     
     // transition /state1
     var _state1_0 = new Transition(this, this.states["/state1"], [this.states["/stateb"]]);
-    _state1_0.trigger = new Event("event", "test_input");
+    _state1_0.setTrigger(new Event("event", "test_input"));
     this.states["/state1"].addTransition(_state1_0);
 };
 
@@ -130,9 +130,10 @@ ObjectManager.prototype.instantiate = function(class_name, construct_params) {
 // add symbol 'ObjectManager' to package 'TestInnerFirst'
 TestInnerFirst.ObjectManager = ObjectManager;
 
-var Controller = function(event_loop_callbacks, finished_callback) {
+var Controller = function(event_loop_callbacks, finished_callback, behind_schedule_callback) {
     if (finished_callback === undefined) finished_callback = null;
-    EventLoopControllerBase.call(this, new ObjectManager(this), event_loop_callbacks, finished_callback);
+    if (behind_schedule_callback === undefined) behind_schedule_callback = null;
+    EventLoopControllerBase.call(this, new ObjectManager(this), event_loop_callbacks, finished_callback, behind_schedule_callback);
     this.addInputPort("test_input");
     this.addOutputPort("test_output");
     this.object_manager.createInstance("Class1", new Array());

+ 9 - 5
test/target_js/original_semantics/instate.js

@@ -1,6 +1,6 @@
 /* Generated by Statechart compiler by Glenn De Jonghe, Joeri Exelmans, Simon Van Mierlo, and Yentl Van Tendeloo (for the inspiration)
 
-Date:   Thu Aug 04 12:51:01 2016
+Date:   Fri Aug 05 16:13:29 2016
 
 Model author: Glenn De Jonghe
 Model name:   TestInstate
@@ -93,25 +93,28 @@ Class1.prototype.build_statechart_structure = function() {
     
     // transition /parallel_1/orthogonal1/state1
     var _parallel_1_orthogonal1_state1_0 = new Transition(this, this.states["/parallel_1/orthogonal1/state1"], [this.states["/parallel_1/orthogonal1/inner"]]);
-    _parallel_1_orthogonal1_state1_0.trigger = new Event("to_inner", null);
+    _parallel_1_orthogonal1_state1_0.setTrigger(new Event("to_inner", null));
     this.states["/parallel_1/orthogonal1/state1"].addTransition(_parallel_1_orthogonal1_state1_0);
     
     // transition /parallel_1/orthogonal1/inner/state2
     var _parallel_1_orthogonal1_inner_state2_0 = new Transition(this, this.states["/parallel_1/orthogonal1/inner/state2"], [this.states["/parallel_1/orthogonal1/inner/state3"]]);
-    _parallel_1_orthogonal1_inner_state2_0.trigger = new Event("to_state3", null);
+    _parallel_1_orthogonal1_inner_state2_0.setTrigger(new Event("to_state3", null));
     this.states["/parallel_1/orthogonal1/inner/state2"].addTransition(_parallel_1_orthogonal1_inner_state2_0);
     
     // transition /parallel_1/orthogonal2/tester
     var _parallel_1_orthogonal2_tester_0 = new Transition(this, this.states["/parallel_1/orthogonal2/tester"], [this.states["/parallel_1/orthogonal2/tester"]]);
     _parallel_1_orthogonal2_tester_0.setAction(this._parallel_1_orthogonal2_tester_0_exec);
+    _parallel_1_orthogonal2_tester_0.setTrigger(null);
     _parallel_1_orthogonal2_tester_0.setGuard(this._parallel_1_orthogonal2_tester_0_guard);
     this.states["/parallel_1/orthogonal2/tester"].addTransition(_parallel_1_orthogonal2_tester_0);
     var _parallel_1_orthogonal2_tester_1 = new Transition(this, this.states["/parallel_1/orthogonal2/tester"], [this.states["/parallel_1/orthogonal2/tester"]]);
     _parallel_1_orthogonal2_tester_1.setAction(this._parallel_1_orthogonal2_tester_1_exec);
+    _parallel_1_orthogonal2_tester_1.setTrigger(null);
     _parallel_1_orthogonal2_tester_1.setGuard(this._parallel_1_orthogonal2_tester_1_guard);
     this.states["/parallel_1/orthogonal2/tester"].addTransition(_parallel_1_orthogonal2_tester_1);
     var _parallel_1_orthogonal2_tester_2 = new Transition(this, this.states["/parallel_1/orthogonal2/tester"], [this.states["/parallel_1/orthogonal2/stop"]]);
     _parallel_1_orthogonal2_tester_2.setAction(this._parallel_1_orthogonal2_tester_2_exec);
+    _parallel_1_orthogonal2_tester_2.setTrigger(null);
     _parallel_1_orthogonal2_tester_2.setGuard(this._parallel_1_orthogonal2_tester_2_guard);
     this.states["/parallel_1/orthogonal2/tester"].addTransition(_parallel_1_orthogonal2_tester_2);
 };
@@ -182,9 +185,10 @@ ObjectManager.prototype.instantiate = function(class_name, construct_params) {
 // add symbol 'ObjectManager' to package 'TestInstate'
 TestInstate.ObjectManager = ObjectManager;
 
-var Controller = function(event_loop_callbacks, finished_callback) {
+var Controller = function(event_loop_callbacks, finished_callback, behind_schedule_callback) {
     if (finished_callback === undefined) finished_callback = null;
-    EventLoopControllerBase.call(this, new ObjectManager(this), event_loop_callbacks, finished_callback);
+    if (behind_schedule_callback === undefined) behind_schedule_callback = null;
+    EventLoopControllerBase.call(this, new ObjectManager(this), event_loop_callbacks, finished_callback, behind_schedule_callback);
     this.addOutputPort("test_output");
     this.object_manager.createInstance("Class1", new Array());
 };

+ 5 - 3
test/target_js/original_semantics/multiple_target.js

@@ -1,6 +1,6 @@
 /* Generated by Statechart compiler by Glenn De Jonghe, Joeri Exelmans, Simon Van Mierlo, and Yentl Van Tendeloo (for the inspiration)
 
-Date:   Thu Aug 04 12:51:01 2016
+Date:   Fri Aug 05 16:13:29 2016
 
 Model author: Glenn De Jonghe
 Model name:   TestMultipleTarget
@@ -93,6 +93,7 @@ Class1.prototype.build_statechart_structure = function() {
     
     // transition /next_to_parallel
     var _next_to_parallel_0 = new Transition(this, this.states["/next_to_parallel"], [this.states["/parallel/orthogonal_1/inner_2"], this.states["/parallel/orthogonal_2/inner_2"]]);
+    _next_to_parallel_0.setTrigger(null);
     this.states["/next_to_parallel"].addTransition(_next_to_parallel_0);
 };
 
@@ -156,9 +157,10 @@ ObjectManager.prototype.instantiate = function(class_name, construct_params) {
 // add symbol 'ObjectManager' to package 'TestMultipleTarget'
 TestMultipleTarget.ObjectManager = ObjectManager;
 
-var Controller = function(event_loop_callbacks, finished_callback) {
+var Controller = function(event_loop_callbacks, finished_callback, behind_schedule_callback) {
     if (finished_callback === undefined) finished_callback = null;
-    EventLoopControllerBase.call(this, new ObjectManager(this), event_loop_callbacks, finished_callback);
+    if (behind_schedule_callback === undefined) behind_schedule_callback = null;
+    EventLoopControllerBase.call(this, new ObjectManager(this), event_loop_callbacks, finished_callback, behind_schedule_callback);
     this.addInputPort("test_input");
     this.addOutputPort("test_output");
     this.object_manager.createInstance("Class1", new Array());

+ 7 - 6
test/target_js/original_semantics/object_manager.js

@@ -1,6 +1,6 @@
 /* Generated by Statechart compiler by Glenn De Jonghe, Joeri Exelmans, Simon Van Mierlo, and Yentl Van Tendeloo (for the inspiration)
 
-Date:   Thu Aug 04 12:51:01 2016
+Date:   Fri Aug 05 16:13:30 2016
 
 Model author: Glenn De Jonghe
 Model name:   TestObjectManager
@@ -63,13 +63,13 @@ Class1.prototype.build_statechart_structure = function() {
     // transition /start
     var _start_0 = new Transition(this, this.states["/start"], [this.states["/wait"]]);
     _start_0.setAction(this._start_0_exec);
-    _start_0.trigger = new Event("create", "test_input");
+    _start_0.setTrigger(new Event("create", "test_input"));
     this.states["/start"].addTransition(_start_0);
     
     // transition /wait
     var _wait_0 = new Transition(this, this.states["/wait"], [this.states["/start"]]);
     _wait_0.setAction(this._wait_0_exec);
-    _wait_0.trigger = new Event("instance_created", null);
+    _wait_0.setTrigger(new Event("instance_created", null));
     this.states["/wait"].addTransition(_wait_0);
 };
 
@@ -148,7 +148,7 @@ Class2.prototype.build_statechart_structure = function() {
     // transition /start
     var _start_0 = new Transition(this, this.states["/start"], [this.states["/start"]]);
     _start_0.setAction(this._start_0_exec);
-    _start_0.trigger = new Event("hello", null);
+    _start_0.setTrigger(new Event("hello", null));
     this.states["/start"].addTransition(_start_0);
 };
 
@@ -200,9 +200,10 @@ ObjectManager.prototype.instantiate = function(class_name, construct_params) {
 // add symbol 'ObjectManager' to package 'TestObjectManager'
 TestObjectManager.ObjectManager = ObjectManager;
 
-var Controller = function(event_loop_callbacks, finished_callback) {
+var Controller = function(event_loop_callbacks, finished_callback, behind_schedule_callback) {
     if (finished_callback === undefined) finished_callback = null;
-    EventLoopControllerBase.call(this, new ObjectManager(this), event_loop_callbacks, finished_callback);
+    if (behind_schedule_callback === undefined) behind_schedule_callback = null;
+    EventLoopControllerBase.call(this, new ObjectManager(this), event_loop_callbacks, finished_callback, behind_schedule_callback);
     this.addInputPort("test_input");
     this.addOutputPort("test_output");
     this.object_manager.createInstance("Class1", new Array());

+ 6 - 5
test/target_js/original_semantics/outer_first.js

@@ -1,6 +1,6 @@
 /* Generated by Statechart compiler by Glenn De Jonghe, Joeri Exelmans, Simon Van Mierlo, and Yentl Van Tendeloo (for the inspiration)
 
-Date:   Thu Aug 04 12:51:01 2016
+Date:   Fri Aug 05 16:13:30 2016
 
 Model author: Glenn De Jonghe
 Model name:   TestOuterFirst
@@ -73,12 +73,12 @@ Class1.prototype.build_statechart_structure = function() {
     
     // transition /state1/state1
     var _state1_state1_0 = new Transition(this, this.states["/state1/state1"], [this.states["/state1/statea"]]);
-    _state1_state1_0.trigger = new Event("event", "test_input");
+    _state1_state1_0.setTrigger(new Event("event", "test_input"));
     this.states["/state1/state1"].addTransition(_state1_state1_0);
     
     // transition /state1
     var _state1_0 = new Transition(this, this.states["/state1"], [this.states["/stateb"]]);
-    _state1_0.trigger = new Event("event", "test_input");
+    _state1_0.setTrigger(new Event("event", "test_input"));
     this.states["/state1"].addTransition(_state1_0);
 };
 
@@ -130,9 +130,10 @@ ObjectManager.prototype.instantiate = function(class_name, construct_params) {
 // add symbol 'ObjectManager' to package 'TestOuterFirst'
 TestOuterFirst.ObjectManager = ObjectManager;
 
-var Controller = function(event_loop_callbacks, finished_callback) {
+var Controller = function(event_loop_callbacks, finished_callback, behind_schedule_callback) {
     if (finished_callback === undefined) finished_callback = null;
-    EventLoopControllerBase.call(this, new ObjectManager(this), event_loop_callbacks, finished_callback);
+    if (behind_schedule_callback === undefined) behind_schedule_callback = null;
+    EventLoopControllerBase.call(this, new ObjectManager(this), event_loop_callbacks, finished_callback, behind_schedule_callback);
     this.addInputPort("test_input");
     this.addOutputPort("test_output");
     this.object_manager.createInstance("Class1", new Array());

+ 8 - 7
test/target_js/original_semantics/parallel.js

@@ -1,6 +1,6 @@
 /* Generated by Statechart compiler by Glenn De Jonghe, Joeri Exelmans, Simon Van Mierlo, and Yentl Van Tendeloo (for the inspiration)
 
-Date:   Thu Aug 04 12:51:01 2016
+Date:   Fri Aug 05 16:13:30 2016
 
 Model author: Glenn De Jonghe
 Model name:   TestParallel
@@ -88,22 +88,22 @@ Class1.prototype.build_statechart_structure = function() {
     
     // transition /parallel_1/orthogonal_1/state_1
     var _parallel_1_orthogonal_1_state_1_0 = new Transition(this, this.states["/parallel_1/orthogonal_1/state_1"], [this.states["/parallel_1/orthogonal_1/state_2"]]);
-    _parallel_1_orthogonal_1_state_1_0.trigger = new Event("to_state_2", "test_input");
+    _parallel_1_orthogonal_1_state_1_0.setTrigger(new Event("to_state_2", "test_input"));
     this.states["/parallel_1/orthogonal_1/state_1"].addTransition(_parallel_1_orthogonal_1_state_1_0);
     
     // transition /parallel_1/orthogonal_1/state_2
     var _parallel_1_orthogonal_1_state_2_0 = new Transition(this, this.states["/parallel_1/orthogonal_1/state_2"], [this.states["/parallel_1/orthogonal_1/state_1"]]);
-    _parallel_1_orthogonal_1_state_2_0.trigger = new Event("to_state_1", "test_input");
+    _parallel_1_orthogonal_1_state_2_0.setTrigger(new Event("to_state_1", "test_input"));
     this.states["/parallel_1/orthogonal_1/state_2"].addTransition(_parallel_1_orthogonal_1_state_2_0);
     
     // transition /parallel_1/orthogonal_2/state_3
     var _parallel_1_orthogonal_2_state_3_0 = new Transition(this, this.states["/parallel_1/orthogonal_2/state_3"], [this.states["/parallel_1/orthogonal_2/state_4"]]);
-    _parallel_1_orthogonal_2_state_3_0.trigger = new Event("to_state_4", "test_input");
+    _parallel_1_orthogonal_2_state_3_0.setTrigger(new Event("to_state_4", "test_input"));
     this.states["/parallel_1/orthogonal_2/state_3"].addTransition(_parallel_1_orthogonal_2_state_3_0);
     
     // transition /parallel_1/orthogonal_2/state_4
     var _parallel_1_orthogonal_2_state_4_0 = new Transition(this, this.states["/parallel_1/orthogonal_2/state_4"], [this.states["/parallel_1/orthogonal_2/state_3"]]);
-    _parallel_1_orthogonal_2_state_4_0.trigger = new Event("to_state_3", "test_input");
+    _parallel_1_orthogonal_2_state_4_0.setTrigger(new Event("to_state_3", "test_input"));
     this.states["/parallel_1/orthogonal_2/state_4"].addTransition(_parallel_1_orthogonal_2_state_4_0);
 };
 
@@ -163,9 +163,10 @@ ObjectManager.prototype.instantiate = function(class_name, construct_params) {
 // add symbol 'ObjectManager' to package 'TestParallel'
 TestParallel.ObjectManager = ObjectManager;
 
-var Controller = function(event_loop_callbacks, finished_callback) {
+var Controller = function(event_loop_callbacks, finished_callback, behind_schedule_callback) {
     if (finished_callback === undefined) finished_callback = null;
-    EventLoopControllerBase.call(this, new ObjectManager(this), event_loop_callbacks, finished_callback);
+    if (behind_schedule_callback === undefined) behind_schedule_callback = null;
+    EventLoopControllerBase.call(this, new ObjectManager(this), event_loop_callbacks, finished_callback, behind_schedule_callback);
     this.addInputPort("test_input");
     this.addOutputPort("test_output");
     this.object_manager.createInstance("Class1", new Array());

+ 10 - 9
test/target_js/original_semantics/parallel_history.js

@@ -1,6 +1,6 @@
 /* Generated by Statechart compiler by Glenn De Jonghe, Joeri Exelmans, Simon Van Mierlo, and Yentl Van Tendeloo (for the inspiration)
 
-Date:   Thu Aug 04 12:51:02 2016
+Date:   Fri Aug 05 16:13:30 2016
 
 Model author: Glenn De Jonghe
 Model name:   TestParallelHistory
@@ -116,32 +116,32 @@ TestClass.prototype.build_statechart_structure = function() {
     
     // transition /parallel/orthogonal_1/orthogonal_inner_1/state_1
     var _parallel_orthogonal_1_orthogonal_inner_1_state_1_0 = new Transition(this, this.states["/parallel/orthogonal_1/orthogonal_inner_1/state_1"], [this.states["/parallel/orthogonal_1/orthogonal_inner_1/state_2"]]);
-    _parallel_orthogonal_1_orthogonal_inner_1_state_1_0.trigger = new Event("to_state_2", "test_input");
+    _parallel_orthogonal_1_orthogonal_inner_1_state_1_0.setTrigger(new Event("to_state_2", "test_input"));
     this.states["/parallel/orthogonal_1/orthogonal_inner_1/state_1"].addTransition(_parallel_orthogonal_1_orthogonal_inner_1_state_1_0);
     
     // transition /parallel/orthogonal_1/outer_1
     var _parallel_orthogonal_1_outer_1_0 = new Transition(this, this.states["/parallel/orthogonal_1/outer_1"], [this.states["/parallel/orthogonal_1/orthogonal_inner_1/history_1"]]);
-    _parallel_orthogonal_1_outer_1_0.trigger = new Event("to_history_1", "test_input");
+    _parallel_orthogonal_1_outer_1_0.setTrigger(new Event("to_history_1", "test_input"));
     this.states["/parallel/orthogonal_1/outer_1"].addTransition(_parallel_orthogonal_1_outer_1_0);
     
     // transition /parallel/orthogonal_2/orthogonal_inner_2/state_3
     var _parallel_orthogonal_2_orthogonal_inner_2_state_3_0 = new Transition(this, this.states["/parallel/orthogonal_2/orthogonal_inner_2/state_3"], [this.states["/parallel/orthogonal_2/orthogonal_inner_2/state_4"]]);
-    _parallel_orthogonal_2_orthogonal_inner_2_state_3_0.trigger = new Event("to_state_4", "test_input");
+    _parallel_orthogonal_2_orthogonal_inner_2_state_3_0.setTrigger(new Event("to_state_4", "test_input"));
     this.states["/parallel/orthogonal_2/orthogonal_inner_2/state_3"].addTransition(_parallel_orthogonal_2_orthogonal_inner_2_state_3_0);
     
     // transition /parallel/orthogonal_2/outer_2
     var _parallel_orthogonal_2_outer_2_0 = new Transition(this, this.states["/parallel/orthogonal_2/outer_2"], [this.states["/parallel/orthogonal_2/orthogonal_inner_2/history_2"]]);
-    _parallel_orthogonal_2_outer_2_0.trigger = new Event("to_history_2", "test_input");
+    _parallel_orthogonal_2_outer_2_0.setTrigger(new Event("to_history_2", "test_input"));
     this.states["/parallel/orthogonal_2/outer_2"].addTransition(_parallel_orthogonal_2_outer_2_0);
     
     // transition /parallel/orthogonal_1/orthogonal_inner_1
     var _parallel_orthogonal_1_orthogonal_inner_1_0 = new Transition(this, this.states["/parallel/orthogonal_1/orthogonal_inner_1"], [this.states["/parallel/orthogonal_1/outer_1"]]);
-    _parallel_orthogonal_1_orthogonal_inner_1_0.trigger = new Event("to_outer_1", "test_input");
+    _parallel_orthogonal_1_orthogonal_inner_1_0.setTrigger(new Event("to_outer_1", "test_input"));
     this.states["/parallel/orthogonal_1/orthogonal_inner_1"].addTransition(_parallel_orthogonal_1_orthogonal_inner_1_0);
     
     // transition /parallel/orthogonal_2/orthogonal_inner_2
     var _parallel_orthogonal_2_orthogonal_inner_2_0 = new Transition(this, this.states["/parallel/orthogonal_2/orthogonal_inner_2"], [this.states["/parallel/orthogonal_2/outer_2"]]);
-    _parallel_orthogonal_2_orthogonal_inner_2_0.trigger = new Event("to_outer_2", "test_input");
+    _parallel_orthogonal_2_orthogonal_inner_2_0.setTrigger(new Event("to_outer_2", "test_input"));
     this.states["/parallel/orthogonal_2/orthogonal_inner_2"].addTransition(_parallel_orthogonal_2_orthogonal_inner_2_0);
 };
 
@@ -209,9 +209,10 @@ ObjectManager.prototype.instantiate = function(class_name, construct_params) {
 // add symbol 'ObjectManager' to package 'TestParallelHistory'
 TestParallelHistory.ObjectManager = ObjectManager;
 
-var Controller = function(event_loop_callbacks, finished_callback) {
+var Controller = function(event_loop_callbacks, finished_callback, behind_schedule_callback) {
     if (finished_callback === undefined) finished_callback = null;
-    EventLoopControllerBase.call(this, new ObjectManager(this), event_loop_callbacks, finished_callback);
+    if (behind_schedule_callback === undefined) behind_schedule_callback = null;
+    EventLoopControllerBase.call(this, new ObjectManager(this), event_loop_callbacks, finished_callback, behind_schedule_callback);
     this.addInputPort("test_input");
     this.addOutputPort("test_output");
     this.object_manager.createInstance("TestClass", new Array());

+ 10 - 9
test/target_js/original_semantics/parallel_history_2.js

@@ -1,6 +1,6 @@
 /* Generated by Statechart compiler by Glenn De Jonghe, Joeri Exelmans, Simon Van Mierlo, and Yentl Van Tendeloo (for the inspiration)
 
-Date:   Thu Aug 04 12:51:02 2016
+Date:   Fri Aug 05 16:13:30 2016
 
 Model author: Glenn De Jonghe
 Model name:   TestParallelHistory2
@@ -117,32 +117,32 @@ TestClass.prototype.build_statechart_structure = function() {
     
     // transition /parallel/orthogonal_1/orthogonal_inner_1/state_1
     var _parallel_orthogonal_1_orthogonal_inner_1_state_1_0 = new Transition(this, this.states["/parallel/orthogonal_1/orthogonal_inner_1/state_1"], [this.states["/parallel/orthogonal_1/orthogonal_inner_1/state_2"]]);
-    _parallel_orthogonal_1_orthogonal_inner_1_state_1_0.trigger = new Event("to_state_2", "test_input");
+    _parallel_orthogonal_1_orthogonal_inner_1_state_1_0.setTrigger(new Event("to_state_2", "test_input"));
     this.states["/parallel/orthogonal_1/orthogonal_inner_1/state_1"].addTransition(_parallel_orthogonal_1_orthogonal_inner_1_state_1_0);
     
     // transition /parallel/orthogonal_2/orthogonal_inner_2/state_3
     var _parallel_orthogonal_2_orthogonal_inner_2_state_3_0 = new Transition(this, this.states["/parallel/orthogonal_2/orthogonal_inner_2/state_3"], [this.states["/parallel/orthogonal_2/orthogonal_inner_2/state_4"]]);
-    _parallel_orthogonal_2_orthogonal_inner_2_state_3_0.trigger = new Event("to_state_4", "test_input");
+    _parallel_orthogonal_2_orthogonal_inner_2_state_3_0.setTrigger(new Event("to_state_4", "test_input"));
     this.states["/parallel/orthogonal_2/orthogonal_inner_2/state_3"].addTransition(_parallel_orthogonal_2_orthogonal_inner_2_state_3_0);
     
     // transition /next_to_parallel
     var _next_to_parallel_0 = new Transition(this, this.states["/next_to_parallel"], [this.states["/parallel/history_1"]]);
-    _next_to_parallel_0.trigger = new Event("to_history_1", "test_input");
+    _next_to_parallel_0.setTrigger(new Event("to_history_1", "test_input"));
     this.states["/next_to_parallel"].addTransition(_next_to_parallel_0);
     
     // transition /parallel
     var _parallel_0 = new Transition(this, this.states["/parallel"], [this.states["/next_to_parallel"]]);
-    _parallel_0.trigger = new Event("exit", "test_input");
+    _parallel_0.setTrigger(new Event("exit", "test_input"));
     this.states["/parallel"].addTransition(_parallel_0);
     
     // transition /parallel/orthogonal_1/orthogonal_inner_1
     var _parallel_orthogonal_1_orthogonal_inner_1_0 = new Transition(this, this.states["/parallel/orthogonal_1/orthogonal_inner_1"], [this.states["/parallel/orthogonal_1/outer_1"]]);
-    _parallel_orthogonal_1_orthogonal_inner_1_0.trigger = new Event("to_outer_1", "test_input");
+    _parallel_orthogonal_1_orthogonal_inner_1_0.setTrigger(new Event("to_outer_1", "test_input"));
     this.states["/parallel/orthogonal_1/orthogonal_inner_1"].addTransition(_parallel_orthogonal_1_orthogonal_inner_1_0);
     
     // transition /parallel/orthogonal_2/orthogonal_inner_2
     var _parallel_orthogonal_2_orthogonal_inner_2_0 = new Transition(this, this.states["/parallel/orthogonal_2/orthogonal_inner_2"], [this.states["/parallel/orthogonal_2/outer_2"]]);
-    _parallel_orthogonal_2_orthogonal_inner_2_0.trigger = new Event("to_outer_2", "test_input");
+    _parallel_orthogonal_2_orthogonal_inner_2_0.setTrigger(new Event("to_outer_2", "test_input"));
     this.states["/parallel/orthogonal_2/orthogonal_inner_2"].addTransition(_parallel_orthogonal_2_orthogonal_inner_2_0);
 };
 
@@ -214,9 +214,10 @@ ObjectManager.prototype.instantiate = function(class_name, construct_params) {
 // add symbol 'ObjectManager' to package 'TestParallelHistory2'
 TestParallelHistory2.ObjectManager = ObjectManager;
 
-var Controller = function(event_loop_callbacks, finished_callback) {
+var Controller = function(event_loop_callbacks, finished_callback, behind_schedule_callback) {
     if (finished_callback === undefined) finished_callback = null;
-    EventLoopControllerBase.call(this, new ObjectManager(this), event_loop_callbacks, finished_callback);
+    if (behind_schedule_callback === undefined) behind_schedule_callback = null;
+    EventLoopControllerBase.call(this, new ObjectManager(this), event_loop_callbacks, finished_callback, behind_schedule_callback);
     this.addInputPort("test_input");
     this.addOutputPort("test_output");
     this.object_manager.createInstance("TestClass", new Array());

+ 10 - 9
test/target_js/original_semantics/parallel_history_3.js

@@ -1,6 +1,6 @@
 /* Generated by Statechart compiler by Glenn De Jonghe, Joeri Exelmans, Simon Van Mierlo, and Yentl Van Tendeloo (for the inspiration)
 
-Date:   Thu Aug 04 12:51:02 2016
+Date:   Fri Aug 05 16:13:30 2016
 
 Model author: Glenn De Jonghe
 Model name:   TestParallelHistory2
@@ -117,32 +117,32 @@ TestClass.prototype.build_statechart_structure = function() {
     
     // transition /parallel/orthogonal_1/orthogonal_inner_1/state_1
     var _parallel_orthogonal_1_orthogonal_inner_1_state_1_0 = new Transition(this, this.states["/parallel/orthogonal_1/orthogonal_inner_1/state_1"], [this.states["/parallel/orthogonal_1/orthogonal_inner_1/state_2"]]);
-    _parallel_orthogonal_1_orthogonal_inner_1_state_1_0.trigger = new Event("to_state_2", "test_input");
+    _parallel_orthogonal_1_orthogonal_inner_1_state_1_0.setTrigger(new Event("to_state_2", "test_input"));
     this.states["/parallel/orthogonal_1/orthogonal_inner_1/state_1"].addTransition(_parallel_orthogonal_1_orthogonal_inner_1_state_1_0);
     
     // transition /parallel/orthogonal_2/orthogonal_inner_2/state_3
     var _parallel_orthogonal_2_orthogonal_inner_2_state_3_0 = new Transition(this, this.states["/parallel/orthogonal_2/orthogonal_inner_2/state_3"], [this.states["/parallel/orthogonal_2/orthogonal_inner_2/state_4"]]);
-    _parallel_orthogonal_2_orthogonal_inner_2_state_3_0.trigger = new Event("to_state_4", "test_input");
+    _parallel_orthogonal_2_orthogonal_inner_2_state_3_0.setTrigger(new Event("to_state_4", "test_input"));
     this.states["/parallel/orthogonal_2/orthogonal_inner_2/state_3"].addTransition(_parallel_orthogonal_2_orthogonal_inner_2_state_3_0);
     
     // transition /next_to_parallel
     var _next_to_parallel_0 = new Transition(this, this.states["/next_to_parallel"], [this.states["/parallel/history_1"]]);
-    _next_to_parallel_0.trigger = new Event("to_history_1", "test_input");
+    _next_to_parallel_0.setTrigger(new Event("to_history_1", "test_input"));
     this.states["/next_to_parallel"].addTransition(_next_to_parallel_0);
     
     // transition /parallel
     var _parallel_0 = new Transition(this, this.states["/parallel"], [this.states["/next_to_parallel"]]);
-    _parallel_0.trigger = new Event("exit", "test_input");
+    _parallel_0.setTrigger(new Event("exit", "test_input"));
     this.states["/parallel"].addTransition(_parallel_0);
     
     // transition /parallel/orthogonal_1/orthogonal_inner_1
     var _parallel_orthogonal_1_orthogonal_inner_1_0 = new Transition(this, this.states["/parallel/orthogonal_1/orthogonal_inner_1"], [this.states["/parallel/orthogonal_1/outer_1"]]);
-    _parallel_orthogonal_1_orthogonal_inner_1_0.trigger = new Event("to_outer_1", "test_input");
+    _parallel_orthogonal_1_orthogonal_inner_1_0.setTrigger(new Event("to_outer_1", "test_input"));
     this.states["/parallel/orthogonal_1/orthogonal_inner_1"].addTransition(_parallel_orthogonal_1_orthogonal_inner_1_0);
     
     // transition /parallel/orthogonal_2/orthogonal_inner_2
     var _parallel_orthogonal_2_orthogonal_inner_2_0 = new Transition(this, this.states["/parallel/orthogonal_2/orthogonal_inner_2"], [this.states["/parallel/orthogonal_2/outer_2"]]);
-    _parallel_orthogonal_2_orthogonal_inner_2_0.trigger = new Event("to_outer_2", "test_input");
+    _parallel_orthogonal_2_orthogonal_inner_2_0.setTrigger(new Event("to_outer_2", "test_input"));
     this.states["/parallel/orthogonal_2/orthogonal_inner_2"].addTransition(_parallel_orthogonal_2_orthogonal_inner_2_0);
 };
 
@@ -214,9 +214,10 @@ ObjectManager.prototype.instantiate = function(class_name, construct_params) {
 // add symbol 'ObjectManager' to package 'TestParallelHistory2'
 TestParallelHistory2.ObjectManager = ObjectManager;
 
-var Controller = function(event_loop_callbacks, finished_callback) {
+var Controller = function(event_loop_callbacks, finished_callback, behind_schedule_callback) {
     if (finished_callback === undefined) finished_callback = null;
-    EventLoopControllerBase.call(this, new ObjectManager(this), event_loop_callbacks, finished_callback);
+    if (behind_schedule_callback === undefined) behind_schedule_callback = null;
+    EventLoopControllerBase.call(this, new ObjectManager(this), event_loop_callbacks, finished_callback, behind_schedule_callback);
     this.addInputPort("test_input");
     this.addOutputPort("test_output");
     this.object_manager.createInstance("TestClass", new Array());

+ 6 - 3
test/target_js/priority/00_source_parent.js

@@ -1,6 +1,6 @@
 /* Generated by Statechart compiler by Glenn De Jonghe, Joeri Exelmans, Simon Van Mierlo, and Yentl Van Tendeloo (for the inspiration)
 
-Date:   Thu Aug 04 12:51:02 2016
+Date:   Fri Aug 05 16:13:30 2016
 
 Model author: Herr Joeri Exelmans
 Model name:   source_parent
@@ -75,10 +75,12 @@ c.prototype.build_statechart_structure = function() {
     
     // transition /parent/a
     var _parent_a_0 = new Transition(this, this.states["/parent/a"], [this.states["/parent/b"]]);
+    _parent_a_0.setTrigger(null);
     this.states["/parent/a"].addTransition(_parent_a_0);
     
     // transition /parent
     var _parent_0 = new Transition(this, this.states["/parent"], [this.states["/c"]]);
+    _parent_0.setTrigger(null);
     this.states["/parent"].addTransition(_parent_0);
 };
 
@@ -138,9 +140,10 @@ ObjectManager.prototype.instantiate = function(class_name, construct_params) {
 // add symbol 'ObjectManager' to package 'source_parent'
 source_parent.ObjectManager = ObjectManager;
 
-var Controller = function(event_loop_callbacks, finished_callback) {
+var Controller = function(event_loop_callbacks, finished_callback, behind_schedule_callback) {
     if (finished_callback === undefined) finished_callback = null;
-    EventLoopControllerBase.call(this, new ObjectManager(this), event_loop_callbacks, finished_callback);
+    if (behind_schedule_callback === undefined) behind_schedule_callback = null;
+    EventLoopControllerBase.call(this, new ObjectManager(this), event_loop_callbacks, finished_callback, behind_schedule_callback);
     this.addInputPort("in");
     this.addOutputPort("out");
     this.object_manager.createInstance("c", new Array());

+ 6 - 3
test/target_js/priority/01_source_child.js

@@ -1,6 +1,6 @@
 /* Generated by Statechart compiler by Glenn De Jonghe, Joeri Exelmans, Simon Van Mierlo, and Yentl Van Tendeloo (for the inspiration)
 
-Date:   Thu Aug 04 12:51:02 2016
+Date:   Fri Aug 05 16:13:30 2016
 
 Model author: Herr Joeri Exelmans
 Model name:   source_child
@@ -75,10 +75,12 @@ c.prototype.build_statechart_structure = function() {
     
     // transition /parent/a
     var _parent_a_0 = new Transition(this, this.states["/parent/a"], [this.states["/parent/b"]]);
+    _parent_a_0.setTrigger(null);
     this.states["/parent/a"].addTransition(_parent_a_0);
     
     // transition /parent
     var _parent_0 = new Transition(this, this.states["/parent"], [this.states["/c"]]);
+    _parent_0.setTrigger(null);
     this.states["/parent"].addTransition(_parent_0);
 };
 
@@ -138,9 +140,10 @@ ObjectManager.prototype.instantiate = function(class_name, construct_params) {
 // add symbol 'ObjectManager' to package 'source_child'
 source_child.ObjectManager = ObjectManager;
 
-var Controller = function(event_loop_callbacks, finished_callback) {
+var Controller = function(event_loop_callbacks, finished_callback, behind_schedule_callback) {
     if (finished_callback === undefined) finished_callback = null;
-    EventLoopControllerBase.call(this, new ObjectManager(this), event_loop_callbacks, finished_callback);
+    if (behind_schedule_callback === undefined) behind_schedule_callback = null;
+    EventLoopControllerBase.call(this, new ObjectManager(this), event_loop_callbacks, finished_callback, behind_schedule_callback);
     this.addInputPort("in");
     this.addOutputPort("out");
     this.object_manager.createInstance("c", new Array());

+ 6 - 5
test/target_js/priority/10_source_parent_history.js

@@ -1,6 +1,6 @@
 /* Generated by Statechart compiler by Glenn De Jonghe, Joeri Exelmans, Simon Van Mierlo, and Yentl Van Tendeloo (for the inspiration)
 
-Date:   Thu Aug 04 12:51:02 2016
+Date:   Fri Aug 05 16:13:30 2016
 
 Model author: Herr Joeri Exelmans
 Model name:   source_parent_history
@@ -71,13 +71,13 @@ c.prototype.build_statechart_structure = function() {
     // transition /main/A
     var _main_A_0 = new Transition(this, this.states["/main/A"], [this.states["/main/B"]]);
     _main_A_0.setAction(this._main_A_0_exec);
-    _main_A_0.trigger = new Event("e", "in");
+    _main_A_0.setTrigger(new Event("e", "in"));
     this.states["/main/A"].addTransition(_main_A_0);
     
     // transition /main
     var _main_0 = new Transition(this, this.states["/main"], [this.states["/main/history"]]);
     _main_0.setAction(this._main_0_exec);
-    _main_0.trigger = new Event("e", "in");
+    _main_0.setTrigger(new Event("e", "in"));
     this.states["/main"].addTransition(_main_0);
 };
 
@@ -129,9 +129,10 @@ ObjectManager.prototype.instantiate = function(class_name, construct_params) {
 // add symbol 'ObjectManager' to package 'source_parent_history'
 source_parent_history.ObjectManager = ObjectManager;
 
-var Controller = function(event_loop_callbacks, finished_callback) {
+var Controller = function(event_loop_callbacks, finished_callback, behind_schedule_callback) {
     if (finished_callback === undefined) finished_callback = null;
-    EventLoopControllerBase.call(this, new ObjectManager(this), event_loop_callbacks, finished_callback);
+    if (behind_schedule_callback === undefined) behind_schedule_callback = null;
+    EventLoopControllerBase.call(this, new ObjectManager(this), event_loop_callbacks, finished_callback, behind_schedule_callback);
     this.addInputPort("in");
     this.addOutputPort("out");
     this.object_manager.createInstance("c", new Array());

+ 6 - 5
test/target_js/priority/11_source_child_history.js

@@ -1,6 +1,6 @@
 /* Generated by Statechart compiler by Glenn De Jonghe, Joeri Exelmans, Simon Van Mierlo, and Yentl Van Tendeloo (for the inspiration)
 
-Date:   Thu Aug 04 12:51:02 2016
+Date:   Fri Aug 05 16:13:31 2016
 
 Model author: Herr Joeri Exelmans
 Model name:   source_child_history
@@ -71,13 +71,13 @@ c.prototype.build_statechart_structure = function() {
     // transition /main/A
     var _main_A_0 = new Transition(this, this.states["/main/A"], [this.states["/main/B"]]);
     _main_A_0.setAction(this._main_A_0_exec);
-    _main_A_0.trigger = new Event("e", "in");
+    _main_A_0.setTrigger(new Event("e", "in"));
     this.states["/main/A"].addTransition(_main_A_0);
     
     // transition /main
     var _main_0 = new Transition(this, this.states["/main"], [this.states["/main/history"]]);
     _main_0.setAction(this._main_0_exec);
-    _main_0.trigger = new Event("e", "in");
+    _main_0.setTrigger(new Event("e", "in"));
     this.states["/main"].addTransition(_main_0);
 };
 
@@ -129,9 +129,10 @@ ObjectManager.prototype.instantiate = function(class_name, construct_params) {
 // add symbol 'ObjectManager' to package 'source_child_history'
 source_child_history.ObjectManager = ObjectManager;
 
-var Controller = function(event_loop_callbacks, finished_callback) {
+var Controller = function(event_loop_callbacks, finished_callback, behind_schedule_callback) {
     if (finished_callback === undefined) finished_callback = null;
-    EventLoopControllerBase.call(this, new ObjectManager(this), event_loop_callbacks, finished_callback);
+    if (behind_schedule_callback === undefined) behind_schedule_callback = null;
+    EventLoopControllerBase.call(this, new ObjectManager(this), event_loop_callbacks, finished_callback, behind_schedule_callback);
     this.addInputPort("in");
     this.addOutputPort("out");
     this.object_manager.createInstance("c", new Array());

+ 5 - 4
test/target_js/timing/00_rapid_js.js

@@ -1,6 +1,6 @@
 /* Generated by Statechart compiler by Glenn De Jonghe, Joeri Exelmans, Simon Van Mierlo, and Yentl Van Tendeloo (for the inspiration)
 
-Date:   Thu Aug 04 12:51:02 2016
+Date:   Fri Aug 05 16:13:31 2016
 
 Model author: Herr Joeri Exelmans
 Model name:   rapid
@@ -65,7 +65,7 @@ c.prototype.build_statechart_structure = function() {
     // transition /a
     var _a_0 = new Transition(this, this.states["/a"], [this.states["/a"]]);
     _a_0.setAction(this._a_0_exec);
-    _a_0.trigger = new Event("_0after");
+    _a_0.setTrigger(new Event("_0after"));
     _a_0.setGuard(this._a_0_guard);
     this.states["/a"].addTransition(_a_0);
 };
@@ -127,9 +127,10 @@ ObjectManager.prototype.instantiate = function(class_name, construct_params) {
 // add symbol 'ObjectManager' to package 'rapid'
 rapid.ObjectManager = ObjectManager;
 
-var Controller = function(event_loop_callbacks, finished_callback) {
+var Controller = function(event_loop_callbacks, finished_callback, behind_schedule_callback) {
     if (finished_callback === undefined) finished_callback = null;
-    EventLoopControllerBase.call(this, new ObjectManager(this), event_loop_callbacks, finished_callback);
+    if (behind_schedule_callback === undefined) behind_schedule_callback = null;
+    EventLoopControllerBase.call(this, new ObjectManager(this), event_loop_callbacks, finished_callback, behind_schedule_callback);
     this.addInputPort("in");
     this.addOutputPort("out");
     this.object_manager.createInstance("c", new Array());

+ 3 - 1
test/target_py/big_step_maximality/00_take_one.py

@@ -1,7 +1,7 @@
 """
 Generated by Statechart compiler by Glenn De Jonghe, Joeri Exelmans, Simon Van Mierlo, and Yentl Van Tendeloo (for the inspiration)
 
-Date:   Thu Aug 04 12:51:03 2016
+Date:   Fri Aug 05 16:13:31 2016
 
 Model author: Herr Joeri Exelmans
 Model name:   take_one
@@ -63,10 +63,12 @@ class c(RuntimeClassBase):
         
         # transition /a
         _a_0 = Transition(self, self.states["/a"], [self.states["/b"]])
+        _a_0.setTrigger(None)
         self.states["/a"].addTransition(_a_0)
         
         # transition /b
         _b_0 = Transition(self, self.states["/b"], [self.states["/c"]])
+        _b_0.setTrigger(None)
         self.states["/b"].addTransition(_b_0)
     
     def _a_enter(self):

+ 3 - 1
test/target_py/big_step_maximality/01_take_many.py

@@ -1,7 +1,7 @@
 """
 Generated by Statechart compiler by Glenn De Jonghe, Joeri Exelmans, Simon Van Mierlo, and Yentl Van Tendeloo (for the inspiration)
 
-Date:   Thu Aug 04 12:51:03 2016
+Date:   Fri Aug 05 16:13:31 2016
 
 Model author: Herr Joeri Exelmans
 Model name:   take_many
@@ -63,10 +63,12 @@ class c(RuntimeClassBase):
         
         # transition /a
         _a_0 = Transition(self, self.states["/a"], [self.states["/b"]])
+        _a_0.setTrigger(None)
         self.states["/a"].addTransition(_a_0)
         
         # transition /b
         _b_0 = Transition(self, self.states["/b"], [self.states["/c"]])
+        _b_0.setTrigger(None)
         self.states["/b"].addTransition(_b_0)
     
     def _a_enter(self):

+ 5 - 1
test/target_py/big_step_maximality/10_orthogonal_take_one.py

@@ -1,7 +1,7 @@
 """
 Generated by Statechart compiler by Glenn De Jonghe, Joeri Exelmans, Simon Van Mierlo, and Yentl Van Tendeloo (for the inspiration)
 
-Date:   Thu Aug 04 12:51:03 2016
+Date:   Fri Aug 05 16:13:31 2016
 
 Model author: Herr Joeri Exelmans
 Model name:   orthogonal_take_one
@@ -92,18 +92,22 @@ class c(RuntimeClassBase):
         
         # transition /p/o0/sa
         _p_o0_sa_0 = Transition(self, self.states["/p/o0/sa"], [self.states["/p/o0/sb"]])
+        _p_o0_sa_0.setTrigger(None)
         self.states["/p/o0/sa"].addTransition(_p_o0_sa_0)
         
         # transition /p/o0/sb
         _p_o0_sb_0 = Transition(self, self.states["/p/o0/sb"], [self.states["/p/o0/sc"]])
+        _p_o0_sb_0.setTrigger(None)
         self.states["/p/o0/sb"].addTransition(_p_o0_sb_0)
         
         # transition /p/o1/sd
         _p_o1_sd_0 = Transition(self, self.states["/p/o1/sd"], [self.states["/p/o1/se"]])
+        _p_o1_sd_0.setTrigger(None)
         self.states["/p/o1/sd"].addTransition(_p_o1_sd_0)
         
         # transition /p/o1/se
         _p_o1_se_0 = Transition(self, self.states["/p/o1/se"], [self.states["/p/o1/sf"]])
+        _p_o1_se_0.setTrigger(None)
         self.states["/p/o1/se"].addTransition(_p_o1_se_0)
     
     def _p_o0_sa_enter(self):

+ 5 - 1
test/target_py/big_step_maximality/11_orthogonal_take_many.py

@@ -1,7 +1,7 @@
 """
 Generated by Statechart compiler by Glenn De Jonghe, Joeri Exelmans, Simon Van Mierlo, and Yentl Van Tendeloo (for the inspiration)
 
-Date:   Thu Aug 04 12:51:03 2016
+Date:   Fri Aug 05 16:13:31 2016
 
 Model author: Herr Joeri Exelmans
 Model name:   orthogonal_take_many
@@ -92,18 +92,22 @@ class c(RuntimeClassBase):
         
         # transition /p/o0/sa
         _p_o0_sa_0 = Transition(self, self.states["/p/o0/sa"], [self.states["/p/o0/sb"]])
+        _p_o0_sa_0.setTrigger(None)
         self.states["/p/o0/sa"].addTransition(_p_o0_sa_0)
         
         # transition /p/o0/sb
         _p_o0_sb_0 = Transition(self, self.states["/p/o0/sb"], [self.states["/p/o0/sc"]])
+        _p_o0_sb_0.setTrigger(None)
         self.states["/p/o0/sb"].addTransition(_p_o0_sb_0)
         
         # transition /p/o1/sd
         _p_o1_sd_0 = Transition(self, self.states["/p/o1/sd"], [self.states["/p/o1/se"]])
+        _p_o1_sd_0.setTrigger(None)
         self.states["/p/o1/sd"].addTransition(_p_o1_sd_0)
         
         # transition /p/o1/se
         _p_o1_se_0 = Transition(self, self.states["/p/o1/se"], [self.states["/p/o1/sf"]])
+        _p_o1_se_0.setTrigger(None)
         self.states["/p/o1/se"].addTransition(_p_o1_se_0)
     
     def _p_o0_sa_enter(self):

+ 3 - 3
test/target_py/event_lifeline/00_take_one_next_small_step.py

@@ -1,7 +1,7 @@
 """
 Generated by Statechart compiler by Glenn De Jonghe, Joeri Exelmans, Simon Van Mierlo, and Yentl Van Tendeloo (for the inspiration)
 
-Date:   Thu Aug 04 12:51:03 2016
+Date:   Fri Aug 05 16:13:32 2016
 
 Model author: Herr Joeri Exelmans
 Model name:   take_one_next_small_step
@@ -64,12 +64,12 @@ class c(RuntimeClassBase):
         # transition /a
         _a_0 = Transition(self, self.states["/a"], [self.states["/b"]])
         _a_0.setAction(self._a_0_exec)
-        _a_0.trigger = Event("e", "in")
+        _a_0.setTrigger(Event("e", "in"))
         self.states["/a"].addTransition(_a_0)
         
         # transition /b
         _b_0 = Transition(self, self.states["/b"], [self.states["/c"]])
-        _b_0.trigger = Event("f", None)
+        _b_0.setTrigger(Event("f", None))
         self.states["/b"].addTransition(_b_0)
     
     def _a_enter(self):

+ 3 - 3
test/target_py/event_lifeline/02_take_one_queue.py

@@ -1,7 +1,7 @@
 """
 Generated by Statechart compiler by Glenn De Jonghe, Joeri Exelmans, Simon Van Mierlo, and Yentl Van Tendeloo (for the inspiration)
 
-Date:   Thu Aug 04 12:51:03 2016
+Date:   Fri Aug 05 16:13:32 2016
 
 Model author: Herr Joeri Exelmans
 Model name:   take_one_queue
@@ -64,12 +64,12 @@ class c(RuntimeClassBase):
         # transition /a
         _a_0 = Transition(self, self.states["/a"], [self.states["/b"]])
         _a_0.setAction(self._a_0_exec)
-        _a_0.trigger = Event("e", "in")
+        _a_0.setTrigger(Event("e", "in"))
         self.states["/a"].addTransition(_a_0)
         
         # transition /b
         _b_0 = Transition(self, self.states["/b"], [self.states["/c"]])
-        _b_0.trigger = Event("f", None)
+        _b_0.setTrigger(Event("f", None))
         self.states["/b"].addTransition(_b_0)
     
     def _a_enter(self):

+ 3 - 3
test/target_py/event_lifeline/10_take_many_next_small_step.py

@@ -1,7 +1,7 @@
 """
 Generated by Statechart compiler by Glenn De Jonghe, Joeri Exelmans, Simon Van Mierlo, and Yentl Van Tendeloo (for the inspiration)
 
-Date:   Thu Aug 04 12:51:03 2016
+Date:   Fri Aug 05 16:13:32 2016
 
 Model author: Herr Joeri Exelmans
 Model name:   take_many_next_small_step
@@ -64,12 +64,12 @@ class c(RuntimeClassBase):
         # transition /a
         _a_0 = Transition(self, self.states["/a"], [self.states["/b"]])
         _a_0.setAction(self._a_0_exec)
-        _a_0.trigger = Event("e", "in")
+        _a_0.setTrigger(Event("e", "in"))
         self.states["/a"].addTransition(_a_0)
         
         # transition /b
         _b_0 = Transition(self, self.states["/b"], [self.states["/c"]])
-        _b_0.trigger = Event("f", None)
+        _b_0.setTrigger(Event("f", None))
         self.states["/b"].addTransition(_b_0)
     
     def _a_enter(self):

+ 3 - 3
test/target_py/event_lifeline/11_take_many_next_combo_step.py

@@ -1,7 +1,7 @@
 """
 Generated by Statechart compiler by Glenn De Jonghe, Joeri Exelmans, Simon Van Mierlo, and Yentl Van Tendeloo (for the inspiration)
 
-Date:   Thu Aug 04 12:51:04 2016
+Date:   Fri Aug 05 16:13:32 2016
 
 Model author: Herr Joeri Exelmans
 Model name:   take_many_next_combo_step
@@ -64,12 +64,12 @@ class c(RuntimeClassBase):
         # transition /a
         _a_0 = Transition(self, self.states["/a"], [self.states["/b"]])
         _a_0.setAction(self._a_0_exec)
-        _a_0.trigger = Event("e", "in")
+        _a_0.setTrigger(Event("e", "in"))
         self.states["/a"].addTransition(_a_0)
         
         # transition /b
         _b_0 = Transition(self, self.states["/b"], [self.states["/c"]])
-        _b_0.trigger = Event("f", None)
+        _b_0.setTrigger(Event("f", None))
         self.states["/b"].addTransition(_b_0)
     
     def _a_enter(self):

+ 3 - 3
test/target_py/event_lifeline/12_take_many_queue.py

@@ -1,7 +1,7 @@
 """
 Generated by Statechart compiler by Glenn De Jonghe, Joeri Exelmans, Simon Van Mierlo, and Yentl Van Tendeloo (for the inspiration)
 
-Date:   Thu Aug 04 12:51:04 2016
+Date:   Fri Aug 05 16:13:32 2016
 
 Model author: Herr Joeri Exelmans
 Model name:   take_many_queue
@@ -64,12 +64,12 @@ class c(RuntimeClassBase):
         # transition /a
         _a_0 = Transition(self, self.states["/a"], [self.states["/b"]])
         _a_0.setAction(self._a_0_exec)
-        _a_0.trigger = Event("e", "in")
+        _a_0.setTrigger(Event("e", "in"))
         self.states["/a"].addTransition(_a_0)
         
         # transition /b
         _b_0 = Transition(self, self.states["/b"], [self.states["/c"]])
-        _b_0.trigger = Event("f", None)
+        _b_0.setTrigger(Event("f", None))
         self.states["/b"].addTransition(_b_0)
     
     def _a_enter(self):

+ 5 - 4
test/target_py/event_lifeline/20_orthogonal_take_one_next_small_step.py

@@ -1,7 +1,7 @@
 """
 Generated by Statechart compiler by Glenn De Jonghe, Joeri Exelmans, Simon Van Mierlo, and Yentl Van Tendeloo (for the inspiration)
 
-Date:   Thu Aug 04 12:51:04 2016
+Date:   Fri Aug 05 16:13:32 2016
 
 Model author: Herr Joeri Exelmans
 Model name:   orthogonal_take_one_next_small_step
@@ -90,22 +90,23 @@ class c(RuntimeClassBase):
         # transition /p/o0/sa
         _p_o0_sa_0 = Transition(self, self.states["/p/o0/sa"], [self.states["/p/o0/sb"]])
         _p_o0_sa_0.setAction(self._p_o0_sa_0_exec)
-        _p_o0_sa_0.trigger = Event("f", None)
+        _p_o0_sa_0.setTrigger(Event("f", None))
         self.states["/p/o0/sa"].addTransition(_p_o0_sa_0)
         
         # transition /p/o0/sb
         _p_o0_sb_0 = Transition(self, self.states["/p/o0/sb"], [self.states["/p/o0/sa"]])
+        _p_o0_sb_0.setTrigger(None)
         self.states["/p/o0/sb"].addTransition(_p_o0_sb_0)
         
         # transition /p/o1/sc
         _p_o1_sc_0 = Transition(self, self.states["/p/o1/sc"], [self.states["/p/o1/sd"]])
         _p_o1_sc_0.setAction(self._p_o1_sc_0_exec)
-        _p_o1_sc_0.trigger = Event("e", "in")
+        _p_o1_sc_0.setTrigger(Event("e", "in"))
         self.states["/p/o1/sc"].addTransition(_p_o1_sc_0)
         
         # transition /p/o1/sd
         _p_o1_sd_0 = Transition(self, self.states["/p/o1/sd"], [self.states["/p/o1/se"]])
-        _p_o1_sd_0.trigger = Event("g", None)
+        _p_o1_sd_0.setTrigger(Event("g", None))
         self.states["/p/o1/sd"].addTransition(_p_o1_sd_0)
     
     def _p_o0_sa_enter(self):

+ 5 - 4
test/target_py/event_lifeline/21_orthogonal_take_one_queue.py

@@ -1,7 +1,7 @@
 """
 Generated by Statechart compiler by Glenn De Jonghe, Joeri Exelmans, Simon Van Mierlo, and Yentl Van Tendeloo (for the inspiration)
 
-Date:   Thu Aug 04 12:51:04 2016
+Date:   Fri Aug 05 16:13:32 2016
 
 Model author: Herr Joeri Exelmans
 Model name:   orthogonal_take_one_queue
@@ -88,22 +88,23 @@ class c(RuntimeClassBase):
         # transition /p/o0/sa
         _p_o0_sa_0 = Transition(self, self.states["/p/o0/sa"], [self.states["/p/o0/sb"]])
         _p_o0_sa_0.setAction(self._p_o0_sa_0_exec)
-        _p_o0_sa_0.trigger = Event("f", None)
+        _p_o0_sa_0.setTrigger(Event("f", None))
         self.states["/p/o0/sa"].addTransition(_p_o0_sa_0)
         
         # transition /p/o0/sb
         _p_o0_sb_0 = Transition(self, self.states["/p/o0/sb"], [self.states["/p/o0/sa"]])
+        _p_o0_sb_0.setTrigger(None)
         self.states["/p/o0/sb"].addTransition(_p_o0_sb_0)
         
         # transition /p/o1/sc
         _p_o1_sc_0 = Transition(self, self.states["/p/o1/sc"], [self.states["/p/o1/sd"]])
         _p_o1_sc_0.setAction(self._p_o1_sc_0_exec)
-        _p_o1_sc_0.trigger = Event("e", "in")
+        _p_o1_sc_0.setTrigger(Event("e", "in"))
         self.states["/p/o1/sc"].addTransition(_p_o1_sc_0)
         
         # transition /p/o1/sd
         _p_o1_sd_0 = Transition(self, self.states["/p/o1/sd"], [self.states["/p/o1/se"]])
-        _p_o1_sd_0.trigger = Event("g", None)
+        _p_o1_sd_0.setTrigger(Event("g", None))
         self.states["/p/o1/sd"].addTransition(_p_o1_sd_0)
     
     def _p_o0_sa_enter(self):

+ 5 - 4
test/target_py/event_lifeline/30_orthogonal_take_many_next_small_step.py

@@ -1,7 +1,7 @@
 """
 Generated by Statechart compiler by Glenn De Jonghe, Joeri Exelmans, Simon Van Mierlo, and Yentl Van Tendeloo (for the inspiration)
 
-Date:   Thu Aug 04 12:51:04 2016
+Date:   Fri Aug 05 16:13:32 2016
 
 Model author: Herr Joeri Exelmans
 Model name:   orthogonal_take_many_next_small_step
@@ -92,22 +92,23 @@ class c(RuntimeClassBase):
         # transition /p/o0/sa
         _p_o0_sa_0 = Transition(self, self.states["/p/o0/sa"], [self.states["/p/o0/sb"]])
         _p_o0_sa_0.setAction(self._p_o0_sa_0_exec)
-        _p_o0_sa_0.trigger = Event("f", None)
+        _p_o0_sa_0.setTrigger(Event("f", None))
         self.states["/p/o0/sa"].addTransition(_p_o0_sa_0)
         
         # transition /p/o0/sb
         _p_o0_sb_0 = Transition(self, self.states["/p/o0/sb"], [self.states["/p/o0/sa"]])
+        _p_o0_sb_0.setTrigger(None)
         self.states["/p/o0/sb"].addTransition(_p_o0_sb_0)
         
         # transition /p/o1/sc
         _p_o1_sc_0 = Transition(self, self.states["/p/o1/sc"], [self.states["/p/o1/sd"]])
         _p_o1_sc_0.setAction(self._p_o1_sc_0_exec)
-        _p_o1_sc_0.trigger = Event("e", "in")
+        _p_o1_sc_0.setTrigger(Event("e", "in"))
         self.states["/p/o1/sc"].addTransition(_p_o1_sc_0)
         
         # transition /p/o1/sd
         _p_o1_sd_0 = Transition(self, self.states["/p/o1/sd"], [self.states["/p/o1/se"]])
-        _p_o1_sd_0.trigger = Event("g", None)
+        _p_o1_sd_0.setTrigger(Event("g", None))
         self.states["/p/o1/sd"].addTransition(_p_o1_sd_0)
     
     def _p_o0_sa_enter(self):

+ 5 - 4
test/target_py/event_lifeline/31_orthogonal_take_many_next_combo_step.py

@@ -1,7 +1,7 @@
 """
 Generated by Statechart compiler by Glenn De Jonghe, Joeri Exelmans, Simon Van Mierlo, and Yentl Van Tendeloo (for the inspiration)
 
-Date:   Thu Aug 04 12:51:04 2016
+Date:   Fri Aug 05 16:13:32 2016
 
 Model author: Herr Joeri Exelmans
 Model name:   orthogonal_take_many_next_combo_step
@@ -87,22 +87,23 @@ class c(RuntimeClassBase):
         # transition /p/o0/sa
         _p_o0_sa_0 = Transition(self, self.states["/p/o0/sa"], [self.states["/p/o0/sb"]])
         _p_o0_sa_0.setAction(self._p_o0_sa_0_exec)
-        _p_o0_sa_0.trigger = Event("f", None)
+        _p_o0_sa_0.setTrigger(Event("f", None))
         self.states["/p/o0/sa"].addTransition(_p_o0_sa_0)
         
         # transition /p/o0/sb
         _p_o0_sb_0 = Transition(self, self.states["/p/o0/sb"], [self.states["/p/o0/sa"]])
+        _p_o0_sb_0.setTrigger(None)
         self.states["/p/o0/sb"].addTransition(_p_o0_sb_0)
         
         # transition /p/o1/sc
         _p_o1_sc_0 = Transition(self, self.states["/p/o1/sc"], [self.states["/p/o1/sd"]])
         _p_o1_sc_0.setAction(self._p_o1_sc_0_exec)
-        _p_o1_sc_0.trigger = Event("e", "in")
+        _p_o1_sc_0.setTrigger(Event("e", "in"))
         self.states["/p/o1/sc"].addTransition(_p_o1_sc_0)
         
         # transition /p/o1/sd
         _p_o1_sd_0 = Transition(self, self.states["/p/o1/sd"], [self.states["/p/o1/se"]])
-        _p_o1_sd_0.trigger = Event("g", None)
+        _p_o1_sd_0.setTrigger(Event("g", None))
         self.states["/p/o1/sd"].addTransition(_p_o1_sd_0)
     
     def _p_o0_sa_enter(self):

+ 5 - 4
test/target_py/event_lifeline/32_orthogonal_take_many_queue.py

@@ -1,7 +1,7 @@
 """
 Generated by Statechart compiler by Glenn De Jonghe, Joeri Exelmans, Simon Van Mierlo, and Yentl Van Tendeloo (for the inspiration)
 
-Date:   Thu Aug 04 12:51:04 2016
+Date:   Fri Aug 05 16:13:32 2016
 
 Model author: Herr Joeri Exelmans
 Model name:   orthogonal_take_many_queue
@@ -88,22 +88,23 @@ class c(RuntimeClassBase):
         # transition /p/o0/sa
         _p_o0_sa_0 = Transition(self, self.states["/p/o0/sa"], [self.states["/p/o0/sb"]])
         _p_o0_sa_0.setAction(self._p_o0_sa_0_exec)
-        _p_o0_sa_0.trigger = Event("f", None)
+        _p_o0_sa_0.setTrigger(Event("f", None))
         self.states["/p/o0/sa"].addTransition(_p_o0_sa_0)
         
         # transition /p/o0/sb
         _p_o0_sb_0 = Transition(self, self.states["/p/o0/sb"], [self.states["/p/o0/sa"]])
+        _p_o0_sb_0.setTrigger(None)
         self.states["/p/o0/sb"].addTransition(_p_o0_sb_0)
         
         # transition /p/o1/sc
         _p_o1_sc_0 = Transition(self, self.states["/p/o1/sc"], [self.states["/p/o1/sd"]])
         _p_o1_sc_0.setAction(self._p_o1_sc_0_exec)
-        _p_o1_sc_0.trigger = Event("e", "in")
+        _p_o1_sc_0.setTrigger(Event("e", "in"))
         self.states["/p/o1/sc"].addTransition(_p_o1_sc_0)
         
         # transition /p/o1/sd
         _p_o1_sd_0 = Transition(self, self.states["/p/o1/sd"], [self.states["/p/o1/se"]])
-        _p_o1_sd_0.trigger = Event("g", None)
+        _p_o1_sd_0.setTrigger(Event("g", None))
         self.states["/p/o1/sd"].addTransition(_p_o1_sd_0)
     
     def _p_o0_sa_enter(self):

+ 3 - 3
test/target_py/no_statechart/00_no_statechart_py.py

@@ -1,7 +1,7 @@
 """
 Generated by Statechart compiler by Glenn De Jonghe, Joeri Exelmans, Simon Van Mierlo, and Yentl Van Tendeloo (for the inspiration)
 
-Date:   Thu Aug 04 12:51:04 2016
+Date:   Fri Aug 05 16:13:33 2016
 
 Model author: Herr Joeri Exelmans
 Model name:   no_statechart
@@ -78,14 +78,14 @@ class my_class(RuntimeClassBase):
         # transition /a
         _a_0 = Transition(self, self.states["/a"], [self.states["/b"]])
         _a_0.setAction(self._a_0_exec)
-        _a_0.trigger = Event("_0after")
+        _a_0.setTrigger(Event("_0after"))
         _a_0.setGuard(self._a_0_guard)
         self.states["/a"].addTransition(_a_0)
         
         # transition /b
         _b_0 = Transition(self, self.states["/b"], [self.states["/a"]])
         _b_0.setAction(self._b_0_exec)
-        _b_0.trigger = Event("_1after")
+        _b_0.setTrigger(Event("_1after"))
         _b_0.setGuard(self._b_0_guard)
         self.states["/b"].addTransition(_b_0)
     

+ 3 - 3
test/target_py/original_semantics/after.py

@@ -1,7 +1,7 @@
 """
 Generated by Statechart compiler by Glenn De Jonghe, Joeri Exelmans, Simon Van Mierlo, and Yentl Van Tendeloo (for the inspiration)
 
-Date:   Thu Aug 04 12:51:04 2016
+Date:   Fri Aug 05 16:13:33 2016
 
 Model author: Glenn De Jonghe
 Model name:   TestAfter
@@ -69,10 +69,10 @@ class Class1(RuntimeClassBase):
         
         # transition /composite/state_1
         _composite_state_1_0 = Transition(self, self.states["/composite/state_1"], [self.states["/composite/state_2"]])
-        _composite_state_1_0.trigger = Event("_0after")
+        _composite_state_1_0.setTrigger(Event("_0after"))
         self.states["/composite/state_1"].addTransition(_composite_state_1_0)
         _composite_state_1_1 = Transition(self, self.states["/composite/state_1"], [self.states["/composite/state_3"]])
-        _composite_state_1_1.trigger = Event("_1after")
+        _composite_state_1_1.setTrigger(Event("_1after"))
         self.states["/composite/state_1"].addTransition(_composite_state_1_1)
     
     def _composite_state_1_enter(self):

+ 4 - 4
test/target_py/original_semantics/associate_event.py

@@ -1,7 +1,7 @@
 """
 Generated by Statechart compiler by Glenn De Jonghe, Joeri Exelmans, Simon Van Mierlo, and Yentl Van Tendeloo (for the inspiration)
 
-Date:   Thu Aug 04 12:51:05 2016
+Date:   Fri Aug 05 16:13:33 2016
 
 Model author: Glenn De Jonghe
 Model name:   TestAssociateEvent
@@ -57,13 +57,13 @@ class Class1(RuntimeClassBase):
         # transition /start
         _start_0 = Transition(self, self.states["/start"], [self.states["/wait"]])
         _start_0.setAction(self._start_0_exec)
-        _start_0.trigger = Event("create", "test_input")
+        _start_0.setTrigger(Event("create", "test_input"))
         self.states["/start"].addTransition(_start_0)
         
         # transition /wait
         _wait_0 = Transition(self, self.states["/wait"], [self.states["/start"]])
         _wait_0.setAction(self._wait_0_exec)
-        _wait_0.trigger = Event("instance_created", None)
+        _wait_0.setTrigger(Event("instance_created", None))
         self.states["/wait"].addTransition(_wait_0)
     
     def _start_0_exec(self, parameters):
@@ -125,7 +125,7 @@ class Class2(RuntimeClassBase):
         # transition /start
         _start_0 = Transition(self, self.states["/start"], [self.states["/start"]])
         _start_0.setAction(self._start_0_exec)
-        _start_0.trigger = Event("hello", None)
+        _start_0.setTrigger(Event("hello", None))
         self.states["/start"].addTransition(_start_0)
     
     def _start_0_exec(self, parameters):

+ 1 - 1
test/target_py/original_semantics/correct_duplicate_state_id.py

@@ -1,7 +1,7 @@
 """
 Generated by Statechart compiler by Glenn De Jonghe, Joeri Exelmans, Simon Van Mierlo, and Yentl Van Tendeloo (for the inspiration)
 
-Date:   Thu Aug 04 12:51:05 2016
+Date:   Fri Aug 05 16:13:33 2016
 
 Model author: Glenn De Jonghe
 Model name:   TestCorrectDuplicateStateId

+ 6 - 6
test/target_py/original_semantics/enter_exit_hierarchy.py

@@ -1,7 +1,7 @@
 """
 Generated by Statechart compiler by Glenn De Jonghe, Joeri Exelmans, Simon Van Mierlo, and Yentl Van Tendeloo (for the inspiration)
 
-Date:   Thu Aug 04 12:51:05 2016
+Date:   Fri Aug 05 16:13:33 2016
 
 Model author: Glenn De Jonghe
 Model name:   TestEnterExitHierarchy
@@ -95,23 +95,23 @@ class Class1(RuntimeClassBase):
         
         # transition /outside
         _outside_0 = Transition(self, self.states["/outside"], [self.states["/composite"]])
-        _outside_0.trigger = Event("to_composite", "test_input")
+        _outside_0.setTrigger(Event("to_composite", "test_input"))
         self.states["/outside"].addTransition(_outside_0)
         _outside_1 = Transition(self, self.states["/outside"], [self.states["/composite/state2/inner3"]])
-        _outside_1.trigger = Event("to_inner3", "test_input")
+        _outside_1.setTrigger(Event("to_inner3", "test_input"))
         self.states["/outside"].addTransition(_outside_1)
         _outside_2 = Transition(self, self.states["/outside"], [self.states["/composite/state2/inner4"]])
-        _outside_2.trigger = Event("to_inner4", "test_input")
+        _outside_2.setTrigger(Event("to_inner4", "test_input"))
         self.states["/outside"].addTransition(_outside_2)
         
         # transition /composite/state1/inner1
         _composite_state1_inner1_0 = Transition(self, self.states["/composite/state1/inner1"], [self.states["/composite/state1/inner2"]])
-        _composite_state1_inner1_0.trigger = Event("to_inner2", "test_input")
+        _composite_state1_inner1_0.setTrigger(Event("to_inner2", "test_input"))
         self.states["/composite/state1/inner1"].addTransition(_composite_state1_inner1_0)
         
         # transition /composite
         _composite_0 = Transition(self, self.states["/composite"], [self.states["/outside"]])
-        _composite_0.trigger = Event("to_outside", "test_input")
+        _composite_0.setTrigger(Event("to_outside", "test_input"))
         self.states["/composite"].addTransition(_composite_0)
     
     def _composite_state1_enter(self):

+ 4 - 1
test/target_py/original_semantics/guard.py

@@ -1,7 +1,7 @@
 """
 Generated by Statechart compiler by Glenn De Jonghe, Joeri Exelmans, Simon Van Mierlo, and Yentl Van Tendeloo (for the inspiration)
 
-Date:   Thu Aug 04 12:51:05 2016
+Date:   Fri Aug 05 16:13:33 2016
 
 Model author: Glenn De Jonghe
 Model name:   TestGuard
@@ -65,13 +65,16 @@ class Class1(RuntimeClassBase):
         
         # transition /state_1
         _state_1_0 = Transition(self, self.states["/state_1"], [self.states["/state_2"]])
+        _state_1_0.setTrigger(None)
         self.states["/state_1"].addTransition(_state_1_0)
         
         # transition /state_2
         _state_2_0 = Transition(self, self.states["/state_2"], [self.states["/state_1"]])
+        _state_2_0.setTrigger(None)
         _state_2_0.setGuard(self._state_2_0_guard)
         self.states["/state_2"].addTransition(_state_2_0)
         _state_2_1 = Transition(self, self.states["/state_2"], [self.states["/state_3"]])
+        _state_2_1.setTrigger(None)
         _state_2_1.setGuard(self._state_2_1_guard)
         self.states["/state_2"].addTransition(_state_2_1)
     

+ 4 - 3
test/target_py/original_semantics/history.py

@@ -1,7 +1,7 @@
 """
 Generated by Statechart compiler by Glenn De Jonghe, Joeri Exelmans, Simon Van Mierlo, and Yentl Van Tendeloo (for the inspiration)
 
-Date:   Thu Aug 04 12:51:05 2016
+Date:   Fri Aug 05 16:13:33 2016
 
 Model author: Glenn De Jonghe
 Model name:   TestHistory
@@ -72,16 +72,17 @@ class Class1(RuntimeClassBase):
         
         # transition /composite_1/state_1
         _composite_1_state_1_0 = Transition(self, self.states["/composite_1/state_1"], [self.states["/composite_1/state_2"]])
-        _composite_1_state_1_0.trigger = Event("to_state_2", "test_input")
+        _composite_1_state_1_0.setTrigger(Event("to_state_2", "test_input"))
         self.states["/composite_1/state_1"].addTransition(_composite_1_state_1_0)
         
         # transition /state_3
         _state_3_0 = Transition(self, self.states["/state_3"], [self.states["/composite_1/composite_history"]])
+        _state_3_0.setTrigger(None)
         self.states["/state_3"].addTransition(_state_3_0)
         
         # transition /composite_1
         _composite_1_0 = Transition(self, self.states["/composite_1"], [self.states["/state_3"]])
-        _composite_1_0.trigger = Event("to_state_3", "test_input")
+        _composite_1_0.setTrigger(Event("to_state_3", "test_input"))
         self.states["/composite_1"].addTransition(_composite_1_0)
     
     def _composite_1_state_1_enter(self):

+ 9 - 5
test/target_py/original_semantics/history_deep.py

@@ -1,7 +1,7 @@
 """
 Generated by Statechart compiler by Glenn De Jonghe, Joeri Exelmans, Simon Van Mierlo, and Yentl Van Tendeloo (for the inspiration)
 
-Date:   Thu Aug 04 12:51:05 2016
+Date:   Fri Aug 05 16:13:33 2016
 
 Model author: Glenn De Jonghe
 Model name:   TestHistoryDeep
@@ -121,45 +121,49 @@ class Class1(RuntimeClassBase):
         
         # transition /parallel/orthogonal/wrapper/state_2/inner_3
         _parallel_orthogonal_wrapper_state_2_inner_3_0 = Transition(self, self.states["/parallel/orthogonal/wrapper/state_2/inner_3"], [self.states["/parallel/orthogonal/wrapper/state_2/inner_4"]])
-        _parallel_orthogonal_wrapper_state_2_inner_3_0.trigger = Event("to_inner_4", None)
+        _parallel_orthogonal_wrapper_state_2_inner_3_0.setTrigger(Event("to_inner_4", None))
         self.states["/parallel/orthogonal/wrapper/state_2/inner_3"].addTransition(_parallel_orthogonal_wrapper_state_2_inner_3_0)
         
         # transition /parallel/orthogonal/outer
         _parallel_orthogonal_outer_0 = Transition(self, self.states["/parallel/orthogonal/outer"], [self.states["/parallel/orthogonal/wrapper/history"]])
-        _parallel_orthogonal_outer_0.trigger = Event("to_history", None)
+        _parallel_orthogonal_outer_0.setTrigger(Event("to_history", None))
         self.states["/parallel/orthogonal/outer"].addTransition(_parallel_orthogonal_outer_0)
         
         # transition /parallel/orthogonal_tester/start
         _parallel_orthogonal_tester_start_0 = Transition(self, self.states["/parallel/orthogonal_tester/start"], [self.states["/parallel/orthogonal_tester/step1"]])
         _parallel_orthogonal_tester_start_0.setAction(self._parallel_orthogonal_tester_start_0_exec)
+        _parallel_orthogonal_tester_start_0.setTrigger(None)
         self.states["/parallel/orthogonal_tester/start"].addTransition(_parallel_orthogonal_tester_start_0)
         
         # transition /parallel/orthogonal_tester/step1
         _parallel_orthogonal_tester_step1_0 = Transition(self, self.states["/parallel/orthogonal_tester/step1"], [self.states["/parallel/orthogonal_tester/step2"]])
         _parallel_orthogonal_tester_step1_0.setAction(self._parallel_orthogonal_tester_step1_0_exec)
+        _parallel_orthogonal_tester_step1_0.setTrigger(None)
         _parallel_orthogonal_tester_step1_0.setGuard(self._parallel_orthogonal_tester_step1_0_guard)
         self.states["/parallel/orthogonal_tester/step1"].addTransition(_parallel_orthogonal_tester_step1_0)
         
         # transition /parallel/orthogonal_tester/step2
         _parallel_orthogonal_tester_step2_0 = Transition(self, self.states["/parallel/orthogonal_tester/step2"], [self.states["/parallel/orthogonal_tester/step3"]])
         _parallel_orthogonal_tester_step2_0.setAction(self._parallel_orthogonal_tester_step2_0_exec)
+        _parallel_orthogonal_tester_step2_0.setTrigger(None)
         _parallel_orthogonal_tester_step2_0.setGuard(self._parallel_orthogonal_tester_step2_0_guard)
         self.states["/parallel/orthogonal_tester/step2"].addTransition(_parallel_orthogonal_tester_step2_0)
         
         # transition /parallel/orthogonal_tester/step3
         _parallel_orthogonal_tester_step3_0 = Transition(self, self.states["/parallel/orthogonal_tester/step3"], [self.states["/parallel/orthogonal_tester/end"]])
         _parallel_orthogonal_tester_step3_0.setAction(self._parallel_orthogonal_tester_step3_0_exec)
+        _parallel_orthogonal_tester_step3_0.setTrigger(None)
         _parallel_orthogonal_tester_step3_0.setGuard(self._parallel_orthogonal_tester_step3_0_guard)
         self.states["/parallel/orthogonal_tester/step3"].addTransition(_parallel_orthogonal_tester_step3_0)
         
         # transition /parallel/orthogonal/wrapper
         _parallel_orthogonal_wrapper_0 = Transition(self, self.states["/parallel/orthogonal/wrapper"], [self.states["/parallel/orthogonal/outer"]])
-        _parallel_orthogonal_wrapper_0.trigger = Event("to_outer", None)
+        _parallel_orthogonal_wrapper_0.setTrigger(Event("to_outer", None))
         self.states["/parallel/orthogonal/wrapper"].addTransition(_parallel_orthogonal_wrapper_0)
         
         # transition /parallel/orthogonal/wrapper/state_1
         _parallel_orthogonal_wrapper_state_1_0 = Transition(self, self.states["/parallel/orthogonal/wrapper/state_1"], [self.states["/parallel/orthogonal/wrapper/state_2"]])
-        _parallel_orthogonal_wrapper_state_1_0.trigger = Event("to_state_2", None)
+        _parallel_orthogonal_wrapper_state_1_0.setTrigger(Event("to_state_2", None))
         self.states["/parallel/orthogonal/wrapper/state_1"].addTransition(_parallel_orthogonal_wrapper_state_1_0)
     
     def _parallel_orthogonal_tester_start_0_exec(self, parameters):

+ 9 - 5
test/target_py/original_semantics/history_parallel_deep.py

@@ -1,7 +1,7 @@
 """
 Generated by Statechart compiler by Glenn De Jonghe, Joeri Exelmans, Simon Van Mierlo, and Yentl Van Tendeloo (for the inspiration)
 
-Date:   Thu Aug 04 12:51:05 2016
+Date:   Fri Aug 05 16:13:34 2016
 
 Model author: Glenn De Jonghe
 Model name:   TestHistoryParallelDeep
@@ -120,45 +120,49 @@ class Class1(RuntimeClassBase):
         
         # transition /parallel/orthogonal/wrapper/state_1/inner_1
         _parallel_orthogonal_wrapper_state_1_inner_1_0 = Transition(self, self.states["/parallel/orthogonal/wrapper/state_1/inner_1"], [self.states["/parallel/orthogonal/wrapper/state_1/inner_2"]])
-        _parallel_orthogonal_wrapper_state_1_inner_1_0.trigger = Event("to_inner_2", None)
+        _parallel_orthogonal_wrapper_state_1_inner_1_0.setTrigger(Event("to_inner_2", None))
         self.states["/parallel/orthogonal/wrapper/state_1/inner_1"].addTransition(_parallel_orthogonal_wrapper_state_1_inner_1_0)
         
         # transition /parallel/orthogonal/wrapper/state_2/inner_3
         _parallel_orthogonal_wrapper_state_2_inner_3_0 = Transition(self, self.states["/parallel/orthogonal/wrapper/state_2/inner_3"], [self.states["/parallel/orthogonal/wrapper/state_2/inner_4"]])
-        _parallel_orthogonal_wrapper_state_2_inner_3_0.trigger = Event("to_inner_4", None)
+        _parallel_orthogonal_wrapper_state_2_inner_3_0.setTrigger(Event("to_inner_4", None))
         self.states["/parallel/orthogonal/wrapper/state_2/inner_3"].addTransition(_parallel_orthogonal_wrapper_state_2_inner_3_0)
         
         # transition /parallel/orthogonal/outer
         _parallel_orthogonal_outer_0 = Transition(self, self.states["/parallel/orthogonal/outer"], [self.states["/parallel/orthogonal/wrapper/history"]])
-        _parallel_orthogonal_outer_0.trigger = Event("to_history", None)
+        _parallel_orthogonal_outer_0.setTrigger(Event("to_history", None))
         self.states["/parallel/orthogonal/outer"].addTransition(_parallel_orthogonal_outer_0)
         
         # transition /parallel/orthogonal_tester/start
         _parallel_orthogonal_tester_start_0 = Transition(self, self.states["/parallel/orthogonal_tester/start"], [self.states["/parallel/orthogonal_tester/step1"]])
         _parallel_orthogonal_tester_start_0.setAction(self._parallel_orthogonal_tester_start_0_exec)
+        _parallel_orthogonal_tester_start_0.setTrigger(None)
         self.states["/parallel/orthogonal_tester/start"].addTransition(_parallel_orthogonal_tester_start_0)
         
         # transition /parallel/orthogonal_tester/step1
         _parallel_orthogonal_tester_step1_0 = Transition(self, self.states["/parallel/orthogonal_tester/step1"], [self.states["/parallel/orthogonal_tester/step2"]])
         _parallel_orthogonal_tester_step1_0.setAction(self._parallel_orthogonal_tester_step1_0_exec)
+        _parallel_orthogonal_tester_step1_0.setTrigger(None)
         _parallel_orthogonal_tester_step1_0.setGuard(self._parallel_orthogonal_tester_step1_0_guard)
         self.states["/parallel/orthogonal_tester/step1"].addTransition(_parallel_orthogonal_tester_step1_0)
         
         # transition /parallel/orthogonal_tester/step2
         _parallel_orthogonal_tester_step2_0 = Transition(self, self.states["/parallel/orthogonal_tester/step2"], [self.states["/parallel/orthogonal_tester/step3"]])
         _parallel_orthogonal_tester_step2_0.setAction(self._parallel_orthogonal_tester_step2_0_exec)
+        _parallel_orthogonal_tester_step2_0.setTrigger(None)
         _parallel_orthogonal_tester_step2_0.setGuard(self._parallel_orthogonal_tester_step2_0_guard)
         self.states["/parallel/orthogonal_tester/step2"].addTransition(_parallel_orthogonal_tester_step2_0)
         
         # transition /parallel/orthogonal_tester/step3
         _parallel_orthogonal_tester_step3_0 = Transition(self, self.states["/parallel/orthogonal_tester/step3"], [self.states["/parallel/orthogonal_tester/end"]])
         _parallel_orthogonal_tester_step3_0.setAction(self._parallel_orthogonal_tester_step3_0_exec)
+        _parallel_orthogonal_tester_step3_0.setTrigger(None)
         _parallel_orthogonal_tester_step3_0.setGuard(self._parallel_orthogonal_tester_step3_0_guard)
         self.states["/parallel/orthogonal_tester/step3"].addTransition(_parallel_orthogonal_tester_step3_0)
         
         # transition /parallel/orthogonal/wrapper
         _parallel_orthogonal_wrapper_0 = Transition(self, self.states["/parallel/orthogonal/wrapper"], [self.states["/parallel/orthogonal/outer"]])
-        _parallel_orthogonal_wrapper_0.trigger = Event("to_outer", None)
+        _parallel_orthogonal_wrapper_0.setTrigger(Event("to_outer", None))
         self.states["/parallel/orthogonal/wrapper"].addTransition(_parallel_orthogonal_wrapper_0)
     
     def _parallel_orthogonal_tester_start_0_exec(self, parameters):

+ 3 - 3
test/target_py/original_semantics/inner_first.py

@@ -1,7 +1,7 @@
 """
 Generated by Statechart compiler by Glenn De Jonghe, Joeri Exelmans, Simon Van Mierlo, and Yentl Van Tendeloo (for the inspiration)
 
-Date:   Thu Aug 04 12:51:05 2016
+Date:   Fri Aug 05 16:13:34 2016
 
 Model author: Glenn De Jonghe
 Model name:   TestInnerFirst
@@ -67,12 +67,12 @@ class Class1(RuntimeClassBase):
         
         # transition /state1/state1
         _state1_state1_0 = Transition(self, self.states["/state1/state1"], [self.states["/state1/statea"]])
-        _state1_state1_0.trigger = Event("event", "test_input")
+        _state1_state1_0.setTrigger(Event("event", "test_input"))
         self.states["/state1/state1"].addTransition(_state1_state1_0)
         
         # transition /state1
         _state1_0 = Transition(self, self.states["/state1"], [self.states["/stateb"]])
-        _state1_0.trigger = Event("event", "test_input")
+        _state1_0.setTrigger(Event("event", "test_input"))
         self.states["/state1"].addTransition(_state1_0)
     
     def _state1_statea_enter(self):

+ 6 - 3
test/target_py/original_semantics/instate.py

@@ -1,7 +1,7 @@
 """
 Generated by Statechart compiler by Glenn De Jonghe, Joeri Exelmans, Simon Van Mierlo, and Yentl Van Tendeloo (for the inspiration)
 
-Date:   Thu Aug 04 12:51:05 2016
+Date:   Fri Aug 05 16:13:34 2016
 
 Model author: Glenn De Jonghe
 Model name:   TestInstate
@@ -87,25 +87,28 @@ class Class1(RuntimeClassBase):
         
         # transition /parallel_1/orthogonal1/state1
         _parallel_1_orthogonal1_state1_0 = Transition(self, self.states["/parallel_1/orthogonal1/state1"], [self.states["/parallel_1/orthogonal1/inner"]])
-        _parallel_1_orthogonal1_state1_0.trigger = Event("to_inner", None)
+        _parallel_1_orthogonal1_state1_0.setTrigger(Event("to_inner", None))
         self.states["/parallel_1/orthogonal1/state1"].addTransition(_parallel_1_orthogonal1_state1_0)
         
         # transition /parallel_1/orthogonal1/inner/state2
         _parallel_1_orthogonal1_inner_state2_0 = Transition(self, self.states["/parallel_1/orthogonal1/inner/state2"], [self.states["/parallel_1/orthogonal1/inner/state3"]])
-        _parallel_1_orthogonal1_inner_state2_0.trigger = Event("to_state3", None)
+        _parallel_1_orthogonal1_inner_state2_0.setTrigger(Event("to_state3", None))
         self.states["/parallel_1/orthogonal1/inner/state2"].addTransition(_parallel_1_orthogonal1_inner_state2_0)
         
         # transition /parallel_1/orthogonal2/tester
         _parallel_1_orthogonal2_tester_0 = Transition(self, self.states["/parallel_1/orthogonal2/tester"], [self.states["/parallel_1/orthogonal2/tester"]])
         _parallel_1_orthogonal2_tester_0.setAction(self._parallel_1_orthogonal2_tester_0_exec)
+        _parallel_1_orthogonal2_tester_0.setTrigger(None)
         _parallel_1_orthogonal2_tester_0.setGuard(self._parallel_1_orthogonal2_tester_0_guard)
         self.states["/parallel_1/orthogonal2/tester"].addTransition(_parallel_1_orthogonal2_tester_0)
         _parallel_1_orthogonal2_tester_1 = Transition(self, self.states["/parallel_1/orthogonal2/tester"], [self.states["/parallel_1/orthogonal2/tester"]])
         _parallel_1_orthogonal2_tester_1.setAction(self._parallel_1_orthogonal2_tester_1_exec)
+        _parallel_1_orthogonal2_tester_1.setTrigger(None)
         _parallel_1_orthogonal2_tester_1.setGuard(self._parallel_1_orthogonal2_tester_1_guard)
         self.states["/parallel_1/orthogonal2/tester"].addTransition(_parallel_1_orthogonal2_tester_1)
         _parallel_1_orthogonal2_tester_2 = Transition(self, self.states["/parallel_1/orthogonal2/tester"], [self.states["/parallel_1/orthogonal2/stop"]])
         _parallel_1_orthogonal2_tester_2.setAction(self._parallel_1_orthogonal2_tester_2_exec)
+        _parallel_1_orthogonal2_tester_2.setTrigger(None)
         _parallel_1_orthogonal2_tester_2.setGuard(self._parallel_1_orthogonal2_tester_2_guard)
         self.states["/parallel_1/orthogonal2/tester"].addTransition(_parallel_1_orthogonal2_tester_2)
     

+ 2 - 1
test/target_py/original_semantics/multiple_target.py

@@ -1,7 +1,7 @@
 """
 Generated by Statechart compiler by Glenn De Jonghe, Joeri Exelmans, Simon Van Mierlo, and Yentl Van Tendeloo (for the inspiration)
 
-Date:   Thu Aug 04 12:51:06 2016
+Date:   Fri Aug 05 16:13:34 2016
 
 Model author: Glenn De Jonghe
 Model name:   TestMultipleTarget
@@ -87,6 +87,7 @@ class Class1(RuntimeClassBase):
         
         # transition /next_to_parallel
         _next_to_parallel_0 = Transition(self, self.states["/next_to_parallel"], [self.states["/parallel/orthogonal_1/inner_2"], self.states["/parallel/orthogonal_2/inner_2"]])
+        _next_to_parallel_0.setTrigger(None)
         self.states["/next_to_parallel"].addTransition(_next_to_parallel_0)
     
     def _parallel_orthogonal_1_inner_1_enter(self):

+ 4 - 4
test/target_py/original_semantics/object_manager.py

@@ -1,7 +1,7 @@
 """
 Generated by Statechart compiler by Glenn De Jonghe, Joeri Exelmans, Simon Van Mierlo, and Yentl Van Tendeloo (for the inspiration)
 
-Date:   Thu Aug 04 12:51:06 2016
+Date:   Fri Aug 05 16:13:34 2016
 
 Model author: Glenn De Jonghe
 Model name:   TestObjectManager
@@ -57,13 +57,13 @@ class Class1(RuntimeClassBase):
         # transition /start
         _start_0 = Transition(self, self.states["/start"], [self.states["/wait"]])
         _start_0.setAction(self._start_0_exec)
-        _start_0.trigger = Event("create", "test_input")
+        _start_0.setTrigger(Event("create", "test_input"))
         self.states["/start"].addTransition(_start_0)
         
         # transition /wait
         _wait_0 = Transition(self, self.states["/wait"], [self.states["/start"]])
         _wait_0.setAction(self._wait_0_exec)
-        _wait_0.trigger = Event("instance_created", None)
+        _wait_0.setTrigger(Event("instance_created", None))
         self.states["/wait"].addTransition(_wait_0)
     
     def _start_0_exec(self, parameters):
@@ -124,7 +124,7 @@ class Class2(RuntimeClassBase):
         # transition /start
         _start_0 = Transition(self, self.states["/start"], [self.states["/start"]])
         _start_0.setAction(self._start_0_exec)
-        _start_0.trigger = Event("hello", None)
+        _start_0.setTrigger(Event("hello", None))
         self.states["/start"].addTransition(_start_0)
     
     def _start_0_exec(self, parameters):

+ 3 - 3
test/target_py/original_semantics/outer_first.py

@@ -1,7 +1,7 @@
 """
 Generated by Statechart compiler by Glenn De Jonghe, Joeri Exelmans, Simon Van Mierlo, and Yentl Van Tendeloo (for the inspiration)
 
-Date:   Thu Aug 04 12:51:06 2016
+Date:   Fri Aug 05 16:13:34 2016
 
 Model author: Glenn De Jonghe
 Model name:   TestOuterFirst
@@ -67,12 +67,12 @@ class Class1(RuntimeClassBase):
         
         # transition /state1/state1
         _state1_state1_0 = Transition(self, self.states["/state1/state1"], [self.states["/state1/statea"]])
-        _state1_state1_0.trigger = Event("event", "test_input")
+        _state1_state1_0.setTrigger(Event("event", "test_input"))
         self.states["/state1/state1"].addTransition(_state1_state1_0)
         
         # transition /state1
         _state1_0 = Transition(self, self.states["/state1"], [self.states["/stateb"]])
-        _state1_0.trigger = Event("event", "test_input")
+        _state1_0.setTrigger(Event("event", "test_input"))
         self.states["/state1"].addTransition(_state1_0)
     
     def _state1_statea_enter(self):

+ 5 - 5
test/target_py/original_semantics/parallel.py

@@ -1,7 +1,7 @@
 """
 Generated by Statechart compiler by Glenn De Jonghe, Joeri Exelmans, Simon Van Mierlo, and Yentl Van Tendeloo (for the inspiration)
 
-Date:   Thu Aug 04 12:51:06 2016
+Date:   Fri Aug 05 16:13:34 2016
 
 Model author: Glenn De Jonghe
 Model name:   TestParallel
@@ -82,22 +82,22 @@ class Class1(RuntimeClassBase):
         
         # transition /parallel_1/orthogonal_1/state_1
         _parallel_1_orthogonal_1_state_1_0 = Transition(self, self.states["/parallel_1/orthogonal_1/state_1"], [self.states["/parallel_1/orthogonal_1/state_2"]])
-        _parallel_1_orthogonal_1_state_1_0.trigger = Event("to_state_2", "test_input")
+        _parallel_1_orthogonal_1_state_1_0.setTrigger(Event("to_state_2", "test_input"))
         self.states["/parallel_1/orthogonal_1/state_1"].addTransition(_parallel_1_orthogonal_1_state_1_0)
         
         # transition /parallel_1/orthogonal_1/state_2
         _parallel_1_orthogonal_1_state_2_0 = Transition(self, self.states["/parallel_1/orthogonal_1/state_2"], [self.states["/parallel_1/orthogonal_1/state_1"]])
-        _parallel_1_orthogonal_1_state_2_0.trigger = Event("to_state_1", "test_input")
+        _parallel_1_orthogonal_1_state_2_0.setTrigger(Event("to_state_1", "test_input"))
         self.states["/parallel_1/orthogonal_1/state_2"].addTransition(_parallel_1_orthogonal_1_state_2_0)
         
         # transition /parallel_1/orthogonal_2/state_3
         _parallel_1_orthogonal_2_state_3_0 = Transition(self, self.states["/parallel_1/orthogonal_2/state_3"], [self.states["/parallel_1/orthogonal_2/state_4"]])
-        _parallel_1_orthogonal_2_state_3_0.trigger = Event("to_state_4", "test_input")
+        _parallel_1_orthogonal_2_state_3_0.setTrigger(Event("to_state_4", "test_input"))
         self.states["/parallel_1/orthogonal_2/state_3"].addTransition(_parallel_1_orthogonal_2_state_3_0)
         
         # transition /parallel_1/orthogonal_2/state_4
         _parallel_1_orthogonal_2_state_4_0 = Transition(self, self.states["/parallel_1/orthogonal_2/state_4"], [self.states["/parallel_1/orthogonal_2/state_3"]])
-        _parallel_1_orthogonal_2_state_4_0.trigger = Event("to_state_3", "test_input")
+        _parallel_1_orthogonal_2_state_4_0.setTrigger(Event("to_state_3", "test_input"))
         self.states["/parallel_1/orthogonal_2/state_4"].addTransition(_parallel_1_orthogonal_2_state_4_0)
     
     def _parallel_1_orthogonal_1_state_1_enter(self):

+ 7 - 7
test/target_py/original_semantics/parallel_history.py

@@ -1,7 +1,7 @@
 """
 Generated by Statechart compiler by Glenn De Jonghe, Joeri Exelmans, Simon Van Mierlo, and Yentl Van Tendeloo (for the inspiration)
 
-Date:   Thu Aug 04 12:51:06 2016
+Date:   Fri Aug 05 16:13:34 2016
 
 Model author: Glenn De Jonghe
 Model name:   TestParallelHistory
@@ -110,32 +110,32 @@ class TestClass(RuntimeClassBase):
         
         # transition /parallel/orthogonal_1/orthogonal_inner_1/state_1
         _parallel_orthogonal_1_orthogonal_inner_1_state_1_0 = Transition(self, self.states["/parallel/orthogonal_1/orthogonal_inner_1/state_1"], [self.states["/parallel/orthogonal_1/orthogonal_inner_1/state_2"]])
-        _parallel_orthogonal_1_orthogonal_inner_1_state_1_0.trigger = Event("to_state_2", "test_input")
+        _parallel_orthogonal_1_orthogonal_inner_1_state_1_0.setTrigger(Event("to_state_2", "test_input"))
         self.states["/parallel/orthogonal_1/orthogonal_inner_1/state_1"].addTransition(_parallel_orthogonal_1_orthogonal_inner_1_state_1_0)
         
         # transition /parallel/orthogonal_1/outer_1
         _parallel_orthogonal_1_outer_1_0 = Transition(self, self.states["/parallel/orthogonal_1/outer_1"], [self.states["/parallel/orthogonal_1/orthogonal_inner_1/history_1"]])
-        _parallel_orthogonal_1_outer_1_0.trigger = Event("to_history_1", "test_input")
+        _parallel_orthogonal_1_outer_1_0.setTrigger(Event("to_history_1", "test_input"))
         self.states["/parallel/orthogonal_1/outer_1"].addTransition(_parallel_orthogonal_1_outer_1_0)
         
         # transition /parallel/orthogonal_2/orthogonal_inner_2/state_3
         _parallel_orthogonal_2_orthogonal_inner_2_state_3_0 = Transition(self, self.states["/parallel/orthogonal_2/orthogonal_inner_2/state_3"], [self.states["/parallel/orthogonal_2/orthogonal_inner_2/state_4"]])
-        _parallel_orthogonal_2_orthogonal_inner_2_state_3_0.trigger = Event("to_state_4", "test_input")
+        _parallel_orthogonal_2_orthogonal_inner_2_state_3_0.setTrigger(Event("to_state_4", "test_input"))
         self.states["/parallel/orthogonal_2/orthogonal_inner_2/state_3"].addTransition(_parallel_orthogonal_2_orthogonal_inner_2_state_3_0)
         
         # transition /parallel/orthogonal_2/outer_2
         _parallel_orthogonal_2_outer_2_0 = Transition(self, self.states["/parallel/orthogonal_2/outer_2"], [self.states["/parallel/orthogonal_2/orthogonal_inner_2/history_2"]])
-        _parallel_orthogonal_2_outer_2_0.trigger = Event("to_history_2", "test_input")
+        _parallel_orthogonal_2_outer_2_0.setTrigger(Event("to_history_2", "test_input"))
         self.states["/parallel/orthogonal_2/outer_2"].addTransition(_parallel_orthogonal_2_outer_2_0)
         
         # transition /parallel/orthogonal_1/orthogonal_inner_1
         _parallel_orthogonal_1_orthogonal_inner_1_0 = Transition(self, self.states["/parallel/orthogonal_1/orthogonal_inner_1"], [self.states["/parallel/orthogonal_1/outer_1"]])
-        _parallel_orthogonal_1_orthogonal_inner_1_0.trigger = Event("to_outer_1", "test_input")
+        _parallel_orthogonal_1_orthogonal_inner_1_0.setTrigger(Event("to_outer_1", "test_input"))
         self.states["/parallel/orthogonal_1/orthogonal_inner_1"].addTransition(_parallel_orthogonal_1_orthogonal_inner_1_0)
         
         # transition /parallel/orthogonal_2/orthogonal_inner_2
         _parallel_orthogonal_2_orthogonal_inner_2_0 = Transition(self, self.states["/parallel/orthogonal_2/orthogonal_inner_2"], [self.states["/parallel/orthogonal_2/outer_2"]])
-        _parallel_orthogonal_2_orthogonal_inner_2_0.trigger = Event("to_outer_2", "test_input")
+        _parallel_orthogonal_2_orthogonal_inner_2_0.setTrigger(Event("to_outer_2", "test_input"))
         self.states["/parallel/orthogonal_2/orthogonal_inner_2"].addTransition(_parallel_orthogonal_2_orthogonal_inner_2_0)
     
     def _parallel_orthogonal_1_orthogonal_inner_1_state_1_enter(self):

+ 7 - 7
test/target_py/original_semantics/parallel_history_2.py

@@ -1,7 +1,7 @@
 """
 Generated by Statechart compiler by Glenn De Jonghe, Joeri Exelmans, Simon Van Mierlo, and Yentl Van Tendeloo (for the inspiration)
 
-Date:   Thu Aug 04 12:51:06 2016
+Date:   Fri Aug 05 16:13:34 2016
 
 Model author: Glenn De Jonghe
 Model name:   TestParallelHistory2
@@ -111,32 +111,32 @@ class TestClass(RuntimeClassBase):
         
         # transition /parallel/orthogonal_1/orthogonal_inner_1/state_1
         _parallel_orthogonal_1_orthogonal_inner_1_state_1_0 = Transition(self, self.states["/parallel/orthogonal_1/orthogonal_inner_1/state_1"], [self.states["/parallel/orthogonal_1/orthogonal_inner_1/state_2"]])
-        _parallel_orthogonal_1_orthogonal_inner_1_state_1_0.trigger = Event("to_state_2", "test_input")
+        _parallel_orthogonal_1_orthogonal_inner_1_state_1_0.setTrigger(Event("to_state_2", "test_input"))
         self.states["/parallel/orthogonal_1/orthogonal_inner_1/state_1"].addTransition(_parallel_orthogonal_1_orthogonal_inner_1_state_1_0)
         
         # transition /parallel/orthogonal_2/orthogonal_inner_2/state_3
         _parallel_orthogonal_2_orthogonal_inner_2_state_3_0 = Transition(self, self.states["/parallel/orthogonal_2/orthogonal_inner_2/state_3"], [self.states["/parallel/orthogonal_2/orthogonal_inner_2/state_4"]])
-        _parallel_orthogonal_2_orthogonal_inner_2_state_3_0.trigger = Event("to_state_4", "test_input")
+        _parallel_orthogonal_2_orthogonal_inner_2_state_3_0.setTrigger(Event("to_state_4", "test_input"))
         self.states["/parallel/orthogonal_2/orthogonal_inner_2/state_3"].addTransition(_parallel_orthogonal_2_orthogonal_inner_2_state_3_0)
         
         # transition /next_to_parallel
         _next_to_parallel_0 = Transition(self, self.states["/next_to_parallel"], [self.states["/parallel/history_1"]])
-        _next_to_parallel_0.trigger = Event("to_history_1", "test_input")
+        _next_to_parallel_0.setTrigger(Event("to_history_1", "test_input"))
         self.states["/next_to_parallel"].addTransition(_next_to_parallel_0)
         
         # transition /parallel
         _parallel_0 = Transition(self, self.states["/parallel"], [self.states["/next_to_parallel"]])
-        _parallel_0.trigger = Event("exit", "test_input")
+        _parallel_0.setTrigger(Event("exit", "test_input"))
         self.states["/parallel"].addTransition(_parallel_0)
         
         # transition /parallel/orthogonal_1/orthogonal_inner_1
         _parallel_orthogonal_1_orthogonal_inner_1_0 = Transition(self, self.states["/parallel/orthogonal_1/orthogonal_inner_1"], [self.states["/parallel/orthogonal_1/outer_1"]])
-        _parallel_orthogonal_1_orthogonal_inner_1_0.trigger = Event("to_outer_1", "test_input")
+        _parallel_orthogonal_1_orthogonal_inner_1_0.setTrigger(Event("to_outer_1", "test_input"))
         self.states["/parallel/orthogonal_1/orthogonal_inner_1"].addTransition(_parallel_orthogonal_1_orthogonal_inner_1_0)
         
         # transition /parallel/orthogonal_2/orthogonal_inner_2
         _parallel_orthogonal_2_orthogonal_inner_2_0 = Transition(self, self.states["/parallel/orthogonal_2/orthogonal_inner_2"], [self.states["/parallel/orthogonal_2/outer_2"]])
-        _parallel_orthogonal_2_orthogonal_inner_2_0.trigger = Event("to_outer_2", "test_input")
+        _parallel_orthogonal_2_orthogonal_inner_2_0.setTrigger(Event("to_outer_2", "test_input"))
         self.states["/parallel/orthogonal_2/orthogonal_inner_2"].addTransition(_parallel_orthogonal_2_orthogonal_inner_2_0)
     
     def _parallel_orthogonal_1_orthogonal_inner_1_state_1_enter(self):

+ 7 - 7
test/target_py/original_semantics/parallel_history_3.py

@@ -1,7 +1,7 @@
 """
 Generated by Statechart compiler by Glenn De Jonghe, Joeri Exelmans, Simon Van Mierlo, and Yentl Van Tendeloo (for the inspiration)
 
-Date:   Thu Aug 04 12:51:06 2016
+Date:   Fri Aug 05 16:13:35 2016
 
 Model author: Glenn De Jonghe
 Model name:   TestParallelHistory2
@@ -111,32 +111,32 @@ class TestClass(RuntimeClassBase):
         
         # transition /parallel/orthogonal_1/orthogonal_inner_1/state_1
         _parallel_orthogonal_1_orthogonal_inner_1_state_1_0 = Transition(self, self.states["/parallel/orthogonal_1/orthogonal_inner_1/state_1"], [self.states["/parallel/orthogonal_1/orthogonal_inner_1/state_2"]])
-        _parallel_orthogonal_1_orthogonal_inner_1_state_1_0.trigger = Event("to_state_2", "test_input")
+        _parallel_orthogonal_1_orthogonal_inner_1_state_1_0.setTrigger(Event("to_state_2", "test_input"))
         self.states["/parallel/orthogonal_1/orthogonal_inner_1/state_1"].addTransition(_parallel_orthogonal_1_orthogonal_inner_1_state_1_0)
         
         # transition /parallel/orthogonal_2/orthogonal_inner_2/state_3
         _parallel_orthogonal_2_orthogonal_inner_2_state_3_0 = Transition(self, self.states["/parallel/orthogonal_2/orthogonal_inner_2/state_3"], [self.states["/parallel/orthogonal_2/orthogonal_inner_2/state_4"]])
-        _parallel_orthogonal_2_orthogonal_inner_2_state_3_0.trigger = Event("to_state_4", "test_input")
+        _parallel_orthogonal_2_orthogonal_inner_2_state_3_0.setTrigger(Event("to_state_4", "test_input"))
         self.states["/parallel/orthogonal_2/orthogonal_inner_2/state_3"].addTransition(_parallel_orthogonal_2_orthogonal_inner_2_state_3_0)
         
         # transition /next_to_parallel
         _next_to_parallel_0 = Transition(self, self.states["/next_to_parallel"], [self.states["/parallel/history_1"]])
-        _next_to_parallel_0.trigger = Event("to_history_1", "test_input")
+        _next_to_parallel_0.setTrigger(Event("to_history_1", "test_input"))
         self.states["/next_to_parallel"].addTransition(_next_to_parallel_0)
         
         # transition /parallel
         _parallel_0 = Transition(self, self.states["/parallel"], [self.states["/next_to_parallel"]])
-        _parallel_0.trigger = Event("exit", "test_input")
+        _parallel_0.setTrigger(Event("exit", "test_input"))
         self.states["/parallel"].addTransition(_parallel_0)
         
         # transition /parallel/orthogonal_1/orthogonal_inner_1
         _parallel_orthogonal_1_orthogonal_inner_1_0 = Transition(self, self.states["/parallel/orthogonal_1/orthogonal_inner_1"], [self.states["/parallel/orthogonal_1/outer_1"]])
-        _parallel_orthogonal_1_orthogonal_inner_1_0.trigger = Event("to_outer_1", "test_input")
+        _parallel_orthogonal_1_orthogonal_inner_1_0.setTrigger(Event("to_outer_1", "test_input"))
         self.states["/parallel/orthogonal_1/orthogonal_inner_1"].addTransition(_parallel_orthogonal_1_orthogonal_inner_1_0)
         
         # transition /parallel/orthogonal_2/orthogonal_inner_2
         _parallel_orthogonal_2_orthogonal_inner_2_0 = Transition(self, self.states["/parallel/orthogonal_2/orthogonal_inner_2"], [self.states["/parallel/orthogonal_2/outer_2"]])
-        _parallel_orthogonal_2_orthogonal_inner_2_0.trigger = Event("to_outer_2", "test_input")
+        _parallel_orthogonal_2_orthogonal_inner_2_0.setTrigger(Event("to_outer_2", "test_input"))
         self.states["/parallel/orthogonal_2/orthogonal_inner_2"].addTransition(_parallel_orthogonal_2_orthogonal_inner_2_0)
     
     def _parallel_orthogonal_1_orthogonal_inner_1_state_1_enter(self):

+ 3 - 1
test/target_py/priority/00_source_parent.py

@@ -1,7 +1,7 @@
 """
 Generated by Statechart compiler by Glenn De Jonghe, Joeri Exelmans, Simon Van Mierlo, and Yentl Van Tendeloo (for the inspiration)
 
-Date:   Thu Aug 04 12:51:06 2016
+Date:   Fri Aug 05 16:13:35 2016
 
 Model author: Herr Joeri Exelmans
 Model name:   source_parent
@@ -69,10 +69,12 @@ class c(RuntimeClassBase):
         
         # transition /parent/a
         _parent_a_0 = Transition(self, self.states["/parent/a"], [self.states["/parent/b"]])
+        _parent_a_0.setTrigger(None)
         self.states["/parent/a"].addTransition(_parent_a_0)
         
         # transition /parent
         _parent_0 = Transition(self, self.states["/parent"], [self.states["/c"]])
+        _parent_0.setTrigger(None)
         self.states["/parent"].addTransition(_parent_0)
     
     def _parent_enter(self):

+ 3 - 1
test/target_py/priority/01_source_child.py

@@ -1,7 +1,7 @@
 """
 Generated by Statechart compiler by Glenn De Jonghe, Joeri Exelmans, Simon Van Mierlo, and Yentl Van Tendeloo (for the inspiration)
 
-Date:   Thu Aug 04 12:51:06 2016
+Date:   Fri Aug 05 16:13:35 2016
 
 Model author: Herr Joeri Exelmans
 Model name:   source_child
@@ -69,10 +69,12 @@ class c(RuntimeClassBase):
         
         # transition /parent/a
         _parent_a_0 = Transition(self, self.states["/parent/a"], [self.states["/parent/b"]])
+        _parent_a_0.setTrigger(None)
         self.states["/parent/a"].addTransition(_parent_a_0)
         
         # transition /parent
         _parent_0 = Transition(self, self.states["/parent"], [self.states["/c"]])
+        _parent_0.setTrigger(None)
         self.states["/parent"].addTransition(_parent_0)
     
     def _parent_enter(self):

+ 3 - 3
test/target_py/priority/10_source_parent_history.py

@@ -1,7 +1,7 @@
 """
 Generated by Statechart compiler by Glenn De Jonghe, Joeri Exelmans, Simon Van Mierlo, and Yentl Van Tendeloo (for the inspiration)
 
-Date:   Thu Aug 04 12:51:07 2016
+Date:   Fri Aug 05 16:13:35 2016
 
 Model author: Herr Joeri Exelmans
 Model name:   source_parent_history
@@ -65,13 +65,13 @@ class c(RuntimeClassBase):
         # transition /main/A
         _main_A_0 = Transition(self, self.states["/main/A"], [self.states["/main/B"]])
         _main_A_0.setAction(self._main_A_0_exec)
-        _main_A_0.trigger = Event("e", "in")
+        _main_A_0.setTrigger(Event("e", "in"))
         self.states["/main/A"].addTransition(_main_A_0)
         
         # transition /main
         _main_0 = Transition(self, self.states["/main"], [self.states["/main/history"]])
         _main_0.setAction(self._main_0_exec)
-        _main_0.trigger = Event("e", "in")
+        _main_0.setTrigger(Event("e", "in"))
         self.states["/main"].addTransition(_main_0)
     
     def _main_0_exec(self, parameters):

+ 3 - 3
test/target_py/priority/11_source_child_history.py

@@ -1,7 +1,7 @@
 """
 Generated by Statechart compiler by Glenn De Jonghe, Joeri Exelmans, Simon Van Mierlo, and Yentl Van Tendeloo (for the inspiration)
 
-Date:   Thu Aug 04 12:51:07 2016
+Date:   Fri Aug 05 16:13:35 2016
 
 Model author: Herr Joeri Exelmans
 Model name:   source_child_history
@@ -65,13 +65,13 @@ class c(RuntimeClassBase):
         # transition /main/A
         _main_A_0 = Transition(self, self.states["/main/A"], [self.states["/main/B"]])
         _main_A_0.setAction(self._main_A_0_exec)
-        _main_A_0.trigger = Event("e", "in")
+        _main_A_0.setTrigger(Event("e", "in"))
         self.states["/main/A"].addTransition(_main_A_0)
         
         # transition /main
         _main_0 = Transition(self, self.states["/main"], [self.states["/main/history"]])
         _main_0.setAction(self._main_0_exec)
-        _main_0.trigger = Event("e", "in")
+        _main_0.setTrigger(Event("e", "in"))
         self.states["/main"].addTransition(_main_0)
     
     def _main_0_exec(self, parameters):

+ 2 - 2
test/target_py/timing/00_rapid_py.py

@@ -1,7 +1,7 @@
 """
 Generated by Statechart compiler by Glenn De Jonghe, Joeri Exelmans, Simon Van Mierlo, and Yentl Van Tendeloo (for the inspiration)
 
-Date:   Thu Aug 04 12:51:07 2016
+Date:   Fri Aug 05 16:13:35 2016
 
 Model author: Herr Joeri Exelmans
 Model name:   rapid
@@ -58,7 +58,7 @@ class c(RuntimeClassBase):
         # transition /a
         _a_0 = Transition(self, self.states["/a"], [self.states["/a"]])
         _a_0.setAction(self._a_0_exec)
-        _a_0.trigger = Event("_0after")
+        _a_0.setTrigger(Event("_0after"))
         _a_0.setGuard(self._a_0_guard)
         self.states["/a"].addTransition(_a_0)