Revision: | 175 |
Committed: | Fri May 25 17:31:58 2007 UTC (17 years, 4 months ago) by duarte |
Original Path: | trunk/proteinstructure/Contact.java | File size: | 727 byte(s) |
Log Message: | FIXED BUG in initialisation of fullLength when reading from file. In case of no sequence and nodes provided, was not getting correctly the maximum value for contacts. Now using the method getMaxContact from new class ContactList NEW FUNCTIONALITY in Graph: -New member variable modified -New methods addEdge, delEdge, restrictContactsToMaxRange, restrictContactsToMinRange, getContacts, getNodes, copy -Improved slightly the implementation of getEdgeNbh FIXED BUG in initialisation of fullLenght when reading from file. In case of no sequence and nodes provided, was not getting correctly the maximum value for contacts. Now using the method getMaxContact from ContactList New class ContactList NEW FUNCTIONALITY in Graph: -New member variable modified -New methods addEdge, delEdge, restrictContactsToMaxRange, restrictContactsToMinRange, getContacts, getNodes, copy -Improved slightly the implementation of getEdgeNbh New method getRange in Contact |
Line | User | Rev | File contents |
---|---|---|---|
1 | duarte | 123 | package proteinstructure; |
2 | import java.lang.Comparable; | ||
3 | |||
4 | public class Contact implements Comparable { | ||
5 | |||
6 | public int i; | ||
7 | public int j; | ||
8 | |||
9 | public Contact(int i,int j){ | ||
10 | this.i=i; | ||
11 | this.j=j; | ||
12 | } | ||
13 | |||
14 | public int compareTo(Object o) { | ||
15 | int diff=0; | ||
16 | Contact other = (Contact) o; | ||
17 | if (this.i>other.i){ | ||
18 | diff=1; | ||
19 | } | ||
20 | else if (this.i<other.i){ | ||
21 | diff=-1; | ||
22 | } | ||
23 | else if (this.i==other.i){ | ||
24 | if (this.j>other.j){ | ||
25 | diff=1; | ||
26 | } | ||
27 | else if (this.j<other.j){ | ||
28 | diff=-1; | ||
29 | } | ||
30 | } | ||
31 | return diff; | ||
32 | } | ||
33 | |||
34 | public boolean equals(Object o){ | ||
35 | boolean eq = false; | ||
36 | Contact other = (Contact) o; | ||
37 | if (this.i==other.i && this.j==other.j){ | ||
38 | eq=true; | ||
39 | } | ||
40 | return eq; | ||
41 | } | ||
42 | duarte | 175 | |
43 | public int getRange(){ | ||
44 | return Math.abs(this.i-this.j); | ||
45 | } | ||
46 | duarte | 123 | } |