1 package Analysis.SSJava;
3 import java.util.HashMap;
7 import IR.MethodDescriptor;
9 public class MethodSummary extends LocationSummary {
16 CompositeLocation pcLoc;
17 CompositeLocation returnLoc;
19 Map<Integer, CompositeLocation> mapParamIdxToInferLoc;
20 Map<Descriptor, CompositeLocation> mapVarDescToInferCompositeLocation;
22 boolean hasGlobalAccess;
24 public MethodSummary(MethodDescriptor 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;
34 public Map<Descriptor, CompositeLocation> getMapVarDescToInferCompositeLocation() {
35 return mapVarDescToInferCompositeLocation;
38 public void addMapVarNameToInferCompLoc(Descriptor varDesc, CompositeLocation inferLoc) {
39 mapVarDescToInferCompositeLocation.put(varDesc, inferLoc);
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);
48 // String locName = getLocationName(varName);
49 // return new CompositeLocation(new Location(md, locName));
53 public void addMapParamIdxToInferLoc(int paramIdx, CompositeLocation inferLoc) {
54 mapParamIdxToInferLoc.put(paramIdx, inferLoc);
57 public Map<Integer, CompositeLocation> getMapParamIdxToInferLoc() {
58 return mapParamIdxToInferLoc;
61 public void setPCLoc(CompositeLocation pcLoc) {
65 public CompositeLocation getPCLoc() {
69 public void setRETURNLoc(CompositeLocation returnLoc) {
70 this.returnLoc = returnLoc;
73 public CompositeLocation getRETURNLoc() {
77 public void setThisLocName(String name) {
78 this.thisLocName = name;
81 public String getThisLocName() {
85 public void setGlobalLocName(String name) {
86 this.globalLocName = name;
89 public String getGlobalLocName() {
93 public void setHasGlobalAccess() {
94 this.hasGlobalAccess = true;
97 public boolean hasGlobalAccess() {
98 return hasGlobalAccess;