New files
[jalview.git] / src / MCview / Atom.java
1 package MCview;\r
2 import java.util.*;\r
3 import java.awt.*;\r
4 \r
5 public class Atom {\r
6   double x;\r
7   double y;\r
8   double z;\r
9   int number;\r
10   String name;\r
11   String resName;\r
12   int resNumber;\r
13   int type;\r
14   Color color;\r
15   String chain;\r
16 \r
17   public Atom(StringTokenizer str) {\r
18     this.number  = (new Integer(str.nextToken())).intValue();\r
19     this.name    = str.nextToken();\r
20     this.resName = str.nextToken();\r
21 \r
22     String tmpstr = new String();\r
23 \r
24     try {\r
25       tmpstr = str.nextToken();\r
26 \r
27       this.resNumber = (new Integer(tmpstr).intValue());\r
28       this.chain     = "A";\r
29       this.color     = Color.green;\r
30 \r
31     } catch(NumberFormatException e) {\r
32       this.chain = tmpstr;\r
33 \r
34       if (tmpstr.equals("A")) {\r
35         this.color = new Color((float)Math.random(),(float)Math.random(),(float)Math.random());\r
36       } else {\r
37         this.color = Color.red;\r
38       }\r
39       this.resNumber = (new Integer(str.nextToken()).intValue());\r
40     }\r
41 \r
42     this.x = (double)(new Double(str.nextToken()).floatValue());\r
43     this.y = (double)(new Double(str.nextToken()).floatValue());\r
44     this.z = (double)(new Double(str.nextToken()).floatValue());\r
45 \r
46   }\r
47 \r
48   public void setColor(Color col) {\r
49     this.color = col;\r
50   }\r
51 \r
52 }\r