minor 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
10         public EffectsKey(String fd, TypeDescriptor td) {
11                 this.fd = fd;
12                 this.td = td;
13         }
14
15         public String getFieldDescriptor() {
16                 return fd;
17         }
18
19         public TypeDescriptor getTypeDescriptor() {
20                 return td;
21         }
22
23         public String toString() {
24                 return "(" + td + ")" + fd;
25         }
26
27         public int hashCode() {
28
29                 int hash = 1;
30
31                 if (fd != null) {
32                         hash = hash * 31 + fd.hashCode();
33                 }
34
35                 if (td != null) {
36                         hash += td.getSymbol().hashCode();
37                 }
38
39                 return hash;
40
41         }
42
43         public boolean equals(Object o) {
44
45                 if (o == null) {
46                         return false;
47                 }
48
49                 if (!(o instanceof EffectsKey)) {
50                         return false;
51                 }
52
53                 EffectsKey in = (EffectsKey) o;
54
55                 if (fd.equals(in.getFieldDescriptor())
56                                 && td.getSymbol().equals(in.getTypeDescriptor().getSymbol())) {
57                         return true;
58                 } else {
59                         return false;
60                 }
61
62         }
63 }