changes.
[IRC.git] / Robust / src / Analysis / SSJava / MethodLocationInfo.java
index 5a150affbd7fe34b0b615ee6973385a200cb5a3e..7435c187cd6c19d1433c9528b02daafc45513c8b 100644 (file)
@@ -10,30 +10,53 @@ import IR.MethodDescriptor;
 
 public class MethodLocationInfo extends LocationInfo {
 
-  MethodDescriptor md;
-
   String returnLocName;
   String thisLocName;
-  String PCLocName;
+  CompositeLocation pcLoc;
+  CompositeLocation returnLoc;
+
+  public CompositeLocation getReturnLoc() {
+    return returnLoc;
+  }
+
+  public void setReturnLoc(CompositeLocation returnLoc) {
+    this.returnLoc = returnLoc;
+  }
 
-  Map<Integer, String> mapParamIdxToLocName;
+  String globalLocName;
+
+  Map<Integer, CompositeLocation> mapParamIdxToInferLoc;
   Set<String> paramLocNameSet;
-  Map<FlowNode, CompositeLocation> mapFlowNodeToLocation;
 
   public MethodLocationInfo(MethodDescriptor md) {
     this.md = md;
-    this.mapParamIdxToLocName = new HashMap<Integer, String>();
     this.paramLocNameSet = new HashSet<String>();
-    this.PCLocName = SSJavaAnalysis.TOP;
-    this.mapFlowNodeToLocation = new HashMap<FlowNode, CompositeLocation>();
+    this.pcLoc = new CompositeLocation(new Location(md, Location.TOP));
+    this.mapParamIdxToInferLoc = new HashMap<Integer, CompositeLocation>();
+  }
+
+  public void addMapParamIdxToInferLoc(int paramIdx, CompositeLocation inferLoc) {
+    mapParamIdxToInferLoc.put(paramIdx, inferLoc);
+  }
+
+  public int getNumParam() {
+    return mapParamIdxToInferLoc.keySet().size();
   }
 
-  public void mapFlowNodeToInferLocation(FlowNode node, CompositeLocation location) {
-    mapFlowNodeToLocation.put(node, location);
+  public CompositeLocation getParamCompositeLocation(int idx) {
+    return mapParamIdxToInferLoc.get(idx);
   }
 
-  public CompositeLocation getInferLocation(FlowNode node) {
-    return mapFlowNodeToLocation.get(node);
+  public Map<Integer, CompositeLocation> getMapParamIdxToInferLoc() {
+    return mapParamIdxToInferLoc;
+  }
+
+  public String getGlobalLocName() {
+    return globalLocName;
+  }
+
+  public void setGlobalLocName(String globalLocName) {
+    this.globalLocName = globalLocName;
   }
 
   public String getReturnLocName() {
@@ -52,35 +75,21 @@ public class MethodLocationInfo extends LocationInfo {
     this.thisLocName = thisLocName;
   }
 
-  public String getPCLocName() {
-    return PCLocName;
+  public CompositeLocation getPCLoc() {
+    return pcLoc;
   }
 
-  public void setPCLocName(String pCLocName) {
-    PCLocName = pCLocName;
+  public void setPCLoc(CompositeLocation pcLoc) {
+    this.pcLoc = pcLoc;
   }
 
-  public void addParameter(String name, Descriptor desc, int idx) {
-    mapParamIdxToLocName.put(new Integer(idx), name);
-    addMappingOfLocNameToDescriptor(name, desc);
+  public void removeMaplocalVarToLocSet(Descriptor localVarDesc) {
+    String localVarLocSymbol = localVarDesc.getSymbol();
+    getDescSet(localVarLocSymbol).remove(localVarDesc);
   }
 
-  public Set<String> getParameterLocNameSet() {
-    Set<String> paramSet = new HashSet<String>();
-
-    paramSet.add(PCLocName);
-
-    if (thisLocName != null) {
-      paramSet.add(thisLocName);
-    }
-
-    if (returnLocName != null) {
-      paramSet.add(returnLocName);
-    }
-
-    paramSet.addAll(mapParamIdxToLocName.values());
-
-    return paramSet;
+  public MethodDescriptor getMethodDesc() {
+    return md;
   }
 
 }