V - the abstract value type to be tracked by the analysisS - the store type used in the analysisT - the transfer function type that is used to approximate runtime behaviorpublic abstract class AbstractCFGVisualizer<V extends AbstractValue<V>,S extends Store<S>,T extends TransferFunction<V,S>> extends Object implements CFGVisualizer<V,S,T>
CFGVisualizer easier. Some of the methods in
 CFGVisualizer are already implemented in this abstract class, but can be overridden if
 necessary.DOTCFGVisualizer, 
StringCFGVisualizer| Modifier and Type | Field and Description | 
|---|---|
protected String | 
lineSeparator
The line separator. 
 | 
protected String | 
storeEntryIndent
The indentation for elements of the store. 
 | 
protected boolean | 
verbose
Initialized in  
init(Map). | 
| Constructor and Description | 
|---|
AbstractCFGVisualizer()  | 
| Modifier and Type | Method and Description | 
|---|---|
protected void | 
addBlock(Block b,
        Set<Block> visited,
        Queue<Block> workList)
Checks whether a block exists in the visited blocks list, and, if not, adds it to the visited
 blocks list and the work list. 
 | 
protected List<Node> | 
addBlockContent(Block bb)
Returns the contents of the block. 
 | 
protected abstract String | 
addEdge(long sId,
       long eId,
       String flowRule)
Generate the String representation of an edge. 
 | 
protected abstract String | 
format(Object obj)
Format the given object as a String suitable for the output format, i.e. 
 | 
protected @Nullable Node | 
getLastNode(Block bb)
Returns the last node of a block, or null if none. 
 | 
protected String | 
getNodeSimpleName(Node t)
Get the simple name of a node. 
 | 
protected IdentityHashMap<Block,List<Integer>> | 
getProcessOrder(ControlFlowGraph cfg)
Generate the order of processing blocks. 
 | 
protected String | 
getProcessOrderSimpleString(List<Integer> order)
Return the simple String of the process order of a node, e.g., "Process order: 23". 
 | 
protected void | 
handleSuccessorsHelper(Block cur,
                      Set<Block> visited,
                      Queue<Block> workList,
                      StringBuilder sbGraph)
Adds the successors of the current block to the work list and the visited blocks list. 
 | 
void | 
init(Map<String,Object> args)
Initialization method guaranteed to be called once before the first invocation of  
CFGVisualizer.visualize(org.checkerframework.dataflow.cfg.ControlFlowGraph, org.checkerframework.dataflow.cfg.block.Block, org.checkerframework.dataflow.analysis.Analysis<V, S, T>). | 
protected String | 
loopOverBlockContents(Block bb,
                     @Nullable Analysis<V,S,T> analysis,
                     String separator)
Iterates over the block content and visualizes all the nodes in it. 
 | 
protected String | 
visualizeBlockHelper(Block bb,
                    @Nullable Analysis<V,S,T> analysis,
                    String escapeString)
Helper method to visualize a block. 
 | 
String | 
visualizeBlockNode(Node t,
                  @Nullable Analysis<V,S,T> analysis)
Visualize a Node based on the analysis. 
 | 
protected String | 
visualizeBlockTransferInputAfterHelper(Block bb,
                                      Analysis<V,S,T> analysis,
                                      String escapeString)
Visualize the transfer input after the given block. 
 | 
protected String | 
visualizeBlockTransferInputBeforeHelper(Block bb,
                                       Analysis<V,S,T> analysis,
                                       String escapeString)
Visualize the transfer input before the given block. 
 | 
protected String | 
visualizeGraph(ControlFlowGraph cfg,
              Block entry,
              @Nullable Analysis<V,S,T> analysis)
Visualize a control flow graph. 
 | 
protected abstract String | 
visualizeGraphFooter()
Return the footer of the generated graph. 
 | 
protected abstract String | 
visualizeGraphHeader()
Return the header of the generated graph. 
 | 
protected String | 
visualizeGraphWithoutHeaderAndFooter(ControlFlowGraph cfg,
                                    Block entry,
                                    @Nullable Analysis<V,S,T> analysis)
Helper method to visualize a control flow graph, without outputting a header or footer. 
 | 
protected abstract String | 
visualizeNodes(Set<Block> blocks,
              ControlFlowGraph cfg,
              @Nullable Analysis<V,S,T> analysis)
Generate the String representation of the nodes of a control flow graph. 
 | 
protected String | 
visualizeSpecialBlockHelper(SpecialBlock sbb,
                           String separator)
Visualize a special block. 
 | 
String | 
visualizeStore(S store)
Delegate the visualization responsibility to the passed  
Store instance, which will
 call back to this visualizer instance for sub-components. | 
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, waitshutdown, visualize, visualizeBlock, visualizeBlockTransferInputAfter, visualizeBlockTransferInputBefore, visualizeConditionalBlock, visualizeSpecialBlock, visualizeStoreArrayVal, visualizeStoreClassVals, visualizeStoreFieldVals, visualizeStoreFooter, visualizeStoreHeader, visualizeStoreKeyVal, visualizeStoreLocalVar, visualizeStoreMethodVals, visualizeStoreThisValprotected boolean verbose
protected final String lineSeparator
protected final String storeEntryIndent
public void init(Map<String,Object> args)
CFGVisualizerCFGVisualizer.visualize(org.checkerframework.dataflow.cfg.ControlFlowGraph, org.checkerframework.dataflow.cfg.block.Block, org.checkerframework.dataflow.analysis.Analysis<V, S, T>).init in interface CFGVisualizer<V extends AbstractValue<V>,S extends Store<S>,T extends TransferFunction<V,S>>args - implementation-dependent optionsprotected String visualizeGraph(ControlFlowGraph cfg, Block entry, @Nullable Analysis<V,S,T> analysis)
cfg - the current control flow graphentry - the entry block of the control flow graphanalysis - the current analysisprotected String visualizeGraphWithoutHeaderAndFooter(ControlFlowGraph cfg, Block entry, @Nullable Analysis<V,S,T> analysis)
cfg - the control flow graphentry - the entry block of the control flow graphanalysis - the current analysisprotected void handleSuccessorsHelper(Block cur, Set<Block> visited, Queue<Block> workList, StringBuilder sbGraph)
cur - the current blockvisited - the set of blocks that have already been visited or are in the work listworkList - the queue of blocks to be processedsbGraph - the StringBuilder to store the graphprotected void addBlock(Block b, Set<Block> visited, Queue<Block> workList)
b - the block to checkvisited - the set of blocks that have already been visited or are in the work listworkList - the queue of blocks to be processedprotected String visualizeBlockHelper(Block bb, @Nullable Analysis<V,S,T> analysis, String escapeString)
bb - the blockanalysis - the current analysisescapeString - the escape String for the special need of visualization, e.g., "\\l" for
     DOTCFGVisualizer to keep line left-justification, "\n" for StringCFGVisualizer to simply add a new lineprotected String loopOverBlockContents(Block bb, @Nullable Analysis<V,S,T> analysis, String separator)
bb - the blockanalysis - the current analysisseparator - the separator between the nodes of the blockprotected List<Node> addBlockContent(Block bb)
bb - the blockprotected abstract String format(Object obj)
obj - an objectpublic String visualizeBlockNode(Node t, @Nullable Analysis<V,S,T> analysis)
CFGVisualizervisualizeBlockNode in interface CFGVisualizer<V extends AbstractValue<V>,S extends Store<S>,T extends TransferFunction<V,S>>t - the nodeanalysis - the current analysisprotected String visualizeBlockTransferInputBeforeHelper(Block bb, Analysis<V,S,T> analysis, String escapeString)
bb - the blockanalysis - the current analysisescapeString - the escape String for the special need of visualization, e.g., "\\l" for
     DOTCFGVisualizer to keep line left-justification, "\n" for StringCFGVisualizer to simply add a new lineprotected String visualizeBlockTransferInputAfterHelper(Block bb, Analysis<V,S,T> analysis, String escapeString)
bb - the given blockanalysis - the current analysisescapeString - the escape String for the special need of visualization, e.g., "\\l" for
     DOTCFGVisualizer to keep line left-justification, "\n" for StringCFGVisualizer to simply add a new lineprotected String visualizeSpecialBlockHelper(SpecialBlock sbb, String separator)
sbb - the special blockseparator - the separator String to put at the end of the resultprotected @Nullable Node getLastNode(Block bb)
bb - the blocknullprotected IdentityHashMap<Block,List<Integer>> getProcessOrder(ControlFlowGraph cfg)
ControlFlowGraph.getDepthFirstOrderedBlocks(), the orders of each block are stored in a
 separate array list.cfg - the current control flow graphpublic String visualizeStore(S store)
CFGVisualizerStore instance, which will
 call back to this visualizer instance for sub-components.visualizeStore in interface CFGVisualizer<V extends AbstractValue<V>,S extends Store<S>,T extends TransferFunction<V,S>>store - the store to visualizeprotected abstract String visualizeNodes(Set<Block> blocks, ControlFlowGraph cfg, @Nullable Analysis<V,S,T> analysis)
blocks - the set of all the blocks in a control flow graphcfg - the control flow graphanalysis - the current analysisprotected abstract String addEdge(long sId, long eId, String flowRule)
sId - the ID of current blockeId - the ID of successor blockflowRule - the content of the edgeprotected abstract String visualizeGraphHeader()
protected abstract String visualizeGraphFooter()
protected String getProcessOrderSimpleString(List<Integer> order)
order - the list of the process order to be processed