info.bioinfweb.treegraph.document
Class TreeSerializer

java.lang.Object
  extended by info.bioinfweb.treegraph.document.TreeSerializer

public class TreeSerializer
extends Object


Constructor Summary
TreeSerializer()
           
 
Method Summary
private static void addLabelBlock(Vector<PaintableElement> list, Labels labels, boolean above)
           
private static void addLabelsWithID(Vector<Label> list, Node root, String id)
           
private static void addLeafNodesBetween(Vector<Node> list, Node root, int level, TreePath upperPath, TreePath lowerPath)
           
private static void addSubtree(Vector<PaintableElement> list, Node root, boolean leafsOnly, boolean node, boolean branch, boolean label)
           
static Branch[] getBranches(Node root)
           
static
<T> T[]
getElements(Node root, T[] array, boolean leafsOnly, boolean node, boolean branch, boolean label)
           
static
<T> T[]
getElementsOfType(Node root, PaintableElement typeElement, T[] array, boolean leafsOnly)
           
static Label[] getLabels(Labels labels)
          Returns all labels of this labels-object.
static Label[] getLabels(Node root)
          Returns all labels in the subtree under root.
static Label[] getLabelsWithID(Node root, String id)
           
private static void getLabelsWithIDInBlock(Vector<Label> list, Labels labels, boolean above, String id)
           
static Node[] getLeafNodes(Node root)
           
static Node[] getLeafNodesBetween(Node upperLeaf, Node lowerLeaf)
           
static Legend[] getLegendsInSubtree(Tree tree, Node root)
          Returns an array of all legends which are completely anchored inside the subtree under root.
static LineElement[] getLineElements(Node root)
           
static Node[] getNodes(Node root)
           
static ConcretePaintableElement[] getPaintableElements(Node root)
           
static TextElement[] getTextElements(Node root)
           
 
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
 

Constructor Detail

TreeSerializer

public TreeSerializer()
Method Detail

addLabelBlock

private static void addLabelBlock(Vector<PaintableElement> list,
                                  Labels labels,
                                  boolean above)

addSubtree

private static void addSubtree(Vector<PaintableElement> list,
                               Node root,
                               boolean leafsOnly,
                               boolean node,
                               boolean branch,
                               boolean label)

getElements

public static <T> T[] getElements(Node root,
                                  T[] array,
                                  boolean leafsOnly,
                                  boolean node,
                                  boolean branch,
                                  boolean label)

getElementsOfType

public static <T> T[] getElementsOfType(Node root,
                                        PaintableElement typeElement,
                                        T[] array,
                                        boolean leafsOnly)

getPaintableElements

public static ConcretePaintableElement[] getPaintableElements(Node root)

getLineElements

public static LineElement[] getLineElements(Node root)

getTextElements

public static TextElement[] getTextElements(Node root)

getNodes

public static Node[] getNodes(Node root)

getBranches

public static Branch[] getBranches(Node root)

getLabels

public static Label[] getLabels(Node root)
Returns all labels in the subtree under root.

Parameters:
root -
Returns:

getLabels

public static Label[] getLabels(Labels labels)
Returns all labels of this labels-object. (No labels from the subtree under the holding branch are returned.)

Parameters:
labels -
Returns:

getLeafNodes

public static Node[] getLeafNodes(Node root)

addLeafNodesBetween

private static void addLeafNodesBetween(Vector<Node> list,
                                        Node root,
                                        int level,
                                        TreePath upperPath,
                                        TreePath lowerPath)

getLeafNodesBetween

public static Node[] getLeafNodesBetween(Node upperLeaf,
                                         Node lowerLeaf)

getLabelsWithIDInBlock

private static void getLabelsWithIDInBlock(Vector<Label> list,
                                           Labels labels,
                                           boolean above,
                                           String id)

addLabelsWithID

private static void addLabelsWithID(Vector<Label> list,
                                    Node root,
                                    String id)

getLabelsWithID

public static Label[] getLabelsWithID(Node root,
                                      String id)

getLegendsInSubtree

public static Legend[] getLegendsInSubtree(Tree tree,
                                           Node root)
Returns an array of all legends which are completely anchored inside the subtree under root.

Parameters:
tree - - the tree that cotains the legends and root
root - - the root node of the subtree
Returns:
an array of the legends (possibly with the length 0)
Throws:
IllegalArgumentException - if root is not contained in tree.
See Also:
Node.containedInSubtree(ConcretePaintableElement)