a bunch of fixes.
[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.MethodDescriptor;
9
10 public class MethodLocationInfo {
11
12   String returnLocName;
13   String thisLocName;
14   String PCLocName;
15   Map<Integer, String> mapParamIdxToLocName;
16   Map<String, FlowNode> mapLocNameToFlowNode;
17   MethodDescriptor md;
18
19   public MethodLocationInfo(MethodDescriptor md) {
20     this.md = md;
21     this.mapParamIdxToLocName = new HashMap<Integer, String>();
22     this.mapLocNameToFlowNode = new HashMap<String, FlowNode>();
23     this.PCLocName = SSJavaAnalysis.TOP;
24   }
25
26   public String getReturnLocName() {
27     return returnLocName;
28   }
29
30   public void setReturnLocName(String returnLocName) {
31     this.returnLocName = returnLocName;
32   }
33
34   public String getThisLocName() {
35     return thisLocName;
36   }
37
38   public void setThisLocName(String thisLocName) {
39     this.thisLocName = thisLocName;
40   }
41
42   public String getPCLocName() {
43     return PCLocName;
44   }
45
46   public void setPCLocName(String pCLocName) {
47     PCLocName = pCLocName;
48   }
49
50   public void addParameter(String name, FlowNode node, int idx) {
51     mapParamIdxToLocName.put(new Integer(idx), name);
52     mapLocNameToFlowNode.put(name, node);
53   }
54
55   public Set<String> getParameterLocNameSet() {
56     Set<String> paramSet = new HashSet<String>();
57
58     paramSet.add(PCLocName);
59
60     if (thisLocName != null) {
61       paramSet.add(thisLocName);
62     }
63
64     if (returnLocName != null) {
65       paramSet.add(returnLocName);
66     }
67
68     paramSet.addAll(mapLocNameToFlowNode.keySet());
69
70     return paramSet;
71   }
72
73 }