From: amwaterhouse Date: Wed, 16 Nov 2005 16:40:02 +0000 (+0000) Subject: Parsing updates X-Git-Url: http://source.jalview.org/gitweb/?a=commitdiff_plain;h=7b5ff2f535d8daa50b43d6bdc11707ec70f32712;p=jalview.git Parsing updates --- diff --git a/src/MCview/Atom.java b/src/MCview/Atom.java index 0aaf040..e38d7aa 100755 --- a/src/MCview/Atom.java +++ b/src/MCview/Atom.java @@ -24,9 +24,9 @@ import java.util.*; public class Atom { - double x; - double y; - double z; + float x; + float y; + float z; int number; String name; String resName; @@ -35,35 +35,37 @@ public class Atom { Color color; String chain; - public Atom(StringTokenizer str) { - this.number = (new Integer(str.nextToken())).intValue(); - this.name = str.nextToken(); + public boolean isSelected = false; + + public Atom(StringTokenizer str) + { + str.nextToken(); // Number, not used in MCview + this.name = str.nextToken(); // Name, not used in MCview + this.resName = str.nextToken(); - String tmpstr = new String(); + String token1 = str.nextToken(); + + String token2 = str.nextToken(); - try { - tmpstr = str.nextToken(); + try{ - this.resNumber = (new Integer(tmpstr).intValue()); - this.chain = "A"; - this.color = Color.green; - } catch (NumberFormatException e) { - this.chain = tmpstr; + this.chain = token1; + resNumber = Integer.parseInt(token2); - if (tmpstr.equals("A")) { - this.color = new Color((float) Math.random(), - (float) Math.random(), (float) Math.random()); - } else { - this.color = Color.red; - } + this.x = (float) (new Float(str.nextToken()).floatValue()); + this.y = (float) (new Float(str.nextToken()).floatValue()); + this.z = (float) (new Float(str.nextToken()).floatValue()); - this.resNumber = (new Integer(str.nextToken()).intValue()); + }catch(NumberFormatException ex) + { + chain = "A"; + resNumber = Integer.parseInt(token1); + this.x = (float) (new Float(token2).floatValue()); + this.y = (float) (new Float(str.nextToken()).floatValue()); + this.z = (float) (new Float(str.nextToken()).floatValue()); } - this.x = (double) (new Double(str.nextToken()).floatValue()); - this.y = (double) (new Double(str.nextToken()).floatValue()); - this.z = (double) (new Double(str.nextToken()).floatValue()); } public void setColor(Color col) {