MCPcopy Create free account
hub / github.com/LFYSec/MScan / DotDumper

Class DotDumper

src/main/java/pascal/taie/util/graph/DotDumper.java:40–187  ·  view source on GitHub ↗

Configurable dot dumper. @param type of graph nodes

Source from the content-addressed store, hash-verified

38 * @param <N> type of graph nodes
39 */
40public class DotDumper<N> {
41
42 private static final Logger logger = LogManager.getLogger(DotDumper.class);
43
44 private static final String INDENT = " ";
45
46 /**
47 * The output stream for dumping dot graph.
48 */
49 private PrintStream out;
50
51 /**
52 * The function that converts a node to its string representation.
53 */
54 private Function<N, String> nodeToString = Objects::toString;
55
56 /**
57 * Global node attributes.
58 */
59 private DotAttributes globalNodeAttrs = DotAttributes.of();
60
61 /**
62 * The labeler for nodes.
63 */
64 private Function<N, String> nodeLabeler = node -> null;
65
66 /**
67 * The node attributes.
68 */
69 private Function<N, DotAttributes> nodeAttributer = node -> null;
70
71 /**
72 * The labeler for edges.
73 */
74 private Function<Edge<N>, String> edgeLabeler = edge -> null;
75
76 /**
77 * Global edge attributes.
78 */
79 private DotAttributes globalEdgeAttrs = DotAttributes.of();
80
81 /**
82 * The function that maps an edge to its attributes.
83 */
84 private Function<Edge<N>, DotAttributes> edgeAttributer = edge -> null;
85
86 public DotDumper<N> setNodeToString(Function<N, String> nodeToString) {
87 this.nodeToString = nodeToString;
88 return this;
89 }
90
91 public DotDumper<N> setGlobalNodeAttributes(DotAttributes attrs) {
92 globalNodeAttrs = attrs;
93 return this;
94 }
95
96 public DotDumper<N> setNodeLabeler(Function<N, String> nodeLabeler) {
97 this.nodeLabeler = nodeLabeler;

Callers

nothing calls this directly

Calls 1

ofMethod · 0.95

Tested by

no test coverage detected