changes: now Inference engine works fine with the EyeTracking benchmark.
[IRC.git] / Robust / src / Analysis / SSJava / MethodSummary.java
1 package Analysis.SSJava;
2
3 import java.util.HashMap;
4 import java.util.Map;
5
6 import IR.Descriptor;
7 import IR.MethodDescriptor;
8
9 public class MethodSummary extends LocationSummary {
10
11   MethodDescriptor md;
12
13   String thisLocName;
14   String globalLocName;
15
16   CompositeLocation pcLoc;
17   CompositeLocation returnLoc;
18
19   Map<Integer, CompositeLocation> mapParamIdxToInferLoc;
20   Map<Descriptor, CompositeLocation> mapVarDescToInferCompositeLocation;
21
22   boolean hasGlobalAccess;
23
24   public MethodSummary(MethodDescriptor md) {
25     this.md = md;
26     this.pcLoc = new CompositeLocation(new Location(md, Location.TOP));
27     this.mapParamIdxToInferLoc = new HashMap<Integer, CompositeLocation>();
28     this.mapVarDescToInferCompositeLocation = new HashMap<Descriptor, CompositeLocation>();
29     this.thisLocName = "this";
30     this.globalLocName = "GLOBAL";
31     this.hasGlobalAccess = false;
32   }
33
34   public Map<Descriptor, CompositeLocation> getMapVarDescToInferCompositeLocation() {
35     return mapVarDescToInferCompositeLocation;
36   }
37
38   public void addMapVarNameToInferCompLoc(Descriptor varDesc, CompositeLocation inferLoc) {
39     mapVarDescToInferCompositeLocation.put(varDesc, inferLoc);
40   }
41
42   public CompositeLocation getInferLocation(Descriptor varDesc) {
43     return mapVarDescToInferCompositeLocation.get(varDesc);
44     // if (mapVarNameToInferCompositeLocation.containsKey(varName)) {
45     // // it already has a composite location assignment.
46     // return mapVarNameToInferCompositeLocation.get(varName);
47     // } else {
48     // String locName = getLocationName(varName);
49     // return new CompositeLocation(new Location(md, locName));
50     // }
51   }
52
53   public void addMapParamIdxToInferLoc(int paramIdx, CompositeLocation inferLoc) {
54     mapParamIdxToInferLoc.put(paramIdx, inferLoc);
55   }
56
57   public Map<Integer, CompositeLocation> getMapParamIdxToInferLoc() {
58     return mapParamIdxToInferLoc;
59   }
60
61   public void setPCLoc(CompositeLocation in) {
62     this.pcLoc = in;
63   }
64
65   public CompositeLocation getPCLoc() {
66     return pcLoc;
67   }
68
69   public void setRETURNLoc(CompositeLocation in) {
70     this.returnLoc = in;
71   }
72
73   public CompositeLocation getRETURNLoc() {
74     return returnLoc;
75   }
76
77   public void setThisLocName(String name) {
78     this.thisLocName = name;
79   }
80
81   public String getThisLocName() {
82     return thisLocName;
83   }
84
85   public void setGlobalLocName(String name) {
86     this.globalLocName = name;
87   }
88
89   public String getGlobalLocName() {
90     return globalLocName;
91   }
92
93   public void setHasGlobalAccess() {
94     this.hasGlobalAccess = true;
95   }
96
97   public boolean hasGlobalAccess() {
98     return hasGlobalAccess;
99   }
100
101 }