history_deep.js 13 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199200201202203204205206207208209210211212213214215216217218219220221222223224225226227228229230231232233234235236237238239240241242243244245246247248249250251252253254255256257258259260261262263264265266267268269270271272273274275
  1. /* Generated by Statechart compiler by Glenn De Jonghe, Joeri Exelmans, Simon Van Mierlo, and Yentl Van Tendeloo (for the inspiration)
  2. Date: Tue Aug 09 09:35:53 2016
  3. Model author: Glenn De Jonghe
  4. Model name: TestHistoryDeep
  5. Model description:
  6. Testing history deep.*/
  7. // package "TestHistoryDeep"
  8. var TestHistoryDeep = {};
  9. (function() {
  10. var Class1 = function(controller) {
  11. RuntimeClassBase.call(this, controller);
  12. this.semantics.big_step_maximality = StatechartSemantics.TakeMany;
  13. this.semantics.internal_event_lifeline = StatechartSemantics.Queue;
  14. this.semantics.input_event_lifeline = StatechartSemantics.FirstComboStep;
  15. this.semantics.priority = StatechartSemantics.SourceParent;
  16. this.semantics.concurrency = StatechartSemantics.Single;
  17. // build Statechart structure
  18. this.build_statechart_structure();
  19. // call user defined constructor
  20. Class1.prototype.user_defined_constructor.call(this);
  21. };
  22. Class1.prototype = new Object();
  23. (function() {
  24. var proto = new RuntimeClassBase();
  25. for (prop in proto) {
  26. Class1.prototype[prop] = proto[prop];
  27. }
  28. })();
  29. Class1.prototype.user_defined_constructor = function() {
  30. };
  31. Class1.prototype.user_defined_destructor = function() {
  32. };
  33. // builds Statechart structure
  34. Class1.prototype.build_statechart_structure = function() {
  35. // state <root>
  36. this.states[""] = new State(0, this);
  37. // state /parallel
  38. this.states["/parallel"] = new ParallelState(1, this);
  39. // state /parallel/orthogonal
  40. this.states["/parallel/orthogonal"] = new State(2, this);
  41. // state /parallel/orthogonal/wrapper
  42. this.states["/parallel/orthogonal/wrapper"] = new State(3, this);
  43. // state /parallel/orthogonal/wrapper/state_1
  44. this.states["/parallel/orthogonal/wrapper/state_1"] = new State(4, this);
  45. // state /parallel/orthogonal/wrapper/state_1/inner_1
  46. this.states["/parallel/orthogonal/wrapper/state_1/inner_1"] = new State(5, this);
  47. // state /parallel/orthogonal/wrapper/state_1/inner_2
  48. this.states["/parallel/orthogonal/wrapper/state_1/inner_2"] = new State(6, this);
  49. // state /parallel/orthogonal/wrapper/state_2
  50. this.states["/parallel/orthogonal/wrapper/state_2"] = new State(7, this);
  51. // state /parallel/orthogonal/wrapper/state_2/inner_3
  52. this.states["/parallel/orthogonal/wrapper/state_2/inner_3"] = new State(8, this);
  53. // state /parallel/orthogonal/wrapper/state_2/inner_4
  54. this.states["/parallel/orthogonal/wrapper/state_2/inner_4"] = new State(9, this);
  55. // state /parallel/orthogonal/wrapper/history
  56. this.states["/parallel/orthogonal/wrapper/history"] = new DeepHistoryState(10, this);
  57. // state /parallel/orthogonal/outer
  58. this.states["/parallel/orthogonal/outer"] = new State(11, this);
  59. // state /parallel/orthogonal_tester
  60. this.states["/parallel/orthogonal_tester"] = new State(12, this);
  61. // state /parallel/orthogonal_tester/start
  62. this.states["/parallel/orthogonal_tester/start"] = new State(13, this);
  63. // state /parallel/orthogonal_tester/step1
  64. this.states["/parallel/orthogonal_tester/step1"] = new State(14, this);
  65. // state /parallel/orthogonal_tester/step2
  66. this.states["/parallel/orthogonal_tester/step2"] = new State(15, this);
  67. // state /parallel/orthogonal_tester/step3
  68. this.states["/parallel/orthogonal_tester/step3"] = new State(16, this);
  69. // state /parallel/orthogonal_tester/end
  70. this.states["/parallel/orthogonal_tester/end"] = new State(17, this);
  71. // add children
  72. this.states[""].addChild(this.states["/parallel"]);
  73. this.states["/parallel"].addChild(this.states["/parallel/orthogonal"]);
  74. this.states["/parallel"].addChild(this.states["/parallel/orthogonal_tester"]);
  75. this.states["/parallel/orthogonal"].addChild(this.states["/parallel/orthogonal/wrapper"]);
  76. this.states["/parallel/orthogonal"].addChild(this.states["/parallel/orthogonal/outer"]);
  77. this.states["/parallel/orthogonal/wrapper"].addChild(this.states["/parallel/orthogonal/wrapper/state_1"]);
  78. this.states["/parallel/orthogonal/wrapper"].addChild(this.states["/parallel/orthogonal/wrapper/state_2"]);
  79. this.states["/parallel/orthogonal/wrapper"].addChild(this.states["/parallel/orthogonal/wrapper/history"]);
  80. this.states["/parallel/orthogonal/wrapper/state_1"].addChild(this.states["/parallel/orthogonal/wrapper/state_1/inner_1"]);
  81. this.states["/parallel/orthogonal/wrapper/state_1"].addChild(this.states["/parallel/orthogonal/wrapper/state_1/inner_2"]);
  82. this.states["/parallel/orthogonal/wrapper/state_2"].addChild(this.states["/parallel/orthogonal/wrapper/state_2/inner_3"]);
  83. this.states["/parallel/orthogonal/wrapper/state_2"].addChild(this.states["/parallel/orthogonal/wrapper/state_2/inner_4"]);
  84. this.states["/parallel/orthogonal_tester"].addChild(this.states["/parallel/orthogonal_tester/start"]);
  85. this.states["/parallel/orthogonal_tester"].addChild(this.states["/parallel/orthogonal_tester/step1"]);
  86. this.states["/parallel/orthogonal_tester"].addChild(this.states["/parallel/orthogonal_tester/step2"]);
  87. this.states["/parallel/orthogonal_tester"].addChild(this.states["/parallel/orthogonal_tester/step3"]);
  88. this.states["/parallel/orthogonal_tester"].addChild(this.states["/parallel/orthogonal_tester/end"]);
  89. this.states[""].fixTree();
  90. this.states[""].default_state = this.states["/parallel"];
  91. this.states["/parallel/orthogonal"].default_state = this.states["/parallel/orthogonal/wrapper"];
  92. this.states["/parallel/orthogonal/wrapper"].default_state = this.states["/parallel/orthogonal/wrapper/state_1"];
  93. this.states["/parallel/orthogonal/wrapper/state_1"].default_state = this.states["/parallel/orthogonal/wrapper/state_1/inner_1"];
  94. this.states["/parallel/orthogonal/wrapper/state_2"].default_state = this.states["/parallel/orthogonal/wrapper/state_2/inner_3"];
  95. this.states["/parallel/orthogonal_tester"].default_state = this.states["/parallel/orthogonal_tester/start"];
  96. // transition /parallel/orthogonal/wrapper/state_2/inner_3
  97. 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"]]);
  98. _parallel_orthogonal_wrapper_state_2_inner_3_0.setTrigger(new Event("to_inner_4", null));
  99. this.states["/parallel/orthogonal/wrapper/state_2/inner_3"].addTransition(_parallel_orthogonal_wrapper_state_2_inner_3_0);
  100. // transition /parallel/orthogonal/outer
  101. var _parallel_orthogonal_outer_0 = new Transition(this, this.states["/parallel/orthogonal/outer"], [this.states["/parallel/orthogonal/wrapper/history"]]);
  102. _parallel_orthogonal_outer_0.setTrigger(new Event("to_history", null));
  103. this.states["/parallel/orthogonal/outer"].addTransition(_parallel_orthogonal_outer_0);
  104. // transition /parallel/orthogonal_tester/start
  105. var _parallel_orthogonal_tester_start_0 = new Transition(this, this.states["/parallel/orthogonal_tester/start"], [this.states["/parallel/orthogonal_tester/step1"]]);
  106. _parallel_orthogonal_tester_start_0.setAction(this._parallel_orthogonal_tester_start_0_exec);
  107. _parallel_orthogonal_tester_start_0.setTrigger(null);
  108. this.states["/parallel/orthogonal_tester/start"].addTransition(_parallel_orthogonal_tester_start_0);
  109. // transition /parallel/orthogonal_tester/step1
  110. var _parallel_orthogonal_tester_step1_0 = new Transition(this, this.states["/parallel/orthogonal_tester/step1"], [this.states["/parallel/orthogonal_tester/step2"]]);
  111. _parallel_orthogonal_tester_step1_0.setAction(this._parallel_orthogonal_tester_step1_0_exec);
  112. _parallel_orthogonal_tester_step1_0.setTrigger(null);
  113. _parallel_orthogonal_tester_step1_0.setGuard(this._parallel_orthogonal_tester_step1_0_guard);
  114. this.states["/parallel/orthogonal_tester/step1"].addTransition(_parallel_orthogonal_tester_step1_0);
  115. // transition /parallel/orthogonal_tester/step2
  116. var _parallel_orthogonal_tester_step2_0 = new Transition(this, this.states["/parallel/orthogonal_tester/step2"], [this.states["/parallel/orthogonal_tester/step3"]]);
  117. _parallel_orthogonal_tester_step2_0.setAction(this._parallel_orthogonal_tester_step2_0_exec);
  118. _parallel_orthogonal_tester_step2_0.setTrigger(null);
  119. _parallel_orthogonal_tester_step2_0.setGuard(this._parallel_orthogonal_tester_step2_0_guard);
  120. this.states["/parallel/orthogonal_tester/step2"].addTransition(_parallel_orthogonal_tester_step2_0);
  121. // transition /parallel/orthogonal_tester/step3
  122. var _parallel_orthogonal_tester_step3_0 = new Transition(this, this.states["/parallel/orthogonal_tester/step3"], [this.states["/parallel/orthogonal_tester/end"]]);
  123. _parallel_orthogonal_tester_step3_0.setAction(this._parallel_orthogonal_tester_step3_0_exec);
  124. _parallel_orthogonal_tester_step3_0.setTrigger(null);
  125. _parallel_orthogonal_tester_step3_0.setGuard(this._parallel_orthogonal_tester_step3_0_guard);
  126. this.states["/parallel/orthogonal_tester/step3"].addTransition(_parallel_orthogonal_tester_step3_0);
  127. // transition /parallel/orthogonal/wrapper
  128. var _parallel_orthogonal_wrapper_0 = new Transition(this, this.states["/parallel/orthogonal/wrapper"], [this.states["/parallel/orthogonal/outer"]]);
  129. _parallel_orthogonal_wrapper_0.setTrigger(new Event("to_outer", null));
  130. this.states["/parallel/orthogonal/wrapper"].addTransition(_parallel_orthogonal_wrapper_0);
  131. // transition /parallel/orthogonal/wrapper/state_1
  132. var _parallel_orthogonal_wrapper_state_1_0 = new Transition(this, this.states["/parallel/orthogonal/wrapper/state_1"], [this.states["/parallel/orthogonal/wrapper/state_2"]]);
  133. _parallel_orthogonal_wrapper_state_1_0.setTrigger(new Event("to_state_2", null));
  134. this.states["/parallel/orthogonal/wrapper/state_1"].addTransition(_parallel_orthogonal_wrapper_state_1_0);
  135. };
  136. Class1.prototype._parallel_orthogonal_tester_start_0_exec = function(parameters) {
  137. this.raiseInternalEvent(new Event("to_state_2", null, new Array()));
  138. this.raiseInternalEvent(new Event("to_inner_4", null, new Array()));
  139. };
  140. Class1.prototype._parallel_orthogonal_tester_step1_0_exec = function(parameters) {
  141. this.big_step.outputEvent(new Event("check1", "test_output", new Array()));
  142. this.raiseInternalEvent(new Event("to_outer", null, new Array()));
  143. };
  144. Class1.prototype._parallel_orthogonal_tester_step1_0_guard = function(parameters) {
  145. return this.inState(["/parallel/orthogonal/wrapper/state_2/inner_4"]);
  146. };
  147. Class1.prototype._parallel_orthogonal_tester_step2_0_exec = function(parameters) {
  148. this.big_step.outputEvent(new Event("check2", "test_output", new Array()));
  149. this.raiseInternalEvent(new Event("to_history", null, new Array()));
  150. };
  151. Class1.prototype._parallel_orthogonal_tester_step2_0_guard = function(parameters) {
  152. return this.inState(["/parallel/orthogonal/outer"]);
  153. };
  154. Class1.prototype._parallel_orthogonal_tester_step3_0_exec = function(parameters) {
  155. this.big_step.outputEvent(new Event("check3", "test_output", new Array()));
  156. };
  157. Class1.prototype._parallel_orthogonal_tester_step3_0_guard = function(parameters) {
  158. return this.inState(["/parallel/orthogonal/wrapper/state_2/inner_4"]);
  159. };
  160. Class1.prototype.initializeStatechart = function() {
  161. // enter default state
  162. this.default_targets = this.states["/parallel"].getEffectiveTargetStates();
  163. RuntimeClassBase.prototype.initializeStatechart.call(this);
  164. };
  165. // add symbol 'Class1' to package 'TestHistoryDeep'
  166. TestHistoryDeep.Class1 = Class1;
  167. var ObjectManager = function(controller) {
  168. ObjectManagerBase.call(this, controller);
  169. };
  170. ObjectManager.prototype = new Object();
  171. (function() {
  172. var proto = new ObjectManagerBase();
  173. for (prop in proto) {
  174. ObjectManager.prototype[prop] = proto[prop];
  175. }
  176. })();
  177. ObjectManager.prototype.instantiate = function(class_name, construct_params) {
  178. if (class_name === "Class1") {
  179. var instance = new Class1(this.controller);
  180. instance.associations = new Object();
  181. } else {
  182. throw new Error("Cannot instantiate class " + class_name);
  183. }
  184. return instance;
  185. };
  186. // add symbol 'ObjectManager' to package 'TestHistoryDeep'
  187. TestHistoryDeep.ObjectManager = ObjectManager;
  188. var Controller = function(event_loop_callbacks, finished_callback, behind_schedule_callback) {
  189. if (finished_callback === undefined) finished_callback = null;
  190. if (behind_schedule_callback === undefined) behind_schedule_callback = null;
  191. EventLoopControllerBase.call(this, new ObjectManager(this), event_loop_callbacks, finished_callback, behind_schedule_callback);
  192. this.addOutputPort("test_output");
  193. this.object_manager.createInstance("Class1", new Array());
  194. };
  195. Controller.prototype = new Object();
  196. (function() {
  197. var proto = new EventLoopControllerBase();
  198. for (prop in proto) {
  199. Controller.prototype[prop] = proto[prop];
  200. }
  201. })();
  202. // add symbol 'Controller' to package 'TestHistoryDeep'
  203. TestHistoryDeep.Controller = Controller;
  204. var InputEvent = function(name, port, parameters, time_offset) {
  205. this.name = name;
  206. this.port = port;
  207. this.parameters = parameters;
  208. this.time_offset = time_offset;
  209. };
  210. // add symbol 'InputEvent' to package 'TestHistoryDeep'
  211. TestHistoryDeep.InputEvent = InputEvent;
  212. var Test = function() {
  213. };
  214. Test.prototype.input_events = new Array();
  215. Test.prototype.expected_events = [[new Event("check1", "test_output", new Array())], [new Event("check2", "test_output", new Array())], [new Event("check3", "test_output", new Array())]];
  216. // add symbol 'Test' to package 'TestHistoryDeep'
  217. TestHistoryDeep.Test = Test;
  218. })();