Skip to content
Snippets Groups Projects
Commit e2610b35 authored by Sören Henning's avatar Sören Henning
Browse files

add nodes and edges without attributes

parent 1d93c009
No related branches found
No related tags found
1 merge request!17Get impletemented stages and Java 8
......@@ -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 {
......
0% Loading or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment