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

added a default export configuration

parent 14ba03d9
No related branches found
No related tags found
1 merge request!17Get impletemented stages and Java 8
Pipeline #
...@@ -16,7 +16,7 @@ import kieker.analysis.util.graph.util.dot.attributes.DotNodeAttribute; ...@@ -16,7 +16,7 @@ import kieker.analysis.util.graph.util.dot.attributes.DotNodeAttribute;
public class DotExporter extends DotElementExporter { public class DotExporter extends DotElementExporter {
public DotExporter(final Graph graph, final Writer writer) { public DotExporter(final Graph graph, final Writer writer) {
this(graph, writer, new DotExportConfiguration()); this(graph, writer, new SimpleDotExportConfiguration());
} }
public DotExporter(final Graph graph, final Writer writer, final DotExportConfiguration configuration) { public DotExporter(final Graph graph, final Writer writer, final DotExportConfiguration configuration) {
......
package kieker.analysis.util.graph.export.dot;
import kieker.analysis.util.graph.Edge;
import kieker.analysis.util.graph.Vertex;
import kieker.analysis.util.graph.mapping.DirectPropertyMapper;
import kieker.analysis.util.graph.util.dot.attributes.DotEdgeAttribute;
import kieker.analysis.util.graph.util.dot.attributes.DotNodeAttribute;
public class SimpleDotExportConfiguration extends DotExportConfiguration {
public SimpleDotExportConfiguration() {
super();
this.getNodeAttributes().put(DotNodeAttribute.LABEL, new DirectPropertyMapper<Vertex>("label"));
this.getEdgeAttributes().put(DotEdgeAttribute.LABEL, new DirectPropertyMapper<Edge>("label"));
}
}
package kieker.analysis.util.graph.mapping;
import java.util.function.Function;
import kieker.analysis.util.graph.Element;
/**
* This function maps a graph element by a passed property key to the
* corresponding property value and returns it as string.
*
* @author Sören Henning
*
*/
public class DirectPropertyMapper<T extends Element> implements Function<T, String> {
private String propertyKey;
public DirectPropertyMapper(final String propertyKey) {
this.propertyKey = propertyKey;
}
public String getPropertyKey() {
return propertyKey;
}
public void setPropertyKey(final String propertyKey) {
this.propertyKey = propertyKey;
}
@Override
public String apply(final T element) {
return element.getProperty(propertyKey);
}
}
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