X-Git-Url: http://source.jalview.org/gitweb/?a=blobdiff_plain;f=src%2FMCview%2FAtom.java;h=0aaf0409a13314e72fe59bf9391a25960e8ef538;hb=e245254bce4d67fe6842e4ead3ab94624ab1ac59;hp=b3a8fdb11955198d4ab41f1216dd0eabe0e13a58;hpb=99c58ee0ae2a848f982552e53feaf6d5cb9925e5;p=jalview.git diff --git a/src/MCview/Atom.java b/src/MCview/Atom.java index b3a8fdb..0aaf040 100755 --- a/src/MCview/Atom.java +++ b/src/MCview/Atom.java @@ -16,56 +16,57 @@ * 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.*; -public class Atom { - double x; - double y; - double z; - int number; - String name; - String resName; - int resNumber; - int type; - Color color; - String chain; +import java.util.*; - public Atom(StringTokenizer str) { - this.number = (new Integer(str.nextToken())).intValue(); - this.name = str.nextToken(); - this.resName = str.nextToken(); - String tmpstr = new String(); +public class Atom { + double x; + double y; + double z; + int number; + String name; + String resName; + int resNumber; + int type; + Color color; + String chain; - try { - tmpstr = str.nextToken(); + public Atom(StringTokenizer str) { + this.number = (new Integer(str.nextToken())).intValue(); + this.name = str.nextToken(); + this.resName = str.nextToken(); - this.resNumber = (new Integer(tmpstr).intValue()); - this.chain = "A"; - this.color = Color.green; + String tmpstr = new String(); - } catch(NumberFormatException e) { - this.chain = tmpstr; + try { + tmpstr = 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()); - } + this.resNumber = (new Integer(tmpstr).intValue()); + this.chain = "A"; + this.color = Color.green; + } catch (NumberFormatException e) { + this.chain = tmpstr; - this.x = (double)(new Double(str.nextToken()).floatValue()); - this.y = (double)(new Double(str.nextToken()).floatValue()); - this.z = (double)(new Double(str.nextToken()).floatValue()); + 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()); + } - public void setColor(Color col) { - this.color = col; - } + 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) { + this.color = col; + } }