001 package org.kuali.maven.plugins.graph.dot;
002
003 import java.util.ArrayList;
004 import java.util.List;
005
006 import org.kuali.maven.plugins.graph.pojo.Direction;
007 import org.kuali.maven.plugins.graph.pojo.Edge;
008 import org.kuali.maven.plugins.graph.pojo.Graph;
009 import org.kuali.maven.plugins.graph.pojo.GraphDecorator;
010 import org.kuali.maven.plugins.graph.pojo.GraphNode;
011
012 public class GraphHelper {
013
014 public Graph getGraph(String title) {
015 return getGraph(title, Direction.DEFAULT_DIRECTION, new ArrayList<GraphNode>(), new ArrayList<Edge>());
016 }
017
018 public Graph getGraph(String title, List<GraphNode> nodes) {
019 return getGraph(title, Direction.DEFAULT_DIRECTION, nodes, new ArrayList<Edge>());
020 }
021
022 public Graph getGraph(String title, Direction direction, List<GraphNode> nodes, List<Edge> edges) {
023 GraphDecorator decorator = new GraphDecorator();
024 decorator.setRankdir(direction.name());
025 decorator.setLabel(title);
026 Graph graph = new Graph();
027 graph.setGraphDecorator(decorator);
028 graph.setNodes(nodes);
029 graph.setEdges(edges);
030 return graph;
031 }
032
033 }