Class AbstractCFGVisualizer<V extends AbstractValue<V>,S extends Store<S>,T extends TransferFunction<V,S>>   
java.lang.Object
org.checkerframework.dataflow.cfg.visualize.AbstractCFGVisualizer<V,S,T>  
- Type Parameters:
- V- the abstract value type to be tracked by the analysis
- S- the store type used in the analysis
- T- the transfer function type that is used to approximate runtime behavior
- All Implemented Interfaces:
- CFGVisualizer<V,- S, - T> 
- Direct Known Subclasses:
- DOTCFGVisualizer,- StringCFGVisualizer
public abstract class AbstractCFGVisualizer<V extends AbstractValue<V>,S extends Store<S>,T extends TransferFunction<V,S>>   
extends Object
implements CFGVisualizer<V,S,T>  
This abstract class makes implementing a 
CFGVisualizer easier. Some of the methods in
 CFGVisualizer are already implemented in this abstract class, but can be overridden if
 necessary.- See Also:
- 
Nested Class SummaryNested ClassesModifier and TypeClassDescriptionprotected static enumWhether to visualize before or after a block.
- 
Field SummaryFieldsModifier and TypeFieldDescriptionprotected static final StringThe line separator.protected static final StringThe indentation for elements of the store.protected booleanIftrue,CFGVisualizerreturns more detailed information.
- 
Constructor SummaryConstructors
- 
Method SummaryModifier and TypeMethodDescriptionprotected voidChecks whether a block exists in the visited blocks list, and, if not, adds it to the visited blocks list and the work list.addBlockContent(Block bb) Returns the contents of the block.protected abstract StringFormat the given object as a String suitable for the output format, i.e.protected StringGet the simple name of a node.protected IdentityHashMap<Block,List<Integer>> Generate the order of processing blocks.protected StringgetProcessOrderSimpleString(List<Integer> order) Given a list of process orders (integers), returns a string representation.protected voidhandleSuccessorsHelper(Block cur, Set<Block> visited, Queue<Block> workList, StringBuilder sbGraph) Outputs, to sbGraph, a visualization of a block's edges, but not the block itself.voidInitialization method guaranteed to be called once before the first invocation ofCFGVisualizer.visualize(org.checkerframework.dataflow.cfg.ControlFlowGraph, org.checkerframework.dataflow.cfg.block.Block, org.checkerframework.dataflow.analysis.Analysis<V, S, T>)orCFGVisualizer.visualizeWithAction(org.checkerframework.dataflow.cfg.ControlFlowGraph, org.checkerframework.dataflow.cfg.block.Block, org.checkerframework.dataflow.analysis.Analysis<V, S, T>).protected StringIterates over the block content and visualizes all the nodes in it.protected StringHelper method to visualize a block.Visualize a Node based on the analysis.protected StringvisualizeBlockTransferInputHelper(AbstractCFGVisualizer.VisualizeWhere where, Block bb, Analysis<V, S, T> analysis, String separator) Visualize the transfer input before or after the given block.protected abstract StringvisualizeEdge(Object sId, Object eId, String flowRule) Generate the String representation of an edge.protected StringvisualizeGraph(ControlFlowGraph cfg, Block entry, @Nullable Analysis<V, S, T> analysis) Visualize a control flow graph.protected abstract StringReturn the footer of the generated graph.protected abstract StringReturn the header of the generated graph.protected StringvisualizeGraphWithoutHeaderAndFooter(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 StringvisualizeNodes(Set<Block> blocks, ControlFlowGraph cfg, @Nullable Analysis<V, S, T> analysis) Generate the String representation of the nodes of a control flow graph.protected StringVisualize a special block.visualizeStore(S store) Delegate the visualization responsibility to the passedStoreinstance, which will call back to this visualizer instance for sub-components.Methods inherited from class java.lang.Objectclone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, waitMethods inherited from interface org.checkerframework.dataflow.cfg.visualize.CFGVisualizergetSeparator, shutdown, visualize, visualizeBlock, visualizeBlockTransferInputAfter, visualizeBlockTransferInputBefore, visualizeConditionalBlock, visualizeSpecialBlock, visualizeStoreArrayVal, visualizeStoreClassVals, visualizeStoreFieldVal, visualizeStoreKeyVal, visualizeStoreLocalVar, visualizeStoreMethodVals, visualizeStoreThisVal, visualizeWithAction
- 
Field Details- 
verboseprotected boolean verbose
- 
lineSeparatorThe line separator.
- 
storeEntryIndentThe indentation for elements of the store.- See Also:
 
 
- 
- 
Constructor Details- 
AbstractCFGVisualizerpublic AbstractCFGVisualizer()
 
- 
- 
Method Details- 
initDescription copied from interface:CFGVisualizerInitialization method guaranteed to be called once before the first invocation ofCFGVisualizer.visualize(org.checkerframework.dataflow.cfg.ControlFlowGraph, org.checkerframework.dataflow.cfg.block.Block, org.checkerframework.dataflow.analysis.Analysis<V, S, T>)orCFGVisualizer.visualizeWithAction(org.checkerframework.dataflow.cfg.ControlFlowGraph, org.checkerframework.dataflow.cfg.block.Block, org.checkerframework.dataflow.analysis.Analysis<V, S, T>).- Specified by:
- initin interface- CFGVisualizer<V extends AbstractValue<V>,- S extends Store<S>, - T extends TransferFunction<V, - S>> 
- Parameters:
- args- implementation-dependent options
 
- 
visualizeGraphprotected String visualizeGraph(ControlFlowGraph cfg, Block entry, @Nullable Analysis<V, S, T> analysis) Visualize a control flow graph.- Parameters:
- cfg- the current control flow graph
- entry- the entry block of the control flow graph
- analysis- the current analysis
- Returns:
- the representation of the control flow graph
 
- 
handleSuccessorsHelperprotected void handleSuccessorsHelper(Block cur, Set<Block> visited, Queue<Block> workList, StringBuilder sbGraph) Outputs, to sbGraph, a visualization of a block's edges, but not the block itself. (The block itself is output elsewhere.) Also adds the successors of the block to the work list and the visited blocks list.- Parameters:
- cur- the current block
- visited- the set of blocks that have already been visited or are in the work list; side effected by this method
- workList- the queue of blocks to be processed; side effected by this method
- sbGraph- the- StringBuilderto store the graph; side effected by this method
 
- 
addBlockChecks whether a block exists in the visited blocks list, and, if not, adds it to the visited blocks list and the work list.- Parameters:
- b- the block to check
- visited- the set of blocks that have already been visited or are in the work list
- workList- the queue of blocks to be processed
 
- 
visualizeBlockHelperprotected String visualizeBlockHelper(Block bb, @Nullable Analysis<V, S, T> analysis, String separator) Helper method to visualize a block.NOTE: The output ends with a separator, only if an "after" store is visualized. The client CFGVisualizer.visualizeBlock(org.checkerframework.dataflow.cfg.block.Block, org.checkerframework.dataflow.analysis.Analysis<V, S, T>)should correct this if needed.- Parameters:
- bb- the block
- analysis- the current analysis
- separator- the line separator. Examples: "\\l" for left justification in- DOTCFGVisualizer(this is really a terminator, not a separator), "\n" to add a new line in- StringCFGVisualizer
- Returns:
- the String representation of the block
 
- 
loopOverBlockContentsprotected String loopOverBlockContents(Block bb, @Nullable Analysis<V, S, T> analysis, String separator) Iterates over the block content and visualizes all the nodes in it.- Parameters:
- bb- the block
- analysis- the current analysis
- separator- the separator between the nodes of the block
- Returns:
- the String representation of the contents of the block
 
- 
addBlockContentReturns the contents of the block.- Parameters:
- bb- the block
- Returns:
- the contents of the block, as a list of nodes
 
- 
formatFormat the given object as a String suitable for the output format, i.e. with format-specific characters escaped.- Parameters:
- obj- an object
- Returns:
- the formatted String from the given object
 
- 
visualizeBlockNodeDescription copied from interface:CFGVisualizerVisualize a Node based on the analysis.- Specified by:
- visualizeBlockNodein interface- CFGVisualizer<V extends AbstractValue<V>,- S extends Store<S>, - T extends TransferFunction<V, - S>> 
- Parameters:
- t- the node
- analysis- the current analysis
- Returns:
- the String representation of the given node
 
- 
visualizeBlockTransferInputHelperprotected String visualizeBlockTransferInputHelper(AbstractCFGVisualizer.VisualizeWhere where, Block bb, Analysis<V, S, T> analysis, String separator) Visualize the transfer input before or after the given block.- Parameters:
- where- either BEFORE or AFTER
- bb- a block
- analysis- the current analysis
- separator- the line separator. Examples: "\\l" for left justification in- DOTCFGVisualizer(which is actually a line TERMINATOR, not a separator!), "\n" to add a new line in- StringCFGVisualizer
- Returns:
- the visualization of the transfer input before or after the given block
 
- 
visualizeSpecialBlockHelperVisualize a special block.- Parameters:
- sbb- the special block
- Returns:
- the String representation of the special block
 
- 
getProcessOrderGenerate the order of processing blocks. Because a block may appear more than once inControlFlowGraph.getDepthFirstOrderedBlocks(), the orders of each block are stored in a separate array list.- Parameters:
- cfg- the current control flow graph
- Returns:
- an IdentityHashMap that maps from blocks to their orders
 
- 
visualizeStoreDescription copied from interface:CFGVisualizerDelegate the visualization responsibility to the passedStoreinstance, which will call back to this visualizer instance for sub-components.- Specified by:
- visualizeStorein interface- CFGVisualizer<V extends AbstractValue<V>,- S extends Store<S>, - T extends TransferFunction<V, - S>> 
- Parameters:
- store- the store to visualize
- Returns:
- the String representation of the given store
 
- 
visualizeNodesprotected 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.- Parameters:
- blocks- the set of all the blocks in a control flow graph
- cfg- the control flow graph
- analysis- the current analysis
- Returns:
- the String representation of the nodes
 
- 
visualizeEdgeGenerate the String representation of an edge.- Parameters:
- sId- a representation of the current block, such as its ID
- eId- a representation of the successor block, such as its ID
- flowRule- the content of the edge
- Returns:
- the String representation of the edge
 
- 
visualizeGraphHeaderReturn the header of the generated graph.- Returns:
- the String representation of the header of the control flow graph
 
- 
getProcessOrderSimpleStringGiven a list of process orders (integers), returns a string representation.Examples: "Process order: 23", "Process order: 23,25". - Parameters:
- order- a list of process orders
- Returns:
- a String representation of the given process orders
 
- 
getNodeSimpleNameGet the simple name of a node.- Parameters:
- t- a node
- Returns:
- the node's simple name, without "Node"
 
 
-