JAL-1807 test
[jalviewjs.git] / bin / MCview / Atom.js
1 Clazz.declarePackage ("MCview");
2 Clazz.load (["java.awt.Color"], "MCview.Atom", ["java.lang.Float"], function () {
3 c$ = Clazz.decorateAsClass (function () {
4 this.x = 0;
5 this.y = 0;
6 this.z = 0;
7 this.number = 0;
8 this.name = null;
9 this.resName = null;
10 this.resNumber = 0;
11 this.insCode = ' ';
12 this.resNumIns = null;
13 this.type = 0;
14 this.color = null;
15 this.chain = null;
16 this.alignmentMapping = -1;
17 this.atomIndex = 0;
18 this.occupancy = 0;
19 this.tfactor = 0;
20 this.isSelected = false;
21 Clazz.instantialize (this, arguments);
22 }, MCview, "Atom");
23 Clazz.prepareFields (c$, function () {
24 this.color = java.awt.Color.lightGray;
25 });
26 Clazz.makeConstructor (c$, 
27 function (str) {
28 this.atomIndex = Integer.parseInt (str.substring (6, 11).trim ());
29 this.name = str.substring (12, 15).trim ();
30 this.resName = str.substring (17, 20);
31 this.chain = str.substring (21, 22);
32 this.resNumber = Integer.parseInt (str.substring (22, 26).trim ());
33 this.resNumIns = str.substring (22, 27).trim ();
34 this.insCode = str.substring (26, 27).charAt (0);
35 this.x = ( new Float (str.substring (30, 38).trim ()).floatValue ());
36 this.y = ( new Float (str.substring (38, 46).trim ()).floatValue ());
37 this.z = ( new Float (str.substring (47, 55).trim ()).floatValue ());
38 var tm = str.substring (54, 60).trim ();
39 if (tm.length > 0) {
40 this.occupancy = ( new Float (tm)).floatValue ();
41 } else {
42 this.occupancy = 1;
43 }tm = str.substring (60, 66).trim ();
44 if (tm.length > 0) {
45 this.tfactor = ( new Float (tm).floatValue ());
46 } else {
47 this.tfactor = 1;
48 }}, "~S");
49 Clazz.makeConstructor (c$, 
50 function (x, y, z) {
51 this.x = x;
52 this.y = y;
53 this.z = z;
54 }, "~N,~N,~N");
55 });