Merge branch 'master' of https://source.jalview.org/git/jalviewjs.git
[jalviewjs.git] / site / j2s / org / uwi / Boltzmann.js
index b943fd3..8533ec6 100644 (file)
-Clazz.declarePackage ("org.uwi");\r
-Clazz.load (["java.awt.event.ActionListener", "$.MouseAdapter", "javax.swing.JApplet", "$.JTextArea", "java.awt.Color", "JU.SB", "javax.swing.BorderFactory", "$.JButton", "$.JLabel", "$.JPanel", "$.JScrollPane", "$.JTextField", "org.uwi.BoltzCanvas", "$.EntropyCanvas"], "org.uwi.Boltzmann", ["java.awt.Dimension", "$.FlowLayout", "$.GridBagConstraints", "$.GridBagLayout", "$.Insets", "java.text.DecimalFormat", "org.uwi.SimThread"], function () {\r
-c$ = Clazz.decorateAsClass (function () {\r
-this.BoltzSimGraph = null;\r
-this.DispBoltz = null;\r
-this.EntropyGraph = null;\r
-this.DispEntropy = null;\r
-this.lineBorder1 = null;\r
-this.lineBorder2 = null;\r
-this.UserInput = null;\r
-this.lQuanta = null;\r
-this.lParticles = null;\r
-this.lCollisions = null;\r
-this.tEnergy = null;\r
-this.tParticles = null;\r
-this.tCollisions = null;\r
-this.bStartSim = null;\r
-this.DispResults = null;\r
-this.ShowText = null;\r
-this.initialEnergy = 0;\r
-this.curMaxEnergy = 0;\r
-this.maxParticles = 0;\r
-this.maxCollisions = 0;\r
-this.particleEnergy = null;\r
-this.EntropyCalcs = 0;\r
-this.start_pressed = false;\r
-if (!Clazz.isClassDefined ("org.uwi.Boltzmann.SymAction")) {\r
-org.uwi.Boltzmann.$Boltzmann$SymAction$ ();\r
-}\r
-if (!Clazz.isClassDefined ("org.uwi.Boltzmann.LevelInfoArea")) {\r
-org.uwi.Boltzmann.$Boltzmann$LevelInfoArea$ ();\r
-}\r
-this.simThread = null;\r
-if (!Clazz.isClassDefined ("org.uwi.Boltzmann.SymMouse")) {\r
-org.uwi.Boltzmann.$Boltzmann$SymMouse$ ();\r
-}\r
-this.particle1 = 0;\r
-this.particle2 = 0;\r
-this.e1 = 0;\r
-this.e2 = 0;\r
-this.collisionEnergy = 0;\r
-this.numOfCollisions = 0;\r
-this.displayFactor = 0;\r
-this.entropyFactor = 0;\r
-Clazz.instantialize (this, arguments);\r
-}, org.uwi, "Boltzmann", javax.swing.JApplet);\r
-Clazz.prepareFields (c$, function () {\r
-this.BoltzSimGraph =  new javax.swing.JPanel ();\r
-this.DispBoltz =  new org.uwi.BoltzCanvas (this);\r
-this.EntropyGraph =  new javax.swing.JPanel ();\r
-this.DispEntropy =  new org.uwi.EntropyCanvas ();\r
-this.lineBorder1 = javax.swing.BorderFactory.createLineBorder (java.awt.Color.black);\r
-this.lineBorder2 = javax.swing.BorderFactory.createLineBorder (java.awt.Color.black);\r
-this.UserInput =  new javax.swing.JPanel ();\r
-this.lQuanta =  new javax.swing.JLabel ();\r
-this.lParticles =  new javax.swing.JLabel ();\r
-this.lCollisions =  new javax.swing.JLabel ();\r
-this.tEnergy =  new javax.swing.JTextField ();\r
-this.tParticles =  new javax.swing.JTextField ();\r
-this.tCollisions =  new javax.swing.JTextField ();\r
-this.bStartSim =  new javax.swing.JButton ();\r
-this.DispResults =  new javax.swing.JScrollPane ();\r
-this.ShowText = Clazz.innerTypeInstance (org.uwi.Boltzmann.LevelInfoArea, this, null);\r
-});\r
-Clazz.makeConstructor (c$, \r
-function () {\r
-Clazz.superConstructor (this, org.uwi.Boltzmann, []);\r
-this.setName ("Boltzmann");\r
-});\r
-Clazz.overrideMethod (c$, "init", \r
-function () {\r
-this.getContentPane ().setLayout (null);\r
-this.setSize (562, 391);\r
-this.BoltzSimGraph.setBorder (this.lineBorder2);\r
-this.BoltzSimGraph.setLayout ( new java.awt.FlowLayout (1, 5, 5));\r
-this.getContentPane ().add (this.BoltzSimGraph);\r
-this.BoltzSimGraph.setBackground (java.awt.Color.white);\r
-this.BoltzSimGraph.setBounds (0, 0, 384, 300);\r
-this.BoltzSimGraph.add (this.DispBoltz);\r
-this.DispBoltz.setPreferredSize ( new java.awt.Dimension (380, 294));\r
-this.DispBoltz.setBounds (2, 6, 380, 294);\r
-this.EntropyGraph.setBorder (this.lineBorder1);\r
-this.EntropyGraph.setLayout ( new java.awt.FlowLayout (1, 5, 5));\r
-this.getContentPane ().add (this.EntropyGraph);\r
-this.EntropyGraph.setBackground (java.awt.Color.white);\r
-this.EntropyGraph.setBounds (384, 0, 180, 156);\r
-this.EntropyGraph.add (this.DispEntropy);\r
-this.DispEntropy.setPreferredSize ( new java.awt.Dimension (178, 150));\r
-this.DispEntropy.setBounds (1, 6, 178, 150);\r
-this.UserInput.setLayout ( new java.awt.GridBagLayout ());\r
-this.getContentPane ().add (this.UserInput);\r
-this.UserInput.setBackground (java.awt.Color.yellow);\r
-this.UserInput.setBounds (0, 300, 384, 96);\r
-this.lQuanta.setText ("Initial Energy");\r
-this.UserInput.add (this.lQuanta,  new java.awt.GridBagConstraints (0, 0, 1, 1, 1.0, 1.0, 10, 0,  new java.awt.Insets (0, 0, 0, 0), 0, 0));\r
-this.lQuanta.setBounds (15, 6, 97, 15);\r
-this.lParticles.setText ("No. of Particles");\r
-this.UserInput.add (this.lParticles,  new java.awt.GridBagConstraints (1, 0, 1, 1, 1.0, 0.0, 10, 0,  new java.awt.Insets (0, 0, 0, 0), 0, 0));\r
-this.lParticles.setBounds (149, 6, 86, 15);\r
-this.lCollisions.setText ("No. of Collisions");\r
-this.UserInput.add (this.lCollisions,  new java.awt.GridBagConstraints (2, 0, 1, 1, 1.0, 0.0, 10, 0,  new java.awt.Insets (0, 0, 0, 0), 0, 0));\r
-this.lCollisions.setBounds (275, 6, 90, 15);\r
-this.tEnergy.setAutoscrolls (false);\r
-this.tEnergy.setColumns (10);\r
-this.tEnergy.setNextFocusableComponent (this.tParticles);\r
-this.UserInput.add (this.tEnergy,  new java.awt.GridBagConstraints (0, 1, 1, 1, 1.0, 1.0, 10, 0,  new java.awt.Insets (0, 0, 0, 0), 0, 0));\r
-this.tEnergy.setBounds (9, 33, 110, 19);\r
-this.tParticles.setAutoscrolls (false);\r
-this.tParticles.setColumns (10);\r
-this.tParticles.setNextFocusableComponent (this.tCollisions);\r
-this.UserInput.add (this.tParticles,  new java.awt.GridBagConstraints (1, 1, 1, 1, 1.0, 1.0, 10, 0,  new java.awt.Insets (0, 0, 0, 0), 0, 0));\r
-this.tParticles.setBounds (137, 33, 110, 19);\r
-this.tCollisions.setAutoscrolls (false);\r
-this.tCollisions.setColumns (10);\r
-this.tCollisions.setNextFocusableComponent (this.bStartSim);\r
-this.UserInput.add (this.tCollisions,  new java.awt.GridBagConstraints (2, 1, 1, 1, 1.0, 1.0, 10, 0,  new java.awt.Insets (0, 0, 0, 0), 0, 0));\r
-this.tCollisions.setBounds (265, 33, 110, 19);\r
-this.bStartSim.setText ("Start");\r
-this.bStartSim.setActionCommand ("Start");\r
-this.bStartSim.setNextFocusableComponent (this.tEnergy);\r
-this.UserInput.add (this.bStartSim,  new java.awt.GridBagConstraints (1, 2, 1, 1, 1.0, 1.0, 10, 0,  new java.awt.Insets (0, 0, 0, 0), 0, 0));\r
-this.bStartSim.setBackground (java.awt.Color.green);\r
-this.bStartSim.setBounds (160, 64, 63, 25);\r
-this.DispResults.setHorizontalScrollBarPolicy (31);\r
-this.DispResults.setVerticalScrollBarPolicy (22);\r
-this.DispResults.setOpaque (true);\r
-this.getContentPane ().add (this.DispResults);\r
-this.DispResults.setBounds (384, 156, 180, 240);\r
-this.ShowText.setRows (10000);\r
-this.ShowText.setDisabledTextColor ( new java.awt.Color (153, 153, 153));\r
-this.DispResults.getViewport ().add (this.ShowText);\r
-this.ShowText.setBounds (0, 0, 162, 150000);\r
-var lSymAction = Clazz.innerTypeInstance (org.uwi.Boltzmann.SymAction, this, null);\r
-this.bStartSim.addActionListener (lSymAction);\r
-this.tEnergy.addActionListener (lSymAction);\r
-this.tParticles.addActionListener (lSymAction);\r
-this.tCollisions.addActionListener (lSymAction);\r
-var aSymMouse = Clazz.innerTypeInstance (org.uwi.Boltzmann.SymMouse, this, null);\r
-this.ShowText.addMouseListener (aSymMouse);\r
-this.setBackground (java.awt.Color.white);\r
-this.maxParticles = 10000;\r
-this.maxCollisions = 60000;\r
-this.initialEnergy = 250;\r
-this.EntropyCalcs = 50;\r
-this.tEnergy.setText (Integer.toString (this.initialEnergy));\r
-this.tParticles.setText (Integer.toString (this.maxParticles));\r
-this.tCollisions.setText (Integer.toString (this.maxCollisions));\r
-this.initEnvironment ();\r
-});\r
-Clazz.defineMethod (c$, "bStartSim_actionPerformed", \r
-function (event) {\r
-if (!this.initEnvironment ()) return;\r
-if (this.simThread != null) this.simThread.interrupt ();\r
-this.simThread =  new org.uwi.SimThread (this);\r
-this.simThread.start ();\r
-}, "java.awt.event.ActionEvent");\r
-Clazz.defineMethod (c$, "initEnvironment", \r
-function () {\r
-try {\r
-var tmp = (Integer.parseInt (this.tCollisions.getText ().trim ()));\r
-if (tmp >= 200) this.maxCollisions = tmp;\r
-tmp = (Integer.parseInt (this.tEnergy.getText ().trim ()));\r
-if (tmp > 0) this.initialEnergy = tmp;\r
-tmp = (Integer.parseInt (this.tParticles.getText ().trim ()));\r
-if (tmp >= 50) this.maxParticles = tmp;\r
-} catch (e) {\r
-if (Clazz.exceptionOf (e, NumberFormatException)) {\r
-return false;\r
-} else {\r
-throw e;\r
-}\r
-}\r
-this.DispBoltz.maxEnergy = 20 * this.initialEnergy;\r
-this.particleEnergy =  Clazz.newIntArray (this.maxParticles, 0);\r
-this.DispBoltz.energyLevels =  Clazz.newIntArray (this.DispBoltz.maxEnergy + 1, 0);\r
-this.curMaxEnergy = this.initialEnergy;\r
-this.DispEntropy.Entropy =  Clazz.newDoubleArray (this.EntropyCalcs + 1, 0);\r
-this.DispEntropy.EntropyCalc = this.EntropyCalcs;\r
-this.DispEntropy.entCounter = 0;\r
-for (var i = 0; i < this.maxParticles; i++) {\r
-this.particleEnergy[i] = this.initialEnergy;\r
-}\r
-for (var i = 0; i <= this.DispBoltz.maxEnergy; i++) {\r
-this.DispBoltz.energyLevels[i] = 0;\r
-}\r
-for (var i = 0; i < this.EntropyCalcs; i++) {\r
-this.DispEntropy.Entropy[i] = 0;\r
-}\r
-this.DispBoltz.energyLevels[this.initialEnergy] = this.maxParticles;\r
-return true;\r
-});\r
-Clazz.defineMethod (c$, "calcEntropy", \r
-function (x) {\r
-var i;\r
-this.DispEntropy.Entropy[x] = this.maxParticles * Math.log (this.maxParticles);\r
-for (i = 0; i <= this.curMaxEnergy; i++) if (this.DispBoltz.energyLevels[i] > 0) this.DispEntropy.Entropy[x] = this.DispEntropy.Entropy[x] - (this.DispBoltz.energyLevels[i] * Math.log (this.DispBoltz.energyLevels[i]));\r
-\r
-}, "~N");\r
-Clazz.defineMethod (c$, "ShowText_mouseReleased", \r
-function (event) {\r
-}, "java.awt.event.MouseEvent");\r
-Clazz.defineMethod (c$, "sjs_initSimulation", \r
-function () {\r
-this.numOfCollisions = this.maxCollisions;\r
-this.entropyFactor = Clazz.doubleToInt (Math.ceil (Clazz.doubleToInt (this.maxCollisions / this.EntropyCalcs)));\r
-{\r
-this.displayFactor = 100;\r
-}});\r
-Clazz.defineMethod (c$, "sjs_loopSimulation", \r
-function () {\r
-this.particle1 = Clazz.doubleToInt ((this.maxParticles - 1) * Math.random ());\r
-this.particle2 = Clazz.doubleToInt ((this.maxParticles - 1) * Math.random ());\r
-while (this.particle1 == this.particle2) {\r
-this.particle2 = Clazz.doubleToInt ((this.maxParticles - 1) * Math.random ());\r
-}\r
-if (this.particleEnergy[this.particle1] < this.particleEnergy[this.particle2]) {\r
-var temp = this.particleEnergy[this.particle1];\r
-this.particleEnergy[this.particle1] = this.particleEnergy[this.particle2];\r
-this.particleEnergy[this.particle2] = temp;\r
-}this.e1 = this.particleEnergy[this.particle1];\r
-this.e2 = this.particleEnergy[this.particle2];\r
-this.collisionEnergy = Clazz.doubleToInt (Math.ceil (this.e1 * Math.random ()));\r
-this.particleEnergy[this.particle1] = this.e1 - this.collisionEnergy;\r
-this.particleEnergy[this.particle2] = this.e2 + this.collisionEnergy;\r
-this.DispBoltz.energyLevels[this.e1] = this.DispBoltz.energyLevels[this.e1] - 1;\r
-this.DispBoltz.energyLevels[this.e2] = this.DispBoltz.energyLevels[this.e2] - 1;\r
-this.e1 = this.particleEnergy[this.particle1];\r
-this.e2 = this.particleEnergy[this.particle2];\r
-this.DispBoltz.energyLevels[this.e1] = this.DispBoltz.energyLevels[this.e1] + 1;\r
-this.DispBoltz.energyLevels[this.e2] = this.DispBoltz.energyLevels[this.e2] + 1;\r
-if (this.e1 < this.e2) this.e1 = this.e2;\r
-if (this.e1 > this.curMaxEnergy) this.curMaxEnergy = this.e1;\r
-this.DispBoltz.maxEnergy = this.curMaxEnergy;\r
-return (--this.numOfCollisions > 0);\r
-});\r
-Clazz.defineMethod (c$, "sjs_finalizeGraph", \r
-function () {\r
-for (var i = this.curMaxEnergy; i > 0; i--) {\r
-if (this.DispBoltz.energyLevels[i] < 1) this.curMaxEnergy--;\r
- else break;\r
-}\r
-this.showTheText ();\r
-});\r
-Clazz.defineMethod (c$, "showTheText", \r
- function () {\r
-this.ShowText.levelInfo.setLength (0);\r
-this.ShowText.appendLine ("Init. Energy   = " + this.initialEnergy);\r
-this.ShowText.appendLine ("No. particles  = " + this.maxParticles);\r
-this.ShowText.appendLine ("No. collisions = " + this.maxCollisions);\r
-this.ShowText.appendLine ("-------------");\r
-for (var i = 1; i <= this.curMaxEnergy; i++) this.ShowText.appendLine ("EL " + i + "= " + this.DispBoltz.energyLevels[i]);\r
-\r
-this.ShowText.appendLine ("-------------");\r
-var df =  new java.text.DecimalFormat ("0.00");\r
-for (var i = 0; i < this.EntropyCalcs; i++) this.ShowText.appendLine ("WL " + i + "= " + df.format (this.DispEntropy.Entropy[i]));\r
-\r
-this.ShowText.setRows (this.curMaxEnergy + this.EntropyCalcs + 2);\r
-this.ShowText.setText (this.ShowText.levelInfo.toString ());\r
-this.repaint ();\r
-});\r
-Clazz.defineMethod (c$, "sjs_checkRepaint", \r
-function () {\r
-if ((this.numOfCollisions % this.entropyFactor) == 0) {\r
-this.calcEntropy (this.DispEntropy.entCounter++);\r
-this.DispEntropy.invalidate ();\r
-}if ((this.numOfCollisions % this.displayFactor) != 1) return false;\r
-this.repaint ();\r
-return true;\r
-});\r
-c$.$Boltzmann$SymAction$ = function () {\r
-Clazz.pu$h(self.c$);\r
-c$ = Clazz.decorateAsClass (function () {\r
-Clazz.prepareCallback (this, arguments);\r
-Clazz.instantialize (this, arguments);\r
-}, org.uwi.Boltzmann, "SymAction", null, java.awt.event.ActionListener);\r
-Clazz.overrideMethod (c$, "actionPerformed", \r
-function (a) {\r
-var b = a.getSource ();\r
-if (b === this.b$["org.uwi.Boltzmann"].bStartSim) this.b$["org.uwi.Boltzmann"].bStartSim_actionPerformed (a);\r
-this.b$["org.uwi.Boltzmann"].ShowText.levelInfo.setLength (0);\r
-}, "java.awt.event.ActionEvent");\r
-c$ = Clazz.p0p ();\r
-};\r
-c$.$Boltzmann$LevelInfoArea$ = function () {\r
-Clazz.pu$h(self.c$);\r
-c$ = Clazz.decorateAsClass (function () {\r
-Clazz.prepareCallback (this, arguments);\r
-this.levelInfo = null;\r
-Clazz.instantialize (this, arguments);\r
-}, org.uwi.Boltzmann, "LevelInfoArea", javax.swing.JTextArea);\r
-Clazz.prepareFields (c$, function () {\r
-this.levelInfo =  new JU.SB ();\r
-});\r
-Clazz.makeConstructor (c$, \r
-function () {\r
-Clazz.superConstructor (this, org.uwi.Boltzmann.LevelInfoArea);\r
-this.levelInfo.setLength (0);\r
-});\r
-Clazz.defineMethod (c$, "appendLine", \r
-function (a) {\r
-this.levelInfo.append (a).append ("\n");\r
-}, "~S");\r
-c$ = Clazz.p0p ();\r
-};\r
-c$.$Boltzmann$SymMouse$ = function () {\r
-Clazz.pu$h(self.c$);\r
-c$ = Clazz.decorateAsClass (function () {\r
-Clazz.prepareCallback (this, arguments);\r
-Clazz.instantialize (this, arguments);\r
-}, org.uwi.Boltzmann, "SymMouse", java.awt.event.MouseAdapter);\r
-Clazz.overrideMethod (c$, "mouseReleased", \r
-function (a) {\r
-var b = a.getSource ();\r
-if (b === this.b$["org.uwi.Boltzmann"].ShowText) this.b$["org.uwi.Boltzmann"].ShowText_mouseReleased (a);\r
-}, "java.awt.event.MouseEvent");\r
-c$ = Clazz.p0p ();\r
-};\r
-});\r
+Clazz.declarePackage ("org.uwi");
+Clazz.load (["java.awt.event.ActionListener", "$.MouseAdapter", "javax.swing.JApplet", "$.JTextArea", "java.awt.Color", "JU.SB", "javax.swing.BorderFactory", "$.JButton", "$.JLabel", "$.JPanel", "$.JScrollPane", "$.JTextField", "org.uwi.BoltzCanvas", "$.EntropyCanvas"], "org.uwi.Boltzmann", ["java.awt.Dimension", "$.FlowLayout", "$.GridBagConstraints", "$.GridBagLayout", "$.Insets", "java.text.DecimalFormat", "org.uwi.SimThread"], function () {
+c$ = Clazz.decorateAsClass (function () {
+this.BoltzSimGraph = null;
+this.DispBoltz = null;
+this.EntropyGraph = null;
+this.DispEntropy = null;
+this.lineBorder1 = null;
+this.lineBorder2 = null;
+this.UserInput = null;
+this.lQuanta = null;
+this.lParticles = null;
+this.lCollisions = null;
+this.tEnergy = null;
+this.tParticles = null;
+this.tCollisions = null;
+this.bStartSim = null;
+this.DispResults = null;
+this.ShowText = null;
+this.initialEnergy = 0;
+this.curMaxEnergy = 0;
+this.maxParticles = 0;
+this.maxCollisions = 0;
+this.particleEnergy = null;
+this.EntropyCalcs = 0;
+this.start_pressed = false;
+if (!Clazz.isClassDefined ("org.uwi.Boltzmann.SymAction")) {
+org.uwi.Boltzmann.$Boltzmann$SymAction$ ();
+}
+if (!Clazz.isClassDefined ("org.uwi.Boltzmann.LevelInfoArea")) {
+org.uwi.Boltzmann.$Boltzmann$LevelInfoArea$ ();
+}
+this.simThread = null;
+if (!Clazz.isClassDefined ("org.uwi.Boltzmann.SymMouse")) {
+org.uwi.Boltzmann.$Boltzmann$SymMouse$ ();
+}
+this.particle1 = 0;
+this.particle2 = 0;
+this.e1 = 0;
+this.e2 = 0;
+this.collisionEnergy = 0;
+this.numOfCollisions = 0;
+this.displayFactor = 0;
+this.entropyFactor = 0;
+Clazz.instantialize (this, arguments);
+}, org.uwi, "Boltzmann", javax.swing.JApplet);
+Clazz.prepareFields (c$, function () {
+this.BoltzSimGraph =  new javax.swing.JPanel ();
+this.DispBoltz =  new org.uwi.BoltzCanvas (this);
+this.EntropyGraph =  new javax.swing.JPanel ();
+this.DispEntropy =  new org.uwi.EntropyCanvas ();
+this.lineBorder1 = javax.swing.BorderFactory.createLineBorder (java.awt.Color.black);
+this.lineBorder2 = javax.swing.BorderFactory.createLineBorder (java.awt.Color.black);
+this.UserInput =  new javax.swing.JPanel ();
+this.lQuanta =  new javax.swing.JLabel ();
+this.lParticles =  new javax.swing.JLabel ();
+this.lCollisions =  new javax.swing.JLabel ();
+this.tEnergy =  new javax.swing.JTextField ();
+this.tParticles =  new javax.swing.JTextField ();
+this.tCollisions =  new javax.swing.JTextField ();
+this.bStartSim =  new javax.swing.JButton ();
+this.DispResults =  new javax.swing.JScrollPane ();
+this.ShowText = Clazz.innerTypeInstance (org.uwi.Boltzmann.LevelInfoArea, this, null);
+});
+Clazz.makeConstructor (c$, 
+function () {
+Clazz.superConstructor (this, org.uwi.Boltzmann, []);
+this.setName ("Boltzmann");
+});
+Clazz.overrideMethod (c$, "init", 
+function () {
+this.getContentPane ().setLayout (null);
+this.setSize (562, 391);
+this.BoltzSimGraph.setBorder (this.lineBorder2);
+this.BoltzSimGraph.setLayout ( new java.awt.FlowLayout (1, 5, 5));
+this.getContentPane ().add (this.BoltzSimGraph);
+this.BoltzSimGraph.setBackground (java.awt.Color.white);
+this.BoltzSimGraph.setBounds (0, 0, 384, 300);
+this.BoltzSimGraph.add (this.DispBoltz);
+this.DispBoltz.setPreferredSize ( new java.awt.Dimension (380, 294));
+this.DispBoltz.setBounds (2, 6, 380, 294);
+this.EntropyGraph.setBorder (this.lineBorder1);
+this.EntropyGraph.setLayout ( new java.awt.FlowLayout (1, 5, 5));
+this.getContentPane ().add (this.EntropyGraph);
+this.EntropyGraph.setBackground (java.awt.Color.white);
+this.EntropyGraph.setBounds (384, 0, 180, 156);
+this.EntropyGraph.add (this.DispEntropy);
+this.DispEntropy.setPreferredSize ( new java.awt.Dimension (178, 150));
+this.DispEntropy.setBounds (1, 6, 178, 150);
+this.UserInput.setLayout ( new java.awt.GridBagLayout ());
+this.getContentPane ().add (this.UserInput);
+this.UserInput.setBackground (java.awt.Color.yellow);
+this.UserInput.setBounds (0, 300, 384, 96);
+this.lQuanta.setText ("Initial Energy");
+this.UserInput.add (this.lQuanta,  new java.awt.GridBagConstraints (0, 0, 1, 1, 1.0, 1.0, 10, 0,  new java.awt.Insets (0, 0, 0, 0), 0, 0));
+this.lQuanta.setBounds (15, 6, 97, 15);
+this.lParticles.setText ("No. of Particles");
+this.UserInput.add (this.lParticles,  new java.awt.GridBagConstraints (1, 0, 1, 1, 1.0, 0.0, 10, 0,  new java.awt.Insets (0, 0, 0, 0), 0, 0));
+this.lParticles.setBounds (149, 6, 86, 15);
+this.lCollisions.setText ("No. of Collisions");
+this.UserInput.add (this.lCollisions,  new java.awt.GridBagConstraints (2, 0, 1, 1, 1.0, 0.0, 10, 0,  new java.awt.Insets (0, 0, 0, 0), 0, 0));
+this.lCollisions.setBounds (275, 6, 90, 15);
+this.tEnergy.setAutoscrolls (false);
+this.tEnergy.setColumns (10);
+this.tEnergy.setNextFocusableComponent (this.tParticles);
+this.UserInput.add (this.tEnergy,  new java.awt.GridBagConstraints (0, 1, 1, 1, 1.0, 1.0, 10, 0,  new java.awt.Insets (0, 0, 0, 0), 0, 0));
+this.tEnergy.setBounds (9, 33, 110, 19);
+this.tParticles.setAutoscrolls (false);
+this.tParticles.setColumns (10);
+this.tParticles.setNextFocusableComponent (this.tCollisions);
+this.UserInput.add (this.tParticles,  new java.awt.GridBagConstraints (1, 1, 1, 1, 1.0, 1.0, 10, 0,  new java.awt.Insets (0, 0, 0, 0), 0, 0));
+this.tParticles.setBounds (137, 33, 110, 19);
+this.tCollisions.setAutoscrolls (false);
+this.tCollisions.setColumns (10);
+this.tCollisions.setNextFocusableComponent (this.bStartSim);
+this.UserInput.add (this.tCollisions,  new java.awt.GridBagConstraints (2, 1, 1, 1, 1.0, 1.0, 10, 0,  new java.awt.Insets (0, 0, 0, 0), 0, 0));
+this.tCollisions.setBounds (265, 33, 110, 19);
+this.bStartSim.setText ("Start");
+this.bStartSim.setActionCommand ("Start");
+this.bStartSim.setNextFocusableComponent (this.tEnergy);
+this.UserInput.add (this.bStartSim,  new java.awt.GridBagConstraints (1, 2, 1, 1, 1.0, 1.0, 10, 0,  new java.awt.Insets (0, 0, 0, 0), 0, 0));
+this.bStartSim.setBackground (java.awt.Color.green);
+this.bStartSim.setBounds (160, 64, 63, 25);
+this.DispResults.setHorizontalScrollBarPolicy (31);
+this.DispResults.setVerticalScrollBarPolicy (22);
+this.DispResults.setOpaque (true);
+this.getContentPane ().add (this.DispResults);
+this.DispResults.setBounds (384, 156, 180, 240);
+this.ShowText.setRows (10000);
+this.ShowText.setDisabledTextColor ( new java.awt.Color (153, 153, 153));
+this.DispResults.getViewport ().add (this.ShowText);
+this.ShowText.setBounds (0, 0, 162, 150000);
+var lSymAction = Clazz.innerTypeInstance (org.uwi.Boltzmann.SymAction, this, null);
+this.bStartSim.addActionListener (lSymAction);
+this.tEnergy.addActionListener (lSymAction);
+this.tParticles.addActionListener (lSymAction);
+this.tCollisions.addActionListener (lSymAction);
+var aSymMouse = Clazz.innerTypeInstance (org.uwi.Boltzmann.SymMouse, this, null);
+this.ShowText.addMouseListener (aSymMouse);
+this.setBackground (java.awt.Color.white);
+this.maxParticles = 10000;
+this.maxCollisions = 60000;
+this.initialEnergy = 250;
+this.EntropyCalcs = 50;
+this.tEnergy.setText (Integer.toString (this.initialEnergy));
+this.tParticles.setText (Integer.toString (this.maxParticles));
+this.tCollisions.setText (Integer.toString (this.maxCollisions));
+this.initEnvironment ();
+});
+Clazz.defineMethod (c$, "bStartSim_actionPerformed", 
+function (event) {
+if (!this.initEnvironment ()) return;
+if (this.simThread != null) this.simThread.interrupt ();
+this.simThread =  new org.uwi.SimThread (this);
+this.simThread.start ();
+}, "java.awt.event.ActionEvent");
+Clazz.defineMethod (c$, "initEnvironment", 
+function () {
+try {
+var tmp = (Integer.parseInt (this.tCollisions.getText ().trim ()));
+if (tmp >= 200) this.maxCollisions = tmp;
+tmp = (Integer.parseInt (this.tEnergy.getText ().trim ()));
+if (tmp > 0) this.initialEnergy = tmp;
+tmp = (Integer.parseInt (this.tParticles.getText ().trim ()));
+if (tmp >= 50) this.maxParticles = tmp;
+} catch (e) {
+if (Clazz.exceptionOf (e, NumberFormatException)) {
+return false;
+} else {
+throw e;
+}
+}
+this.DispBoltz.maxEnergy = 20 * this.initialEnergy;
+this.particleEnergy =  Clazz.newIntArray (this.maxParticles, 0);
+this.DispBoltz.energyLevels =  Clazz.newIntArray (this.DispBoltz.maxEnergy + 1, 0);
+this.curMaxEnergy = this.initialEnergy;
+this.DispEntropy.Entropy =  Clazz.newDoubleArray (this.EntropyCalcs + 1, 0);
+this.DispEntropy.EntropyCalc = this.EntropyCalcs;
+this.DispEntropy.entCounter = 0;
+for (var i = 0; i < this.maxParticles; i++) {
+this.particleEnergy[i] = this.initialEnergy;
+}
+for (var i = 0; i <= this.DispBoltz.maxEnergy; i++) {
+this.DispBoltz.energyLevels[i] = 0;
+}
+for (var i = 0; i < this.EntropyCalcs; i++) {
+this.DispEntropy.Entropy[i] = 0;
+}
+this.DispBoltz.energyLevels[this.initialEnergy] = this.maxParticles;
+return true;
+});
+Clazz.defineMethod (c$, "calcEntropy", 
+function (x) {
+var i;
+this.DispEntropy.Entropy[x] = this.maxParticles * Math.log (this.maxParticles);
+for (i = 0; i <= this.curMaxEnergy; i++) if (this.DispBoltz.energyLevels[i] > 0) this.DispEntropy.Entropy[x] = this.DispEntropy.Entropy[x] - (this.DispBoltz.energyLevels[i] * Math.log (this.DispBoltz.energyLevels[i]));
+
+}, "~N");
+Clazz.defineMethod (c$, "ShowText_mouseReleased", 
+function (event) {
+}, "java.awt.event.MouseEvent");
+Clazz.defineMethod (c$, "sjs_initSimulation", 
+function () {
+this.numOfCollisions = this.maxCollisions;
+this.entropyFactor = Clazz.doubleToInt (Math.ceil (Clazz.doubleToInt (this.maxCollisions / this.EntropyCalcs)));
+{
+this.displayFactor = 100;
+}});
+Clazz.defineMethod (c$, "sjs_loopSimulation", 
+function () {
+this.particle1 = Clazz.doubleToInt ((this.maxParticles - 1) * Math.random ());
+this.particle2 = Clazz.doubleToInt ((this.maxParticles - 1) * Math.random ());
+while (this.particle1 == this.particle2) {
+this.particle2 = Clazz.doubleToInt ((this.maxParticles - 1) * Math.random ());
+}
+if (this.particleEnergy[this.particle1] < this.particleEnergy[this.particle2]) {
+var temp = this.particleEnergy[this.particle1];
+this.particleEnergy[this.particle1] = this.particleEnergy[this.particle2];
+this.particleEnergy[this.particle2] = temp;
+}this.e1 = this.particleEnergy[this.particle1];
+this.e2 = this.particleEnergy[this.particle2];
+this.collisionEnergy = Clazz.doubleToInt (Math.ceil (this.e1 * Math.random ()));
+this.particleEnergy[this.particle1] = this.e1 - this.collisionEnergy;
+this.particleEnergy[this.particle2] = this.e2 + this.collisionEnergy;
+this.DispBoltz.energyLevels[this.e1] = this.DispBoltz.energyLevels[this.e1] - 1;
+this.DispBoltz.energyLevels[this.e2] = this.DispBoltz.energyLevels[this.e2] - 1;
+this.e1 = this.particleEnergy[this.particle1];
+this.e2 = this.particleEnergy[this.particle2];
+this.DispBoltz.energyLevels[this.e1] = this.DispBoltz.energyLevels[this.e1] + 1;
+this.DispBoltz.energyLevels[this.e2] = this.DispBoltz.energyLevels[this.e2] + 1;
+if (this.e1 < this.e2) this.e1 = this.e2;
+if (this.e1 > this.curMaxEnergy) this.curMaxEnergy = this.e1;
+this.DispBoltz.maxEnergy = this.curMaxEnergy;
+return (--this.numOfCollisions > 0);
+});
+Clazz.defineMethod (c$, "sjs_finalizeGraph", 
+function () {
+for (var i = this.curMaxEnergy; i > 0; i--) {
+if (this.DispBoltz.energyLevels[i] < 1) this.curMaxEnergy--;
+ else break;
+}
+this.showTheText ();
+});
+Clazz.defineMethod (c$, "showTheText", 
+ function () {
+this.ShowText.levelInfo.setLength (0);
+this.ShowText.appendLine ("Init. Energy   = " + this.initialEnergy);
+this.ShowText.appendLine ("No. particles  = " + this.maxParticles);
+this.ShowText.appendLine ("No. collisions = " + this.maxCollisions);
+this.ShowText.appendLine ("-------------");
+for (var i = 1; i <= this.curMaxEnergy; i++) this.ShowText.appendLine ("EL " + i + "= " + this.DispBoltz.energyLevels[i]);
+
+this.ShowText.appendLine ("-------------");
+var df =  new java.text.DecimalFormat ("0.00");
+for (var i = 0; i < this.EntropyCalcs; i++) this.ShowText.appendLine ("WL " + i + "= " + df.format (this.DispEntropy.Entropy[i]));
+
+this.ShowText.setRows (this.curMaxEnergy + this.EntropyCalcs + 2);
+this.ShowText.setText (this.ShowText.levelInfo.toString ());
+this.repaint ();
+});
+Clazz.defineMethod (c$, "sjs_checkRepaint", 
+function () {
+if ((this.numOfCollisions % this.entropyFactor) == 0) {
+this.calcEntropy (this.DispEntropy.entCounter++);
+this.DispEntropy.invalidate ();
+}if ((this.numOfCollisions % this.displayFactor) != 1) return false;
+this.repaint ();
+return true;
+});
+c$.$Boltzmann$SymAction$ = function () {
+Clazz.pu$h(self.c$);
+c$ = Clazz.decorateAsClass (function () {
+Clazz.prepareCallback (this, arguments);
+Clazz.instantialize (this, arguments);
+}, org.uwi.Boltzmann, "SymAction", null, java.awt.event.ActionListener);
+Clazz.overrideMethod (c$, "actionPerformed", 
+function (a) {
+var b = a.getSource ();
+if (b === this.b$["org.uwi.Boltzmann"].bStartSim) this.b$["org.uwi.Boltzmann"].bStartSim_actionPerformed (a);
+this.b$["org.uwi.Boltzmann"].ShowText.levelInfo.setLength (0);
+}, "java.awt.event.ActionEvent");
+c$ = Clazz.p0p ();
+};
+c$.$Boltzmann$LevelInfoArea$ = function () {
+Clazz.pu$h(self.c$);
+c$ = Clazz.decorateAsClass (function () {
+Clazz.prepareCallback (this, arguments);
+this.levelInfo = null;
+Clazz.instantialize (this, arguments);
+}, org.uwi.Boltzmann, "LevelInfoArea", javax.swing.JTextArea);
+Clazz.prepareFields (c$, function () {
+this.levelInfo =  new JU.SB ();
+});
+Clazz.makeConstructor (c$, 
+function () {
+Clazz.superConstructor (this, org.uwi.Boltzmann.LevelInfoArea);
+this.levelInfo.setLength (0);
+});
+Clazz.defineMethod (c$, "appendLine", 
+function (a) {
+this.levelInfo.append (a).append ("\n");
+}, "~S");
+c$ = Clazz.p0p ();
+};
+c$.$Boltzmann$SymMouse$ = function () {
+Clazz.pu$h(self.c$);
+c$ = Clazz.decorateAsClass (function () {
+Clazz.prepareCallback (this, arguments);
+Clazz.instantialize (this, arguments);
+}, org.uwi.Boltzmann, "SymMouse", java.awt.event.MouseAdapter);
+Clazz.overrideMethod (c$, "mouseReleased", 
+function (a) {
+var b = a.getSource ();
+if (b === this.b$["org.uwi.Boltzmann"].ShowText) this.b$["org.uwi.Boltzmann"].ShowText_mouseReleased (a);
+}, "java.awt.event.MouseEvent");
+c$ = Clazz.p0p ();
+};
+});