changes
[IRC.git] / Robust / src / IR / Flat / FlatEdge.java
1 package IR.Flat;
2
3 public class FlatEdge {
4
5   protected FlatNode tail;
6   protected FlatNode head;
7
8   public FlatEdge( FlatNode t, FlatNode h ) {
9     assert t != null;
10     assert h != null;
11     tail = t;
12     head = h;
13   }
14
15   public boolean equals( Object o ) {
16     if( o == null ) {
17       return false;
18     }
19     
20     if( !(o instanceof FlatEdge) ) {
21       return false;
22     }
23
24     FlatEdge fe = (FlatEdge) o;
25
26     return tail.equals( fe.tail ) && head.equals( fe.head );
27   }
28
29   public int hashCode() {
30     int tailHC = tail.hashCode();
31     int headHC = head.hashCode();
32
33     int hash = 7;
34     hash = 31*hash + tailHC;
35     hash = 31*hash + headHC;
36     return hash;
37   }
38
39   public String toString() {
40     return "FlatEdge("+tail+"->"+head+")";
41   }
42 }