@@ -0,0 +1,1974 @@
+/*%0A * Copyright (c) 2012 Mateusz Parzonka, Eric Bodden%0A * All rights reserved. This program and the accompanying materials%0A * are made available under the terms of the Eclipse Public License v1.0%0A * which accompanies this distribution, and is available at%0A * http://www.eclipse.org/legal/epl-v10.html%0A *%0A * Contributors:%0A * Mateusz Parzonka - initial API and implementation%0A */%0Apackage prm4j;%0A%0Aimport java.util.Arrays;%0A%0Aimport javagraphviz.GraphvizEngine;%0Aimport javagraphviz.GvGraph;%0Aimport javagraphviz.GvNode;%0Aimport prm4j.indexing.staticdata.ChainData;%0Aimport prm4j.indexing.staticdata.MetaNode;%0A%0Apublic class Visualizer %7B%0A%0A    /**%0A     * Generates a diagram from meta tree%0A     *%0A     * @param metaTree%0A     * @param subPath%0A     *            the name of the test-class and testing method%0A     * @param name%0A     *            the name of the graph (expected or actual)%0A     */%0A    public static void visualizeMetaTree(MetaNode metaTree, String subPath, String name) %7B%0A%0A%09// define a graph with the Digraph Type.%0A%09GvGraph graph = GvGraph.createDigraph(name);%0A%09graph.setAttribute(%22rankdir%22, %22TD%22);%0A%0A%09visualizeMetaNode(metaTree, graph);%0A%0A%09GraphvizEngine ge = new GraphvizEngine();%0A%09ge.setExecutionPath(%22target/graphviz/%22 + subPath);%0A%09ge.process(graph);%0A%0A    %7D%0A%0A    private static void visualizeMetaNode(MetaNode metaNode, GvGraph graph) %7B%0A%09if (metaNode.getChainDataArray() != null) %7B%0A%09    for (ChainData chainData : metaNode.getChainDataArray()) %7B%0A%09%09GvNode x = graph.getNode(Arrays.toString(chainData.getNodeMask()));%0A%09%09GvNode y = graph.getNode(Arrays.toString(metaNode.getNodeMask()));%0A%09%09graph.addEdge(x, y).setStyle(%22dashed%22);%0A%09    %7D%0A%09%7D%0A%09for (MetaNode successor : metaNode.getSuccessors()) %7B%0A%09    GvNode dotNode = graph.getNode(Arrays.toString(metaNode.getNodeMask()));%0A%09    if (successor != null) %7B%0A%09%09GvNode succNode = graph.getNode(Arrays.toString(successor.getNodeMask()));%0A%09%09graph.addEdge(dotNode, succNode);%0A%09%09visualizeMetaNode(successor, graph);%0A%09    %7D%0A%09%7D%0A    %7D%0A%0A%7D%0A

Add Visualizer-class providing output methods for Graphviz