X-Git-Url: http://demsky.eecs.uci.edu/git/?a=blobdiff_plain;f=Robust%2Fsrc%2FAnalysis%2FSSJava%2FFlowGraph.java;h=ce0021cadcfa6c7ea3f79e5b9583cc604b8cedff;hb=031636263ce6e4b6f35f3d9162460eb0ef536c2a;hp=fb051631db47bd80b07f5f845d38adf2d444bebd;hpb=f0aec2e998d39bd8474da2e98da70bbf7a4f5b15;p=IRC.git diff --git a/Robust/src/Analysis/SSJava/FlowGraph.java b/Robust/src/Analysis/SSJava/FlowGraph.java index fb051631..ce0021ca 100644 --- a/Robust/src/Analysis/SSJava/FlowGraph.java +++ b/Robust/src/Analysis/SSJava/FlowGraph.java @@ -23,6 +23,7 @@ public class FlowGraph { MethodDescriptor md; Set nodeSet; + Set returnNodeSet; FlowNode thisVarNode; // maps the composite representation of field/var descriptors to infer nodes @@ -37,11 +38,12 @@ public class FlowGraph { public FlowGraph(MethodDescriptor md, Map mapParamDescToIdx) { this.md = md; - nodeSet = new HashSet(); - mapDescTupleToInferNode = new HashMap, FlowNode>(); - mapNodeToNeighborSet = new HashMap, Set>(); + this.nodeSet = new HashSet(); + this.mapDescTupleToInferNode = new HashMap, FlowNode>(); + this.mapNodeToNeighborSet = new HashMap, Set>(); this.mapParamDescToIdx = new HashMap(); this.mapParamDescToIdx.putAll(mapParamDescToIdx); + this.returnNodeSet = new HashSet(); // create a node for 'this' varialbe NTuple thisDescTuple = new NTuple(); @@ -168,6 +170,22 @@ public class FlowGraph { } + public void setReturnFlowNode(NTuple tuple) { + + if (!mapDescTupleToInferNode.containsKey(tuple)) { + createNewFlowNode(tuple); + } + + FlowNode node = mapDescTupleToInferNode.get(tuple); + node.setReturn(true); + + returnNodeSet.add(node); + } + + public Set getReturnNodeSet() { + return returnNodeSet; + } + public boolean isParamter(NTuple tuple) { // return true if a descriptor tuple is started with a parameter descriptor Descriptor firstIdxDesc = tuple.get(0); @@ -220,7 +238,7 @@ public class FlowGraph { public void writeGraph() throws java.io.IOException { - String graphName = md.toString(); + String graphName = "flowgraph_" + md.toString(); graphName = graphName.replaceAll("[\\W]", ""); BufferedWriter bw = new BufferedWriter(new FileWriter(graphName + ".dot"));