Overview | Package | Class | Use | Tree | Deprecated | Index | Help
PREV CLASS NEXT CLASS | FRAMES NO FRAMES
SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD

## info.bioinfweb.treegraph.document
Class TreeSerializer

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

    public class TreeSerializer

extends Object

Utility class that is able to serialize tree elements in several ways.

Author:
  Ben Stöver

Constructor Summary
`TreeSerializer()`

Method Summary
`private static
`<T extends PaintableElement> void`
` | `addElementsOnNode(List<PaintableElement> list, Node node, Class<T> c)`
`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, Class<? extends PaintableElement> elementClass)`
`static
`<T extends PaintableElement> T[]`
` | `getElementsInSubtree(Node root, boolean leafsOnly, Class<? extends PaintableElement> elementClass, T[] array)` Returns an array of tree elements in the subtree under `root`
`static
`<T extends PaintableElement> T[]`
` | `getElementsInSubtree(Node root, boolean leafsOnly, Class<T> elementClass)` Returns an array of tree elements in the subtree under `root` Calling this method is equivalent to `getElementsInSubtree(root, leafsOnly, elementClass, (T[])Array.newInstance(elementClass, 0))`.
`static
`<T extends PaintableElement> T[]`
` | `getElementsOnNode(Node node, Class<? extends PaintableElement> c, T[] array)` Returns an array of tree elements linked to the specified node.
`static
`<T extends PaintableElement> T[]`
` | `getElementsOnNode(Node node, Class<T> c)` Returns an array of tree elements linked to the specified node.
`static Label[]` | `getLabelsWithID(Node root, String id)`
`private static void` | `getLabelsWithIDInBlock(Vector<Label> list, Labels labels, boolean above, String id)`
`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`.

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)

### addElementsOnNode

    private static <T extends PaintableElement> void addElementsOnNode(List<PaintableElement> list,
                                                                       Node node,
                                                                       Class<T> c)

### getElementsOnNode

    public static <T extends PaintableElement> T[] getElementsOnNode(Node node,
                                                                     Class<? extends PaintableElement> c,
                                                                     T[] array)

  Returns an array of tree elements linked to the specified node. (No elements from the subtree are included.)

  Type Parameters:
    `T` - the type of the array to be returned
  Parameters:
    `node` - the node to which the returned elements are connected
    `c` - the class defining which elements should be returned
    `array` - the array to store the result in (defines the return type and is recreated if it is too small)
  Returns:
    the array of tree elements
  Since:
    2.0.43

### getElementsOnNode

    public static <T extends PaintableElement> T[] getElementsOnNode(Node node,
                                                                     Class<T> c)

  Returns an array of tree elements linked to the specified node. (No elements from the subtree are included.)
  Calling this method is equivalent to `getElementsOnNode(node, c, (T[])Array.newInstance(c, 0))`.

  Type Parameters:
    `T` - the type of the array to be returned
  Parameters:
    `node` - the node to which the returned elements are connected
    `c` - the class defining which elements should be returned
  Returns:
    the array of tree elements
  Since:
    2.0.43

### addSubtree

    private static void addSubtree(Vector<PaintableElement> list,
                                   Node root,
                                   boolean leafsOnly,
                                   Class<? extends PaintableElement> elementClass)

### getElementsInSubtree

    public static <T extends PaintableElement> T[] getElementsInSubtree(Node root,
                                                                        boolean leafsOnly,
                                                                        Class<? extends PaintableElement> elementClass,
                                                                        T[] array)

  Returns an array of tree elements in the subtree under `root`

  Type Parameters:
    `T` - the type of the array to be returned
  Parameters:
    `node` - the node to which the returned elements are connected
    `c` - the class defining which elements should be returned
    `array` - the array to store the result in (defines the return type and is recreated if it is too small)
  Returns:
    the array of tree elements
  Since:
    2.0.43

### getElementsInSubtree

    public static <T extends PaintableElement> T[] getElementsInSubtree(Node root,
                                                                        boolean leafsOnly,
                                                                        Class<T> elementClass)

  Returns an array of tree elements in the subtree under `root` Calling this method is equivalent to `getElementsInSubtree(root, leafsOnly, elementClass, (T[])Array.newInstance(elementClass, 0))`.

  Type Parameters:
    `T` - the type of the array to be returned
  Parameters:
    `node` - the node to which the returned elements are connected
    `c` - the class defining which elements should be returned
    `array` - the array to store the result in (defines the return type and is recreated if it is too small)
  Returns:
    the array of tree elements
  Since:
    2.0.43

### 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)`

Overview | Package | Class | Use | Tree | Deprecated | Index | Help
PREV CLASS NEXT CLASS | FRAMES NO FRAMES
SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD