| 1 | package align2; |
| 2 | |
| 3 | public class Quad implements Comparable<Quad>{ |
| 4 | |
| 5 | public Quad(int col_, int row_, int val_){ |
| 6 | column=col_; |
| 7 | row=row_; |
| 8 | site=val_; |
| 9 | } |
| 10 | |
| 11 | @Override |
| 12 | public boolean equals(Object other){ |
| 13 | return site==((Quad)other).site; |
| 14 | } |
| 15 | |
| 16 | @Override |
| 17 | public int hashCode(){return site;} |
| 18 | |
| 19 | @Override |
| 20 | public int compareTo(Quad other) { |
| 21 | int x=site-other.site; |
| 22 | return(x==0 ? column-other.column : x); |
| 23 | } |
| 24 | |
| 25 | @Override |
| 26 | public String toString(){ |
| 27 | return("("+column+","+row+","+site+")"); |
| 28 | } |
| 29 | |
| 30 | public final int column; |
| 31 | public int row; |
| 32 | public int site; |
| 33 | public int list[]; |
| 34 | |
| 35 | } |