|
||||||||||
PREV CLASS NEXT CLASS | FRAMES NO FRAMES | |||||||||
SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD |
java.lang.Objectinfo.bioinfweb.treegraph.document.TreeSerializer
public class TreeSerializer
Utility class that is able to serialize tree elements in several ways.
Constructor Summary | |
---|---|
TreeSerializer()
|
Method Summary | ||
---|---|---|
private static
|
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
|
getElementsInSubtree(Node root,
boolean leafsOnly,
Class<? extends PaintableElement> elementClass,
T[] array)
Returns an array of tree elements in the subtree under root |
|
static
|
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
|
getElementsOnNode(Node node,
Class<? extends PaintableElement> c,
T[] array)
Returns an array of tree elements linked to the specified node. |
|
static
|
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 |
---|
public TreeSerializer()
Method Detail |
---|
private static void addLabelBlock(Vector<PaintableElement> list, Labels labels, boolean above)
private static <T extends PaintableElement> void addElementsOnNode(List<PaintableElement> list, Node node, Class<T> c)
public static <T extends PaintableElement> T[] getElementsOnNode(Node node, Class<? extends PaintableElement> c, T[] array)
T
- the type of the array to be returnednode
- the node to which the returned elements are connectedc
- the class defining which elements should be returnedarray
- the array to store the result in (defines the return type and is recreated if it is too small)
public static <T extends PaintableElement> T[] getElementsOnNode(Node node, Class<T> c)
getElementsOnNode(node, c, (T[])Array.newInstance(c, 0))
.
T
- the type of the array to be returnednode
- the node to which the returned elements are connectedc
- the class defining which elements should be returned
private static void addSubtree(Vector<PaintableElement> list, Node root, boolean leafsOnly, Class<? extends PaintableElement> elementClass)
public static <T extends PaintableElement> T[] getElementsInSubtree(Node root, boolean leafsOnly, Class<? extends PaintableElement> elementClass, T[] array)
root
T
- the type of the array to be returnednode
- the node to which the returned elements are connectedc
- the class defining which elements should be returnedarray
- the array to store the result in (defines the return type and is recreated if it is too small)
public static <T extends PaintableElement> T[] getElementsInSubtree(Node root, boolean leafsOnly, Class<T> elementClass)
root
Calling this method is equivalent to
getElementsInSubtree(root, leafsOnly, elementClass, (T[])Array.newInstance(elementClass, 0))
.
T
- the type of the array to be returnednode
- the node to which the returned elements are connectedc
- the class defining which elements should be returnedarray
- the array to store the result in (defines the return type and is recreated if it is too small)
private static void addLeafNodesBetween(Vector<Node> list, Node root, int level, TreePath upperPath, TreePath lowerPath)
public static Node[] getLeafNodesBetween(Node upperLeaf, Node lowerLeaf)
private static void getLabelsWithIDInBlock(Vector<Label> list, Labels labels, boolean above, String id)
private static void addLabelsWithID(Vector<Label> list, Node root, String id)
public static Label[] getLabelsWithID(Node root, String id)
public static Legend[] getLegendsInSubtree(Tree tree, Node root)
root
.
tree
- the tree that cotains the legends and root
root
- the root node of the subtree
IllegalArgumentException
- if root
is not contained in tree
.Node.containedInSubtree(ConcretePaintableElement)
|
||||||||||
PREV CLASS NEXT CLASS | FRAMES NO FRAMES | |||||||||
SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD |