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