X-Git-Url: http://source.jalview.org/gitweb/?a=blobdiff_plain;ds=sidebyside;f=src%2FMCview%2FAtom.java;h=e38d7aaad1b7a35a9d9c90124b445bcbc476a7c2;hb=f4b7a6009254c29ca4bc4a2b73de173b12b752c7;hp=b3a8fdb11955198d4ab41f1216dd0eabe0e13a58;hpb=99c58ee0ae2a848f982552e53feaf6d5cb9925e5;p=jalview.git diff --git a/src/MCview/Atom.java b/src/MCview/Atom.java index b3a8fdb..e38d7aa 100755 --- a/src/MCview/Atom.java +++ b/src/MCview/Atom.java @@ -16,56 +16,59 @@ * along with this program; if not, write to the Free Software * Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, USA */ - package MCview; -import java.util.*; + import java.awt.*; +import java.util.*; + + public class Atom { - double x; - double y; - double z; - int number; - String name; - String resName; - int resNumber; - int type; - Color color; - String chain; + float x; + float y; + float z; + int number; + String name; + String resName; + int resNumber; + int type; + Color color; + String chain; - public Atom(StringTokenizer str) { - this.number = (new Integer(str.nextToken())).intValue(); - this.name = str.nextToken(); - this.resName = str.nextToken(); + public boolean isSelected = false; - String tmpstr = new String(); + public Atom(StringTokenizer str) + { + str.nextToken(); // Number, not used in MCview + this.name = str.nextToken(); // Name, not used in MCview - try { - tmpstr = str.nextToken(); + this.resName = str.nextToken(); - this.resNumber = (new Integer(tmpstr).intValue()); - this.chain = "A"; - this.color = Color.green; + String token1 = str.nextToken(); - } catch(NumberFormatException e) { - this.chain = tmpstr; + String token2 = str.nextToken(); - if (tmpstr.equals("A")) { - this.color = new Color((float)Math.random(),(float)Math.random(),(float)Math.random()); - } else { - this.color = Color.red; - } - this.resNumber = (new Integer(str.nextToken()).intValue()); - } + try{ - this.x = (double)(new Double(str.nextToken()).floatValue()); - this.y = (double)(new Double(str.nextToken()).floatValue()); - this.z = (double)(new Double(str.nextToken()).floatValue()); + this.chain = token1; + resNumber = Integer.parseInt(token2); - } + this.x = (float) (new Float(str.nextToken()).floatValue()); + this.y = (float) (new Float(str.nextToken()).floatValue()); + this.z = (float) (new Float(str.nextToken()).floatValue()); - public void setColor(Color col) { - this.color = col; - } + }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()); + } + } + + public void setColor(Color col) { + this.color = col; + } }