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

fixed #39

parent 9f0a5f6a
No related branches found
No related tags found
1 merge request!19Trace aggr analysis
package kieker.analysis.util.graph.export.dot;
import java.io.IOException;
import java.util.HashMap;
import java.util.Map;
import java.util.Map.Entry;
import java.util.function.Function;
import java.util.stream.Collectors;
import kieker.analysis.util.graph.Direction;
import kieker.analysis.util.graph.Edge;
......@@ -13,6 +13,8 @@ import kieker.analysis.util.graph.Vertex;
import kieker.analysis.util.graph.export.AbstractTransformer;
import kieker.analysis.util.graph.util.dot.DotGraphWriter;
import kieker.analysis.util.graph.util.dot.attributes.DotClusterAttribute;
import kieker.analysis.util.graph.util.dot.attributes.DotEdgeAttribute;
import kieker.analysis.util.graph.util.dot.attributes.DotNodeAttribute;
class DotElementExporter extends AbstractTransformer<Void> {
......@@ -42,7 +44,7 @@ class DotElementExporter extends AbstractTransformer<Void> {
dotGraphWriter.addClusterStop();
} else {
// dotGraphWriter.addNode(vertex.getId().toString(), getAttributes(vertex));
dotGraphWriter.addNode(vertex.getId().toString(), getAttributes(vertex));
}
} catch (IOException e) {
handleIOException(e);
......@@ -67,19 +69,25 @@ class DotElementExporter extends AbstractTransformer<Void> {
}
protected Map<String, String> getAttributes(final Edge edge) {
// System.out.println("Hi!" + configuration.getEdgeAttributes().entrySet().stream().collect(Collectors.toMap(
// e -> e.getKey().toString(),
// e -> null)));
// return null; // TODO temp
return configuration.getEdgeAttributes().entrySet().stream().collect(Collectors.toMap(
e -> e.getKey().toString(),
e -> e.getValue().apply(edge)));
final Map<String, String> attributes = new HashMap<>();
for (Entry<DotEdgeAttribute, Function<Edge, String>> entry : configuration.getEdgeAttributes().entrySet()) {
final String value = entry.getValue().apply(edge);
if (value != null) {
attributes.put(entry.getKey().toString(), value);
}
}
return attributes;
}
protected Map<String, String> getAttributes(final Vertex vertex) {
return configuration.getNodeAttributes().entrySet().stream().collect(Collectors.toMap(
e -> e.getKey().toString(),
e -> e.getValue().apply(vertex)));
final Map<String, String> attributes = new HashMap<>();
for (Entry<DotNodeAttribute, Function<Vertex, String>> entry : configuration.getNodeAttributes().entrySet()) {
final String value = entry.getValue().apply(vertex);
if (value != null) {
attributes.put(entry.getKey().toString(), value);
}
}
return attributes;
}
@Override
......
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