changes.
[IRC.git] / Robust / src / Analysis / OwnershipAnalysis / EffectsKey.java
1 package Analysis.OwnershipAnalysis;
2
3 import IR.TypeDescriptor;
4
5 public class EffectsKey {
6
7   private String fd;
8   private TypeDescriptor td;
9   private Integer hrnId;
10   private String hrnUniqueId;
11   private int paramIden;
12
13   public EffectsKey(String fd, TypeDescriptor td, Integer hrnId, String hrnUniqueId, int paramIden) {
14     this.fd = fd;
15     this.td = td;
16     this.hrnId = hrnId;
17     this.hrnUniqueId=hrnUniqueId;
18     this.paramIden=paramIden;
19   }
20
21   public int getParamIden() {
22     return paramIden;
23   }
24
25   public String getFieldDescriptor() {
26     return fd;
27   }
28
29   public TypeDescriptor getTypeDescriptor() {
30     return td;
31   }
32
33   public Integer getHRNId() {
34     return hrnId;
35   }
36
37   public String getHRNUniqueId() {
38     return hrnUniqueId;
39   }
40
41   public String toString() {
42     return "(" + td + ")" + fd + "#" + hrnId;
43   }
44
45   public int hashCode() {
46
47     int hash = 1;
48
49     if (fd != null) {
50       hash = hash * 31 + fd.hashCode();
51     }
52
53     if (td != null) {
54       hash += td.getSymbol().hashCode();
55     }
56
57     if (hrnId != null) {
58       hash += hrnId.hashCode();
59     }
60
61     return hash;
62
63   }
64
65   public boolean equals(Object o) {
66
67     if (o == null) {
68       return false;
69     }
70
71     if (!(o instanceof EffectsKey)) {
72       return false;
73     }
74
75     EffectsKey in = (EffectsKey) o;
76
77     if (fd.equals(in.getFieldDescriptor())
78         && td.getSymbol().equals(in.getTypeDescriptor().getSymbol())
79         && hrnId.equals(in.getHRNId())) {
80       return true;
81     } else {
82       return false;
83     }
84
85   }
86 }