diff --git a/src/main/java/kieker/analysis/graph/GraphTester.java b/src/main/java/kieker/analysis/graph/GraphTester.java index bc151543721ce59aa4905506c14a0af169d72d8a..8e7f719d6278644a5710432cd1ca2bd44e3597e5 100644 --- a/src/main/java/kieker/analysis/graph/GraphTester.java +++ b/src/main/java/kieker/analysis/graph/GraphTester.java @@ -27,6 +27,44 @@ public class GraphTester { assert node1 == node1snd; + System.out.println("Master graph"); + + for (Vertex vertex : graph.getVertices()) { + System.out.println(vertex.getId()); + } + + for (Edge edge : graph.getEdges()) { + System.out.println(edge.getId()); + } + + // BlueprintsExporter blueprintsExporter = new BlueprintsExporter(graph); + // System.out.println(blueprintsExporter.exportGraph()); + + node1snd.remove(); + + for (Vertex vertex : graph.getVertices()) { + System.out.println(vertex.getId()); + } + + node1.addChildGraph(); + + Vertex node1sub1 = node1.getChildGraph().addVertex("n1::s1"); + Vertex node1sub2 = node1.getChildGraph().addVertex("n1::s2"); + Vertex node1sub3 = node1.getChildGraph().addVertex("n1::s3"); + node1sub3.addEdge("wormhole", node4); + + System.out.println("Node 1's child graph"); + + for (Vertex vertex : node1.getChildGraph().getVertices()) { + System.out.println(vertex.getId()); + } + + for (Edge edge : node1.getChildGraph().getEdges()) { + System.out.println(edge.getId()); + } + + System.out.println("Master graph"); + for (Vertex vertex : graph.getVertices()) { System.out.println(vertex.getId()); } @@ -37,6 +75,10 @@ public class GraphTester { // node2.addEdgeTo(node11); + // Export to Blueprints + // BlueprintsExporter blueprintsExporter = new BlueprintsExporter(graph); + // System.out.println(blueprintsExporter.exportGraph()); + } } diff --git a/src/main/java/kieker/analysis/graph/Subgraph.java b/src/main/java/kieker/analysis/graph/Subgraph.java deleted file mode 100644 index e331bed31758eeef2e5cc69ae8856e7d519e4eff..0000000000000000000000000000000000000000 --- a/src/main/java/kieker/analysis/graph/Subgraph.java +++ /dev/null @@ -1,5 +0,0 @@ -package kieker.analysis.graph; - -public interface Subgraph { - -} diff --git a/src/main/java/kieker/analysis/graph/Vertex.java b/src/main/java/kieker/analysis/graph/Vertex.java index f231c78d27a3764b5453331e738c88b30b08150a..788a08e321be3f2a50365c99003127f277f09afa 100644 --- a/src/main/java/kieker/analysis/graph/Vertex.java +++ b/src/main/java/kieker/analysis/graph/Vertex.java @@ -2,10 +2,12 @@ package kieker.analysis.graph; public interface Vertex extends Element { - public Graph getChildGraph(); - public Graph addChildGraph(); + public boolean hasChildGraph(); + + public Graph getChildGraph(); + public Iterable<Edge> getEdges(Direction direction); public Iterable<Vertex> getVertices(Direction direction); diff --git a/src/main/java/kieker/analysis/graph/impl/ElementImpl.java b/src/main/java/kieker/analysis/graph/impl/ElementImpl.java index e980e4b94f10a84c6543f99aeee56d86a655ac91..f1c2dd91928b5bcfbce4191c07fe44f55cf23f98 100644 --- a/src/main/java/kieker/analysis/graph/impl/ElementImpl.java +++ b/src/main/java/kieker/analysis/graph/impl/ElementImpl.java @@ -11,7 +11,7 @@ abstract class ElementImpl implements Element { protected Map<String, Object> properties = new HashMap<String, Object>(); protected final String id; - protected final GraphImpl graph; // TODO Maybe Graph as type? + protected final GraphImpl graph; protected ElementImpl(final String id, final GraphImpl graph) { this.graph = graph; diff --git a/src/main/java/kieker/analysis/graph/impl/GraphImpl.java b/src/main/java/kieker/analysis/graph/impl/GraphImpl.java index b5202fbfdbfb476b8d96fbde2580b24dde3296cd..9848b4d4fbc473f537e4011db6775ff571dd1892 100644 --- a/src/main/java/kieker/analysis/graph/impl/GraphImpl.java +++ b/src/main/java/kieker/analysis/graph/impl/GraphImpl.java @@ -57,7 +57,10 @@ public class GraphImpl implements Graph { throw ExceptionFactory.vertexWithIdDoesNotExist(vertex.getId()); } - for (Edge edge : vertex.getEdges(Direction.BOTH)) { + for (Edge edge : vertex.getEdges(Direction.IN)) { + this.removeEdge(edge); + } + for (Edge edge : vertex.getEdges(Direction.OUT)) { this.removeEdge(edge); } diff --git a/src/main/java/kieker/analysis/graph/impl/VertexImpl.java b/src/main/java/kieker/analysis/graph/impl/VertexImpl.java index fa049476d4ff44dd21a6a9832dec446a5478a079..feed76b4310d9f7c6a5745330f88310513182d49 100644 --- a/src/main/java/kieker/analysis/graph/impl/VertexImpl.java +++ b/src/main/java/kieker/analysis/graph/impl/VertexImpl.java @@ -13,6 +13,7 @@ class VertexImpl extends ElementImpl implements Vertex { protected Map<String, Edge> outEdges = new HashMap<String, Edge>(); protected Map<String, Edge> inEdges = new HashMap<String, Edge>(); + private Graph childGraph; protected VertexImpl(final String id, final GraphImpl graph) { super(id, graph); @@ -20,14 +21,18 @@ class VertexImpl extends ElementImpl implements Vertex { @Override public Graph addChildGraph() { - // TODO Auto-generated method stub - return null; + this.childGraph = new GraphImpl(); + return getChildGraph(); + } + + @Override + public boolean hasChildGraph() { + return (this.childGraph == null); } @Override public Graph getChildGraph() { - // TODO Auto-generated method stub - return null; + return childGraph; } @Override