changes on the inference engine.
[IRC.git] / Robust / src / Analysis / SSJava / MethodLocationInfo.java
1 package Analysis.SSJava;
2
3 import java.util.HashMap;
4 import java.util.HashSet;
5 import java.util.Map;
6 import java.util.Set;
7
8 import IR.Descriptor;
9 import IR.MethodDescriptor;
10
11 public class MethodLocationInfo extends LocationInfo {
12
13   String returnLocName;
14   String thisLocName;
15   String PCLocName;
16   String globalLocName;
17
18   Map<Integer, String> mapParamIdxToLocName;
19   Set<String> paramLocNameSet;
20
21   public MethodLocationInfo(MethodDescriptor md) {
22     this.md = md;
23     this.mapParamIdxToLocName = new HashMap<Integer, String>();
24     this.paramLocNameSet = new HashSet<String>();
25     this.PCLocName = SSJavaAnalysis.TOP;
26   }
27
28   /*
29    * public void mapFlowNodeToInferLocation(FlowNode node, CompositeLocation
30    * location) { mapFlowNodeToLocation.put(node, location); }
31    * 
32    * public CompositeLocation getInferLocation(FlowNode node) { return
33    * mapFlowNodeToLocation.get(node); }
34    */
35
36   public void setGlobalLocName(String globalLocName) {
37     this.globalLocName = globalLocName;
38   }
39
40   public String getReturnLocName() {
41     return returnLocName;
42   }
43
44   public void setReturnLocName(String returnLocName) {
45     this.returnLocName = returnLocName;
46   }
47
48   public String getThisLocName() {
49     return thisLocName;
50   }
51
52   public void setThisLocName(String thisLocName) {
53     this.thisLocName = thisLocName;
54   }
55
56   public String getPCLocName() {
57     return PCLocName;
58   }
59
60   public void setPCLocName(String pCLocName) {
61     PCLocName = pCLocName;
62   }
63
64   public void addParameter(String name, Descriptor desc, int idx) {
65     mapParamIdxToLocName.put(new Integer(idx), name);
66     // addMappingOfLocNameToDescriptor(name, desc);
67   }
68
69   public Set<String> getParameterLocNameSet() {
70     Set<String> paramSet = new HashSet<String>();
71
72     paramSet.add(PCLocName);
73
74     if (thisLocName != null) {
75       paramSet.add(thisLocName);
76     }
77
78     if (returnLocName != null) {
79       paramSet.add(returnLocName);
80     }
81
82     paramSet.addAll(mapParamIdxToLocName.values());
83
84     return paramSet;
85   }
86
87   public void removeMaplocalVarToLocSet(Descriptor localVarDesc) {
88     String localVarLocSymbol = localVarDesc.getSymbol();
89     getDescSet(localVarLocSymbol).remove(localVarDesc);
90   }
91
92 }