From e2610b35059c52fd83d8e2de81fa2180144e7068 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?S=C3=B6ren=20Henning?= <stu114708@informatik.uni-kiel.de> Date: Thu, 31 Mar 2016 16:42:48 +0200 Subject: [PATCH] add nodes and edges without attributes --- .../analysis/graph/util/dot/DotWriter.java | 21 +++++++++++++++++-- 1 file changed, 19 insertions(+), 2 deletions(-) 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 30c35ad1..cbc13ca4 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 { -- GitLab