JAL-1807 Bob's JalviewJS prototype first commit
[jalviewjs.git] / site / j2s / org / uwi / SimThread.js
1 Clazz.declarePackage ("org.uwi");\r
2 Clazz.load (["swingjs.JSThread"], "org.uwi.SimThread", null, function () {\r
3 c$ = Clazz.decorateAsClass (function () {\r
4 this.boltzmann = null;\r
5 Clazz.instantialize (this, arguments);\r
6 }, org.uwi, "SimThread", swingjs.JSThread);\r
7 Clazz.makeConstructor (c$, \r
8 function (boltzmann) {\r
9 Clazz.superConstructor (this, org.uwi.SimThread, [null, "BoltzmannThread"]);\r
10 this.boltzmann = boltzmann;\r
11 }, "org.uwi.Boltzmann");\r
12 Clazz.overrideMethod (c$, "run", \r
13 function () {\r
14 this.run1 (0);\r
15 });\r
16 Clazz.overrideMethod (c$, "run1", \r
17 function (state) {\r
18 while (!Thread.interrupted ()) {\r
19 try {\r
20 switch (state) {\r
21 case 0:\r
22 this.boltzmann.sjs_initSimulation ();\r
23 state = 1;\r
24 continue;\r
25 case 1:\r
26 var repainted = this.boltzmann.sjs_checkRepaint ();\r
27 if (!this.boltzmann.sjs_loopSimulation ()) {\r
28 state = 2;\r
29 continue;\r
30 }if (repainted && this.sleepAndReturn (0, state)) return;\r
31 break;\r
32 case 2:\r
33 this.boltzmann.sjs_finalizeGraph ();\r
34 return;\r
35 }\r
36 } catch (e) {\r
37 if (Clazz.exceptionOf (e, Exception)) {\r
38 state = 2;\r
39 } else {\r
40 throw e;\r
41 }\r
42 }\r
43 }\r
44 }, "~N");\r
45 });\r