From 57e847e43a22c0a140171d3aed52e3b06f2ee25a Mon Sep 17 00:00:00 2001
From: =?UTF-8?q?S=C3=B6ren=20Henning?= <stu114708@informatik.uni-kiel.de>
Date: Thu, 7 Apr 2016 13:03:55 +0200
Subject: [PATCH] code clean up

---
 .../java/kieker/analysis/TraceAnalysis.java   |  18 --
 .../analysis/TraceAnalysisConfiguration.java  |   8 -
 .../analysis/dev/nestedgraph/NestedGraph.java | 172 ------------------
 .../dev/nestedgraph/NestedGraphPartition.java |  47 -----
 .../analysis/dev/nestedgraph/SubGraph.java    | 102 -----------
 .../nestedgraphstages/NestedGraphFactory.java |  43 -----
 .../NestedGraphPrinterStage.java              |  43 -----
 .../trace/graphoutput/DotGraphWriter.java     |  10 +-
 .../trace/graphoutput/GraphMLWriter.java      |  10 +-
 .../java/kieker/analysis/util/DotBuilder.java |   7 +-
 .../NamedGraph.java                           |   2 +-
 11 files changed, 22 insertions(+), 440 deletions(-)
 delete mode 100644 src/main/java/kieker/analysis/dev/nestedgraph/NestedGraph.java
 delete mode 100644 src/main/java/kieker/analysis/dev/nestedgraph/NestedGraphPartition.java
 delete mode 100644 src/main/java/kieker/analysis/dev/nestedgraph/SubGraph.java
 delete mode 100644 src/main/java/kieker/analysis/dev/nestedgraphstages/NestedGraphFactory.java
 delete mode 100644 src/main/java/kieker/analysis/dev/nestedgraphstages/NestedGraphPrinterStage.java
 rename src/main/java/kieker/analysis/util/{graph => blueprintsgraph}/NamedGraph.java (93%)

diff --git a/src/main/java/kieker/analysis/TraceAnalysis.java b/src/main/java/kieker/analysis/TraceAnalysis.java
index c0f18e61..e92079d2 100644
--- a/src/main/java/kieker/analysis/TraceAnalysis.java
+++ b/src/main/java/kieker/analysis/TraceAnalysis.java
@@ -5,11 +5,6 @@ package kieker.analysis;
 
 import java.io.File;
 
-import com.tinkerpop.blueprints.Edge;
-import com.tinkerpop.blueprints.Graph;
-import com.tinkerpop.blueprints.Vertex;
-import com.tinkerpop.blueprints.impls.tg.TinkerGraph;
-
 import teetime.framework.Execution;
 
 /**
@@ -26,19 +21,6 @@ public final class TraceAnalysis {
 		final Execution<TraceAnalysisConfiguration> analysis = new Execution<>(traceAnalysisConfiguration);
 		analysis.executeBlocking();
 
-		/*
-		 *
-		 *
-		 *
-		 * TODO
-		 */
-
-		Graph graph = new TinkerGraph();
-
-		Vertex vertex = graph.addVertex(101);
-
-		Edge edge = vertex.addEdge("Label", vertex);
-
 	}
 
 }
diff --git a/src/main/java/kieker/analysis/TraceAnalysisConfiguration.java b/src/main/java/kieker/analysis/TraceAnalysisConfiguration.java
index 26248069..4ec06db4 100644
--- a/src/main/java/kieker/analysis/TraceAnalysisConfiguration.java
+++ b/src/main/java/kieker/analysis/TraceAnalysisConfiguration.java
@@ -106,14 +106,6 @@ public class TraceAnalysisConfiguration extends Configuration {
 		 *
 		 */
 
-		// TODO Temp Some examples for nested graphs
-		//
-		// final NestedGraphFactory nestedGraphFactory = new NestedGraphFactory();
-		// final ObjectProducer<NestedGraph<Graph>> nestedGraphProducerStage = new ObjectProducer<>(1, nestedGraphFactory);
-		// final NestedGraphPrinterStage nestedGraphPrinterStage = new NestedGraphPrinterStage();
-		//
-		// super.connectPorts(nestedGraphProducerStage.getOutputPort(), nestedGraphPrinterStage.getInputPort());
-
 	}
 
 	public long getBeginTimestamp() {
diff --git a/src/main/java/kieker/analysis/dev/nestedgraph/NestedGraph.java b/src/main/java/kieker/analysis/dev/nestedgraph/NestedGraph.java
deleted file mode 100644
index e6e59ba2..00000000
--- a/src/main/java/kieker/analysis/dev/nestedgraph/NestedGraph.java
+++ /dev/null
@@ -1,172 +0,0 @@
-package kieker.analysis.dev.nestedgraph;
-
-import java.util.HashSet;
-import java.util.Set;
-
-import com.tinkerpop.blueprints.Edge;
-import com.tinkerpop.blueprints.Features;
-import com.tinkerpop.blueprints.Graph;
-import com.tinkerpop.blueprints.GraphQuery;
-import com.tinkerpop.blueprints.Vertex;
-import com.tinkerpop.blueprints.util.StringFactory;
-import com.tinkerpop.blueprints.util.wrappers.WrapperGraph;
-import com.tinkerpop.blueprints.util.wrappers.partition.PartitionGraph;
-
-public class NestedGraph<T extends Graph> implements Graph, WrapperGraph<T> {
-
-	protected PartitionGraph<T> baseGraph;
-
-	private final Features features;
-
-	private static final String PARTITION_KEY = "__nested-graph-partition";
-
-	private static final String DEFAULT_PARTITION = "";
-
-	private final Set<NestedGraphPartition> partitions = new HashSet<>();
-
-	public NestedGraph(final T baseGraph) {
-		this.baseGraph = new PartitionGraph<>(baseGraph, PARTITION_KEY, DEFAULT_PARTITION);
-		this.features = this.baseGraph.getFeatures().copyFeatures();
-		this.features.isWrapper = true;
-	}
-
-	public void addPartition(final NestedGraphPartition partition) {
-		partitions.add(partition);
-	}
-
-	public Iterable<NestedGraphPartition> getPartitions() {
-		return partitions;
-	}
-
-	public Iterable<Vertex> getVerticesForPartition(final NestedGraphPartition partition) {
-
-		baseGraph.removeReadPartition(DEFAULT_PARTITION);
-		baseGraph.addReadPartition(partition.getName());
-
-		Set<Vertex> vertices = new HashSet<Vertex>();
-		for (Vertex vertex : baseGraph.getVertices()) {
-			vertices.add(vertex);
-		}
-
-		baseGraph.removeReadPartition(partition.getName());
-		baseGraph.addReadPartition(DEFAULT_PARTITION);
-
-		return vertices;
-	}
-
-	public Iterable<Edge> getEdgesForPartition(final NestedGraphPartition partition) {
-
-		baseGraph.removeReadPartition(DEFAULT_PARTITION);
-		baseGraph.addReadPartition(partition.getName());
-
-		Set<Edge> edges = new HashSet<Edge>();
-		for (Edge edge : baseGraph.getEdges()) {
-			edges.add(edge);
-		}
-
-		baseGraph.removeReadPartition(partition.getName());
-		baseGraph.addReadPartition(DEFAULT_PARTITION);
-
-		return edges;
-	}
-
-	public Vertex addVertexToPartition(final Object id, final NestedGraphPartition partition) {
-
-		baseGraph.setWritePartition(partition.getName());
-
-		Vertex vertex = baseGraph.addVertex(id);
-
-		baseGraph.setWritePartition(DEFAULT_PARTITION);
-
-		return vertex;
-
-	}
-
-	public Edge addEdgeToPartition(final Object id, final Vertex outVertex, final Vertex inVertex, final String label, final NestedGraphPartition partition) {
-
-		baseGraph.setWritePartition(partition.getName());
-
-		Edge edge = baseGraph.addEdge(id, outVertex, inVertex, label);
-
-		baseGraph.setWritePartition(DEFAULT_PARTITION);
-
-		return edge;
-
-	}
-
-	@Override
-	public Vertex addVertex(final Object id) {
-		return baseGraph.addVertex(id);
-	}
-
-	@Override
-	public Vertex getVertex(final Object id) {
-		return baseGraph.getVertex(id);
-	}
-
-	@Override
-	public Iterable<Vertex> getVertices() {
-		return this.baseGraph.getVertices();
-	}
-
-	@Override
-	public Iterable<Vertex> getVertices(final String key, final Object value) {
-		return this.baseGraph.getVertices(key, value);
-	}
-
-	@Override
-	public Edge addEdge(final Object id, final Vertex outVertex, final Vertex inVertex, final String label) {
-		return baseGraph.addEdge(id, outVertex, inVertex, label);
-	}
-
-	@Override
-	public Edge getEdge(final Object id) {
-		return baseGraph.getEdge(id);
-	}
-
-	@Override
-	public Iterable<Edge> getEdges() {
-		return baseGraph.getEdges();
-	}
-
-	@Override
-	public Iterable<Edge> getEdges(final String key, final Object value) {
-		return this.baseGraph.getEdges(key, value);
-	}
-
-	@Override
-	public void removeEdge(final Edge edge) {
-		baseGraph.removeEdge(edge);
-	}
-
-	@Override
-	public void removeVertex(final Vertex vertex) {
-		baseGraph.removeVertex(vertex);
-	}
-
-	@Override
-	public T getBaseGraph() {
-		return baseGraph.getBaseGraph();
-	}
-
-	@Override
-	public GraphQuery query() {
-		return this.baseGraph.query();
-	}
-
-	@Override
-	public String toString() {
-		return StringFactory.graphString(this, this.baseGraph.toString());
-	}
-
-	@Override
-	public Features getFeatures() {
-		return this.features;
-	}
-
-	@Override
-	public void shutdown() {
-		this.baseGraph.shutdown();
-	}
-
-}
diff --git a/src/main/java/kieker/analysis/dev/nestedgraph/NestedGraphPartition.java b/src/main/java/kieker/analysis/dev/nestedgraph/NestedGraphPartition.java
deleted file mode 100644
index ce092e3a..00000000
--- a/src/main/java/kieker/analysis/dev/nestedgraph/NestedGraphPartition.java
+++ /dev/null
@@ -1,47 +0,0 @@
-package kieker.analysis.dev.nestedgraph;
-
-import java.util.HashSet;
-import java.util.Set;
-
-public class NestedGraphPartition {
-
-	private String name;
-
-	private String label;
-
-	private final Set<NestedGraphPartition> subPartitions = new HashSet<>();
-
-	public NestedGraphPartition(final String name) {
-		this(name, null);
-	}
-
-	public NestedGraphPartition(final String name, final String label) {
-		this.name = name;
-		this.label = label;
-	}
-
-	public String getName() {
-		return name;
-	}
-
-	public void setName(final String name) {
-		this.name = name;
-	}
-
-	public String getLabel() {
-		return label;
-	}
-
-	public void setLabel(final String label) {
-		this.label = label;
-	}
-
-	public Iterable<NestedGraphPartition> getSubPartitions() {
-		return subPartitions;
-	}
-
-	public void addSubPartition(final NestedGraphPartition subPartition) {
-		subPartitions.add(subPartition);
-	}
-
-}
diff --git a/src/main/java/kieker/analysis/dev/nestedgraph/SubGraph.java b/src/main/java/kieker/analysis/dev/nestedgraph/SubGraph.java
deleted file mode 100644
index 17a90c5f..00000000
--- a/src/main/java/kieker/analysis/dev/nestedgraph/SubGraph.java
+++ /dev/null
@@ -1,102 +0,0 @@
-package kieker.analysis.dev.nestedgraph;
-
-import com.tinkerpop.blueprints.Edge;
-import com.tinkerpop.blueprints.Features;
-import com.tinkerpop.blueprints.Graph;
-import com.tinkerpop.blueprints.GraphQuery;
-import com.tinkerpop.blueprints.Vertex;
-
-//TODO implements
-public class SubGraph implements Graph {
-
-	private final NestedGraph<Graph> mainGraph; // TODO has to be nestable Graph
-
-	public SubGraph(final NestedGraph<Graph> mainGraph) {
-		this.mainGraph = mainGraph;
-
-		// TODO subGraph beim mainGraph anmelden
-	}
-
-	public NestedGraph<Graph> getMainGraph() {
-		return mainGraph;
-	}
-
-	@Override
-	public Features getFeatures() {
-		// TODO Auto-generated method stub
-		return null;
-	}
-
-	@Override
-	public Vertex addVertex(final Object id) {
-		// TODO Auto-generated method stub
-		return null;
-	}
-
-	@Override
-	public Vertex getVertex(final Object id) {
-		// TODO Auto-generated method stub
-		return null;
-	}
-
-	@Override
-	public void removeVertex(final Vertex vertex) {
-		// TODO Auto-generated method stub
-
-	}
-
-	@Override
-	public Iterable<Vertex> getVertices() {
-		// TODO Auto-generated method stub
-		return null;
-	}
-
-	@Override
-	public Iterable<Vertex> getVertices(final String key, final Object value) {
-		// TODO Auto-generated method stub
-		return null;
-	}
-
-	@Override
-	public Edge addEdge(final Object id, final Vertex outVertex, final Vertex inVertex, final String label) {
-		// TODO Auto-generated method stub
-		return null;
-	}
-
-	@Override
-	public Edge getEdge(final Object id) {
-		// TODO Auto-generated method stub
-		return null;
-	}
-
-	@Override
-	public void removeEdge(final Edge edge) {
-		// TODO Auto-generated method stub
-
-	}
-
-	@Override
-	public Iterable<Edge> getEdges() {
-		// TODO Auto-generated method stub
-		return null;
-	}
-
-	@Override
-	public Iterable<Edge> getEdges(final String key, final Object value) {
-		// TODO Auto-generated method stub
-		return null;
-	}
-
-	@Override
-	public GraphQuery query() {
-		// TODO Auto-generated method stub
-		return null;
-	}
-
-	@Override
-	public void shutdown() {
-		// TODO Auto-generated method stub
-
-	}
-
-}
diff --git a/src/main/java/kieker/analysis/dev/nestedgraphstages/NestedGraphFactory.java b/src/main/java/kieker/analysis/dev/nestedgraphstages/NestedGraphFactory.java
deleted file mode 100644
index 1bb72a71..00000000
--- a/src/main/java/kieker/analysis/dev/nestedgraphstages/NestedGraphFactory.java
+++ /dev/null
@@ -1,43 +0,0 @@
-package kieker.analysis.dev.nestedgraphstages;
-
-import com.tinkerpop.blueprints.Graph;
-import com.tinkerpop.blueprints.Vertex;
-import com.tinkerpop.blueprints.impls.tg.TinkerGraph;
-
-import kieker.analysis.dev.nestedgraph.NestedGraph;
-import kieker.analysis.dev.nestedgraph.NestedGraphPartition;
-
-import teetime.util.ConstructorClosure;
-
-public class NestedGraphFactory implements ConstructorClosure<NestedGraph<Graph>> {
-
-	@Override
-	public NestedGraph<Graph> create() {
-
-		NestedGraph<Graph> graph = new NestedGraph<Graph>(new TinkerGraph());
-
-		Vertex entry = graph.addVertex("Entry");
-
-		NestedGraphPartition partitionBookstore = new NestedGraphPartition("Bookstore");
-		graph.addPartition(partitionBookstore);
-		Vertex searchBook = graph.addVertexToPartition("searchBook()", partitionBookstore);
-
-		NestedGraphPartition partitionCRM = new NestedGraphPartition("CRM");
-		graph.addPartition(partitionCRM);
-		Vertex getOffers = graph.addVertexToPartition("getOffers()", partitionCRM);
-		Vertex customMethod = graph.addVertexToPartition("customMethod()", partitionCRM);
-
-		NestedGraphPartition partitionCatalog = new NestedGraphPartition("Catalog");
-		graph.addPartition(partitionCatalog);
-		Vertex getBook = graph.addVertexToPartition("getBook()", partitionCatalog);
-
-		graph.addEdge(null, entry, searchBook, "100");
-		graph.addEdge(null, searchBook, getBook, "100");
-		graph.addEdge(null, searchBook, getOffers, "100");
-		graph.addEdge(null, getOffers, getBook, "96");
-		graph.addEdge(null, getOffers, customMethod, "0");
-
-		return graph;
-	}
-
-}
diff --git a/src/main/java/kieker/analysis/dev/nestedgraphstages/NestedGraphPrinterStage.java b/src/main/java/kieker/analysis/dev/nestedgraphstages/NestedGraphPrinterStage.java
deleted file mode 100644
index c5f2f8a3..00000000
--- a/src/main/java/kieker/analysis/dev/nestedgraphstages/NestedGraphPrinterStage.java
+++ /dev/null
@@ -1,43 +0,0 @@
-package kieker.analysis.dev.nestedgraphstages;
-
-import com.tinkerpop.blueprints.Edge;
-import com.tinkerpop.blueprints.Graph;
-import com.tinkerpop.blueprints.Vertex;
-
-import kieker.analysis.dev.nestedgraph.NestedGraph;
-import kieker.analysis.dev.nestedgraph.NestedGraphPartition;
-
-import teetime.framework.AbstractConsumerStage;
-
-public class NestedGraphPrinterStage extends AbstractConsumerStage<NestedGraph<Graph>> {
-
-	@Override
-	protected void execute(final NestedGraph<Graph> graph) {
-
-		System.out.println("TOP LEVEL:");
-
-		for (Vertex vertex : graph.getVertices()) {
-			System.out.println(vertex);
-		}
-
-		for (Edge edge : graph.getEdges()) {
-			System.out.println(edge);
-		}
-
-		for (NestedGraphPartition partition : graph.getPartitions()) {
-
-			System.out.println("PARTITION: " + partition.getName());
-
-			for (Vertex vertex : graph.getVerticesForPartition(partition)) {
-				System.out.println(vertex);
-			}
-
-			for (Edge edge : graph.getEdgesForPartition(partition)) {
-				System.out.println(edge);
-			}
-
-		}
-
-	}
-
-}
diff --git a/src/main/java/kieker/analysis/trace/graphoutput/DotGraphWriter.java b/src/main/java/kieker/analysis/trace/graphoutput/DotGraphWriter.java
index 0f88302f..914f3b7b 100644
--- a/src/main/java/kieker/analysis/trace/graphoutput/DotGraphWriter.java
+++ b/src/main/java/kieker/analysis/trace/graphoutput/DotGraphWriter.java
@@ -14,11 +14,19 @@ import com.tinkerpop.blueprints.Edge;
 import com.tinkerpop.blueprints.Graph;
 import com.tinkerpop.blueprints.Vertex;
 
+import kieker.analysis.graph.export.dot.DotFileWriterStage;
 import kieker.analysis.util.DotBuilder;
-import kieker.analysis.util.graph.NamedGraph;
+import kieker.analysis.util.blueprintsgraph.NamedGraph;
 
 import teetime.framework.AbstractConsumerStage;
 
+/**
+ * @deprecated use {@link DotFileWriterStage} instead.
+ *
+ * @author Sören Henning
+ *
+ */
+@Deprecated
 public class DotGraphWriter extends AbstractConsumerStage<NamedGraph<Graph>> {
 
 	private final String outputDir;
diff --git a/src/main/java/kieker/analysis/trace/graphoutput/GraphMLWriter.java b/src/main/java/kieker/analysis/trace/graphoutput/GraphMLWriter.java
index eede0b28..64a6d3b8 100644
--- a/src/main/java/kieker/analysis/trace/graphoutput/GraphMLWriter.java
+++ b/src/main/java/kieker/analysis/trace/graphoutput/GraphMLWriter.java
@@ -4,10 +4,18 @@ import java.io.IOException;
 
 import com.tinkerpop.blueprints.Graph;
 
-import kieker.analysis.util.graph.NamedGraph;
+import kieker.analysis.graph.export.graphml.GraphMLFileWriterComposite;
+import kieker.analysis.util.blueprintsgraph.NamedGraph;
 
 import teetime.framework.AbstractConsumerStage;
 
+/**
+ * @deprecated use {@link GraphMLFileWriterComposite} instead.
+ *
+ * @author Sören Henning
+ *
+ */
+@Deprecated
 public class GraphMLWriter extends AbstractConsumerStage<NamedGraph<Graph>> {
 
 	private final String outputDir;
diff --git a/src/main/java/kieker/analysis/util/DotBuilder.java b/src/main/java/kieker/analysis/util/DotBuilder.java
index 0f6bcd3c..638ae36e 100644
--- a/src/main/java/kieker/analysis/util/DotBuilder.java
+++ b/src/main/java/kieker/analysis/util/DotBuilder.java
@@ -6,10 +6,12 @@ import java.util.Map.Entry;
 
 import com.google.common.base.Joiner;
 
+import kieker.analysis.graph.util.dot.DotGraphWriter;
+
 /**
  * Simple class for building and representing dot graph files.
  *
- * @deprecated use {@link DotExporter.DotWriter} instead.
+ * @deprecated use {@link DotGraphWriter} instead.
  *
  * @author Sören Henning
  *
@@ -38,20 +40,17 @@ public class DotBuilder {
 		this(graphName, DEFAULT_GRAPH_TYPE);
 	}
 
-	// TODO graphType has to be one of "graph", "digraph" or "subgraph" so maybe use an enum
 	public DotBuilder(final String graphName, final String graphType) {
 		start = graphType + " " + graphName + " " + START_BRACKET + "\n";
 		end = END_BRACKET;
 	}
 
-	// TODO Deprecated
 	public DotBuilder(final String name, final Map<String, String> defaultNodeProperties, final Map<String, String> defaultEdgeProperties) {
 		this(name);
 		this.defaultNodeProperties = defaultNodeProperties;
 		this.defaultEdgeProperties = defaultEdgeProperties;
 	}
 
-	// TODO Deprecated
 	public DotBuilder(final String name, final Map<String, String> defaultNodeProperties, final Map<String, String> defaultEdgeProperties,
 			final Map<String, String> defaultProperties) {
 		this(name, defaultNodeProperties, defaultEdgeProperties);
diff --git a/src/main/java/kieker/analysis/util/graph/NamedGraph.java b/src/main/java/kieker/analysis/util/blueprintsgraph/NamedGraph.java
similarity index 93%
rename from src/main/java/kieker/analysis/util/graph/NamedGraph.java
rename to src/main/java/kieker/analysis/util/blueprintsgraph/NamedGraph.java
index 1025ec8a..f922975f 100644
--- a/src/main/java/kieker/analysis/util/graph/NamedGraph.java
+++ b/src/main/java/kieker/analysis/util/blueprintsgraph/NamedGraph.java
@@ -1,4 +1,4 @@
-package kieker.analysis.util.graph;
+package kieker.analysis.util.blueprintsgraph;
 
 import com.tinkerpop.blueprints.Graph;
 import com.tinkerpop.blueprints.util.wrappers.wrapped.WrappedGraph;
-- 
GitLab