Package com.tonic.analysis.graph.print
Class CPGPrinter
- java.lang.Object
-
- com.tonic.analysis.graph.print.CPGPrinter
-
public class CPGPrinter extends Object
A text renderer for a code property graph, emitting nodes grouped by method or by node type with detail controlled by a GraphPrinterConfig.
-
-
Constructor Summary
Constructors Constructor Description CPGPrinter()Creates a printer using the default configuration.CPGPrinter(GraphPrinterConfig config)Creates a printer with the given configuration.
-
Method Summary
All Methods Instance Methods Concrete Methods Modifier and Type Method Description Stringprint(CodePropertyGraph cpg)Renders the graph to a string.voidprint(CodePropertyGraph cpg, Writer output)Renders the graph to a writer and flushes it.
-
-
-
Constructor Detail
-
CPGPrinter
public CPGPrinter()
Creates a printer using the default configuration.
-
CPGPrinter
public CPGPrinter(GraphPrinterConfig config)
Creates a printer with the given configuration.- Parameters:
config- grouping, verbosity and truncation settings
-
-
Method Detail
-
print
public String print(CodePropertyGraph cpg)
Renders the graph to a string.- Parameters:
cpg- the graph to print- Returns:
- the rendered text
-
print
public void print(CodePropertyGraph cpg, Writer output)
Renders the graph to a writer and flushes it.- Parameters:
cpg- the graph to printoutput- destination for the rendered text
-
-