changes.
[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
17   Map<Integer, String> mapParamIdxToLocName;
18   Set<String> paramLocNameSet;
19
20   public MethodLocationInfo(MethodDescriptor md) {
21     this.md = md;
22     this.mapParamIdxToLocName = new HashMap<Integer, String>();
23     this.paramLocNameSet = new HashSet<String>();
24     this.PCLocName = SSJavaAnalysis.TOP;
25   }
26
27   /*
28    * public void mapFlowNodeToInferLocation(FlowNode node, CompositeLocation
29    * location) { mapFlowNodeToLocation.put(node, location); }
30    * 
31    * public CompositeLocation getInferLocation(FlowNode node) { return
32    * mapFlowNodeToLocation.get(node); }
33    */
34   public String getReturnLocName() {
35     return returnLocName;
36   }
37
38   public void setReturnLocName(String returnLocName) {
39     this.returnLocName = returnLocName;
40   }
41
42   public String getThisLocName() {
43     return thisLocName;
44   }
45
46   public void setThisLocName(String thisLocName) {
47     this.thisLocName = thisLocName;
48   }
49
50   public String getPCLocName() {
51     return PCLocName;
52   }
53
54   public void setPCLocName(String pCLocName) {
55     PCLocName = pCLocName;
56   }
57
58   public void addParameter(String name, Descriptor desc, int idx) {
59     mapParamIdxToLocName.put(new Integer(idx), name);
60     // addMappingOfLocNameToDescriptor(name, desc);
61   }
62
63   public Set<String> getParameterLocNameSet() {
64     Set<String> paramSet = new HashSet<String>();
65
66     paramSet.add(PCLocName);
67
68     if (thisLocName != null) {
69       paramSet.add(thisLocName);
70     }
71
72     if (returnLocName != null) {
73       paramSet.add(returnLocName);
74     }
75
76     paramSet.addAll(mapParamIdxToLocName.values());
77
78     return paramSet;
79   }
80
81   public void removeMaplocalVarToLocSet(Descriptor localVarDesc) {
82     String localVarLocSymbol = localVarDesc.getSymbol();
83     getDescSet(localVarLocSymbol).remove(localVarDesc);
84   }
85
86 }