Class PrefuseTreeVisualization.DottyToTree

  • Enclosing class:
    PrefuseTreeVisualization

    public static class PrefuseTreeVisualization.DottyToTree
    extends java.lang.Object
    Turns the GraphViz dotty format into Prefuse's tree XML format (according to the tree.dtd).
    Version:
    $Revision$
    Author:
    fracpete (fracpete at waikato dot ac dot nz)
    • Constructor Summary

      Constructors 
      Constructor Description
      DottyToTree()  
    • Method Summary

      All Methods Instance Methods Concrete Methods 
      Modifier and Type Method Description
      java.lang.String convert​(java.lang.String dotty)
      Parses the incoming data and writes the generated output.
      protected java.lang.String sanitize​(java.lang.String s)
      Replaces certain characters with their character entities.
      protected void writeEdge​(java.io.BufferedWriter writer, weka.gui.treevisualizer.Edge edge)
      Writes the edge as GraphML.
      protected void writeFooter​(java.io.BufferedWriter writer)
      Writes the footer of the GraphML file.
      protected void writeHeader​(java.io.BufferedWriter writer)
      Writes the header of the GraphML file.
      protected void writeNode​(java.io.BufferedWriter writer, weka.gui.treevisualizer.Node node)
      Writes the node as GraphML.
      • Methods inherited from class java.lang.Object

        clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
    • Constructor Detail

      • DottyToTree

        public DottyToTree()
    • Method Detail

      • sanitize

        protected java.lang.String sanitize​(java.lang.String s)
        Replaces certain characters with their character entities.
        Parameters:
        s - the string to process
        Returns:
        the processed string
      • writeHeader

        protected void writeHeader​(java.io.BufferedWriter writer)
                            throws java.lang.Exception
        Writes the header of the GraphML file.
        Parameters:
        writer - the writer to use
        Throws:
        java.lang.Exception - if an error occurs
      • writeNode

        protected void writeNode​(java.io.BufferedWriter writer,
                                 weka.gui.treevisualizer.Node node)
                          throws java.lang.Exception
        Writes the node as GraphML.
        Parameters:
        writer - the writer to use
        node - the node to write as GraphML
        Throws:
        java.lang.Exception - if an error occurs
      • writeEdge

        protected void writeEdge​(java.io.BufferedWriter writer,
                                 weka.gui.treevisualizer.Edge edge)
                          throws java.lang.Exception
        Writes the edge as GraphML. Since prefuse doesn't seem to offer edge labels, the edges get inserted as nodes as well.
        Parameters:
        writer - the writer to use
        edge - the edge to write
        Throws:
        java.lang.Exception - if an error occurs
      • writeFooter

        protected void writeFooter​(java.io.BufferedWriter writer)
                            throws java.lang.Exception
        Writes the footer of the GraphML file.
        Parameters:
        writer - the writer to use
        Throws:
        java.lang.Exception - if an error occurs
      • convert

        public java.lang.String convert​(java.lang.String dotty)
                                 throws java.lang.Exception
        Parses the incoming data and writes the generated output.
        Parameters:
        dotty - the graph in dotty format
        Returns:
        the TreeML data
        Throws:
        java.lang.Exception - if parsing or writing fails