adding a test case
[IRC.git] / Robust / src / Analysis / Disjoint / EdgeKey.java
1 package Analysis.Disjoint;
2
3 import IR.*;
4
5
6 public class EdgeKey {
7   private Integer srcId;
8   private Integer dstId;
9   private FieldDescriptor f;
10
11   public EdgeKey(Integer srcId, Integer dstId, FieldDescriptor f) {
12     this.srcId = srcId;
13     this.dstId = dstId;
14     this.f     = f;
15   }
16
17   public String toString() {
18     return "<"+srcId+", "+f+", "+dstId+">";
19   }
20
21   public Integer getSrcId() {
22     return srcId;
23   }
24
25   public Integer getDstId() {
26     return dstId;
27   }
28
29   public FieldDescriptor getField() {
30     return f;
31   }
32
33   public boolean equals(Object o) {
34     if(this == o) {
35       return true;
36     }
37     if(o == null) {
38       return false;
39     }
40     if(!(o instanceof EdgeKey)) {
41       return false;
42     }
43
44     EdgeKey ek = (EdgeKey) o;
45
46     return 
47       this.srcId.equals(ek.srcId) &&
48       this.dstId.equals(ek.dstId) &&
49       this.f.equals(ek.f);
50   }
51
52   public int hashCode() {
53     return srcId.hashCode() ^ dstId.hashCode() ^ f.hashCode();
54   }
55 }