All Downloads are FREE. Search and download functionalities are using the official Maven repository.

org.atemsource.atem.utility.doc.dot.DotBuilder Maven / Gradle / Ivy

The newest version!
package org.atemsource.atem.utility.doc.dot;

import java.util.HashSet;
import java.util.Set;


public class DotBuilder
{

	private Set nodes = new HashSet();

	public String create()
	{
		StringBuilder builder = new StringBuilder();
		builder.append("digraph{\r\nrankdir=BT\r\nnode [shape=record]\r\n");
		Set connections = new HashSet();
		for (NodeBuilder node : nodes)
		{
			node.create(builder);
			connections.addAll(node.getConnections());
		}
		for (ConnectionBuilder connection : connections)
		{
			connection.create(builder);
		}
		builder.append("}");
		return builder.toString();
	}

	public NodeBuilder createNode(String id, String label)
	{
		NodeBuilder nodeBuilder = new NodeBuilder(id, label);
		nodes.add(nodeBuilder);
		return nodeBuilder;
	}

}




© 2015 - 2024 Weber Informatics LLC | Privacy Policy