Package com.tonic.analysis.graph.export
Class CPGDOTExporter
- java.lang.Object
-
- com.tonic.analysis.graph.export.DOTExporter<CodePropertyGraph>
-
- com.tonic.analysis.graph.export.CPGDOTExporter
-
public class CPGDOTExporter extends DOTExporter<CodePropertyGraph>
Renders a code property graph as Graphviz DOT, with a filter selecting which edge types appear.
-
-
Constructor Summary
Constructors Constructor Description CPGDOTExporter()Creates an exporter with the default configuration and every edge type enabled.CPGDOTExporter(DOTExporterConfig config)Creates an exporter that emits every edge type.
-
Method Summary
All Methods Instance Methods Concrete Methods Modifier and Type Method Description CPGDOTExportercallGraphOnly()Restricts output to call, parameter and return-value edges.CPGDOTExportercfgOnly()Restricts output to control-flow edges plus containment.CPGDOTExporterdataFlowOnly()Restricts output to def, use and reaching-def edges plus containment.voidexport(CodePropertyGraph cpg, Writer output)Writes the DOT rendering of a graph.CPGDOTExporterincludeEdgeTypes(CPGEdgeType... types)Replaces the emitted edge set with exactly the given types.-
Methods inherited from class com.tonic.analysis.graph.export.DOTExporter
export
-
-
-
-
Constructor Detail
-
CPGDOTExporter
public CPGDOTExporter()
Creates an exporter with the default configuration and every edge type enabled.
-
CPGDOTExporter
public CPGDOTExporter(DOTExporterConfig config)
Creates an exporter that emits every edge type.- Parameters:
config- rendering options
-
-
Method Detail
-
includeEdgeTypes
public CPGDOTExporter includeEdgeTypes(CPGEdgeType... types)
Replaces the emitted edge set with exactly the given types.- Parameters:
types- edge types to emit; must not be empty- Returns:
- this exporter
- Throws:
IllegalArgumentException- if no types are given
-
cfgOnly
public CPGDOTExporter cfgOnly()
Restricts output to control-flow edges plus containment.- Returns:
- this exporter
-
dataFlowOnly
public CPGDOTExporter dataFlowOnly()
Restricts output to def, use and reaching-def edges plus containment.- Returns:
- this exporter
-
callGraphOnly
public CPGDOTExporter callGraphOnly()
Restricts output to call, parameter and return-value edges.- Returns:
- this exporter
-
export
public void export(CodePropertyGraph cpg, Writer output)
Description copied from class:DOTExporterWrites the DOT rendering of a graph.- Specified by:
exportin classDOTExporter<CodePropertyGraph>- Parameters:
cpg- the graph to exportoutput- the writer that receives the DOT source
-
-