diff --git a/src/main/java/kieker/analysis/graph/util/dot/DotWriter.java b/src/main/java/kieker/analysis/graph/util/dot/DotWriter.java index 30c35ad1556e1cb816cdf1524b2d90a7e29e01bf..cbc13ca4e750ffc457e8ec327fecb8b52365a104 100644 --- a/src/main/java/kieker/analysis/graph/util/dot/DotWriter.java +++ b/src/main/java/kieker/analysis/graph/util/dot/DotWriter.java @@ -77,10 +77,22 @@ public class DotWriter { writer.writeln(assembleAttribute(key, value)); } + public void addNode(final String id) throws IOException { + addNode(id, null); + } + public void addNode(final String id, final Map<String, String> attributes) throws IOException { checkState(DotWriterState.STARTED); - writer.writeln('"' + id + '"' + ' ' + assembleAttributes(attributes)); + if (attributes == null) { + writer.writeln('"' + id + '"'); + } else { + writer.writeln('"' + id + '"' + ' ' + assembleAttributes(attributes)); + } + } + + public void addEdge(final String sourceId, final String targetId) throws IOException { + addEdge(sourceId, targetId, null); } public void addEdge(final String sourceId, final String targetId, final Map<String, String> attributes) throws IOException { @@ -92,7 +104,12 @@ public class DotWriter { } else { edgeConnector = DotGraph.DIRECTED_EDGE_CONNECTOR; } - writer.writeln('"' + sourceId + '"' + ' ' + edgeConnector + ' ' + '"' + targetId + '"' + ' ' + assembleAttributes(attributes)); + + if (attributes == null) { + writer.writeln('"' + sourceId + '"' + ' ' + edgeConnector + ' ' + '"' + targetId + '"'); + } else { + writer.writeln('"' + sourceId + '"' + ' ' + edgeConnector + ' ' + '"' + targetId + '"' + ' ' + assembleAttributes(attributes)); + } } public void addSubgraphStart(final String name) throws IOException {