data.exporters
Class ExporterDOT

java.lang.Object
  extended by data.exporters.ExporterDOT

public final class ExporterDOT
extends java.lang.Object

This class allow export Tree objects as DOT graphs (for read it in GraphViz, for example)

Version:
1.0
Author:
Oscar Flores

Constructor Summary
ExporterDOT()
           
 
Method Summary
private static java.lang.String getNodeId(TreeNode tn)
          Returns the Strign used to identify a node in tree.
private static java.lang.String getNodeLine(TreeNode tn, Matrix m, boolean isTaxa)
          Returns the String of a node line of the tree
static java.io.File writeDOT(Tree t)
          Creates a temporal file containing the exported tree in DOT format
private static void writeDOT(TreeNode t, Matrix mat, java.io.OutputStreamWriter out)
          Writes recursively all the tree nodes
 
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
 

Constructor Detail

ExporterDOT

public ExporterDOT()
Method Detail

writeDOT

public static java.io.File writeDOT(Tree t)
                             throws DataException
Creates a temporal file containing the exported tree in DOT format

Parameters:
t - Tree to export
Returns:
Temporal file with DOT tree
Throws:
DataException

writeDOT

private static void writeDOT(TreeNode t,
                             Matrix mat,
                             java.io.OutputStreamWriter out)
                      throws java.io.IOException
Writes recursively all the tree nodes

Parameters:
t - Current TreeNode
mat - Reference Matrix
out - OutputStreamWriter of temp File
Throws:
java.io.IOException

getNodeId

private static java.lang.String getNodeId(TreeNode tn)
Returns the Strign used to identify a node in tree. It uses the internal java object name

Parameters:
tn - TreeNode to generate the id
Returns:
TreeNode identificator

getNodeLine

private static java.lang.String getNodeLine(TreeNode tn,
                                            Matrix m,
                                            boolean isTaxa)
Returns the String of a node line of the tree

Parameters:
tn - Current TreeNode
m - Reference Matrix
isTaxa - The current node is a taxa node?
Returns:
String for the node