changes towards method context insensitive analysis.
[IRC.git] / Robust / src / Analysis / MLP / StallSite.java
1 package Analysis.MLP;
2
3 import java.util.HashSet;
4
5 import Analysis.OwnershipAnalysis.ReachabilitySet;
6
7 public class StallSite {
8
9         public static final Integer READ_EFFECT = new Integer(1);
10         public static final Integer WRITE_EFFECT = new Integer(2);
11
12         private HashSet<Effect> effectSet;
13         private HashSet<Integer> hrnIDSet;
14         private ReachabilitySet rechabilitySet;
15
16         public StallSite() {
17                 effectSet = new HashSet<Effect>();
18                 hrnIDSet = new HashSet<Integer>();
19                 rechabilitySet = new ReachabilitySet();
20         }
21
22         public StallSite(HashSet<Effect> effectSet, HashSet<Integer> hrnIDSet,
23                         ReachabilitySet rechabilitySet) {
24                 this.effectSet = effectSet;
25                 this.hrnIDSet = hrnIDSet;
26                 this.rechabilitySet = rechabilitySet;
27         }
28
29         public void addEffect(String type, String field, Integer effect) {
30                 Effect e = new Effect(type, field, effect);
31                 effectSet.add(e);
32         }
33
34         public HashSet<Effect> getEffectSet() {
35                 return effectSet;
36         }
37
38         public HashSet<Integer> getHRNIDSet() {
39                 return hrnIDSet;
40         }
41
42         public ReachabilitySet getReachabilitySet() {
43                 return rechabilitySet;
44         }
45
46         public boolean equals(Object o) {
47
48                 if (o == null) {
49                         return false;
50                 }
51
52                 if (!(o instanceof StallSite)) {
53                         return false;
54                 }
55
56                 StallSite in = (StallSite) o;
57
58                 if (effectSet.equals(in.getEffectSet())
59                                 && hrnIDSet.equals(in.getHRNIDSet())
60                                 && rechabilitySet.equals(in.getReachabilitySet())) {
61                         return true;
62                 } else {
63                         return false;
64                 }
65
66         }
67 }
68
69 class Effect {
70
71         private String field;
72         private String type;
73         private Integer effect;
74
75         public Effect(String type, String field, Integer effect) {
76                 this.type = type;
77                 this.field = field;
78                 this.effect = effect;
79         }
80
81         public String getField() {
82                 return field;
83         }
84
85         public String getType() {
86                 return type;
87         }
88
89         public Integer getEffect() {
90                 return effect;
91         }
92
93         public boolean equals(Object o) {
94
95                 if (o == null) {
96                         return false;
97                 }
98
99                 if (!(o instanceof StallSite)) {
100                         return false;
101                 }
102
103                 Effect in = (Effect) o;
104
105                 if (type.equals(in.getType()) && field.equals(in.getField())
106                                 && effect.equals(in.getEffect())) {
107                         return true;
108                 } else {
109                         return false;
110                 }
111
112         }
113
114 }