use OOMwarning to warn user when out of Memory occurs
[jalview.git] / src / MCview / Bond.java
1 /*
2  * Jalview - A Sequence Alignment Editor and Viewer (Version 2.4)
3  * Copyright (C) 2008 AM Waterhouse, J Procter, G Barton, M Clamp, S Searle
4  * 
5  * This program is free software; you can redistribute it and/or
6  * modify it under the terms of the GNU General Public License
7  * as published by the Free Software Foundation; either version 2
8  * of the License, or (at your option) any later version.
9  * 
10  * This program is distributed in the hope that it will be useful,
11  * but WITHOUT ANY WARRANTY; without even the implied warranty of
12  * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
13  * GNU General Public License for more details.
14  * 
15  * You should have received a copy of the GNU General Public License
16  * along with this program; if not, write to the Free Software
17  * Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA  02110-1301, USA
18  */
19 package MCview;
20
21 import java.awt.*;
22
23 public class Bond
24 {
25   float[] start;
26   float[] end;
27   Color startCol = Color.lightGray;
28   Color endCol = Color.lightGray;
29   public Atom at1;
30   public Atom at2;
31
32   public Bond(float[] start, float[] end, Atom at1, Atom at2)
33   {
34     this.start = start;
35     this.end = end;
36     this.startCol = at1.color;
37     this.endCol = at2.color;
38     this.at1 = at1;
39     this.at2 = at2;
40   }
41
42   /*  public Bond(Bond bond) {
43         this.start = new float[3];
44
45         this.start[0] = bond.start[0];
46         this.start[1] = bond.start[1];
47         this.start[2] = bond.start[2];
48
49         this.end = new float[3];
50
51         this.end[0] = bond.end[0];
52         this.end[1] = bond.end[1];
53         this.end[2] = bond.end[2];
54
55         this.startCol = bond.startCol;
56         this.endCol = bond.endCol;
57     }
58
59     public float length() {
60         float len = ((end[0] - start[0]) * (end[0] - start[0])) +
61             ((end[1] - start[1]) * (end[1] - start[1])) +
62             ((end[2] - start[2]) * (end[2] - start[2]));
63
64         len = (float) (Math.sqrt(len));
65
66         return len;
67     }*/
68
69   public void translate(float x, float y, float z)
70   {
71     start[0] = (start[0] + x);
72     end[0] = (end[0] + x);
73
74     start[1] = (start[1] + y);
75     end[1] = (end[1] + y);
76
77     start[2] = (start[2] + z);
78     end[2] = (end[2] + z);
79   }
80 }