| 
||||||||||
| PREV CLASS NEXT CLASS | FRAMES NO FRAMES | |||||||||
| SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD | |||||||||
java.lang.Objectinfo.bioinfweb.treegraph.document.Tree
public class Tree
Instances of this class provide an environment for the recursive data-structure of tree-elements without their formats.
| Field Summary | |
|---|---|
static float | 
DEFAULT_LONGEST_PATH_LENGTH
The default length of the longest path from the root to a leaf in millimeters.  | 
private  HashSet<ConcretePaintableElement> | 
elementSet
 | 
private  GlobalFormats | 
formats
 | 
private  Legends | 
legends
 | 
private  EnumMap<PositionPaintType,DistanceDimension> | 
paintDimensions
 | 
private  Node | 
paintStart
 | 
private  ScaleBar | 
scaleBar
 | 
static String | 
UNIQUE_NAME_CHARS
 | 
static int | 
UNIQUE_NAME_LENGTH
 | 
private  TreeMap<String,Node> | 
uniqueNameMap
 | 
| Constructor Summary | |
|---|---|
Tree()
 | 
|
| Method Summary | |
|---|---|
 void | 
assignUniqueNames()
Assigns unique names to all nodes in the tree currently without one.  | 
private  void | 
assignUniqueNamesToSubtree(Node root)
Assigns unique names to all nodes in the subtree under root currently without one.  | 
 void | 
clear()
Removes all tree elements including all legends from this object.  | 
 boolean | 
contains(ConcretePaintableElement element)
Tests if the given element is present in the tree.  | 
 boolean | 
containsDecimal(NodeBranchDataAdapter adapter)
Tests if the tree contains a node which would be able to return a decimal value to the given adapter.  | 
static boolean | 
containsDecimal(NodeBranchDataAdapter adapter,
                Node root)
Tests if the subtree under root contains a node which would be 
 able to return a decimal value to the given adapter. | 
 GlobalFormats | 
getFormats()
 | 
 Legends | 
getLegends()
 | 
static Node | 
getLinkedNode(PaintableElement element)
Returns the linked node to the given element.  | 
 Node | 
getNodeByUniqueName(String uniqueName)
Searches for a node with the given unique name in this tree.  | 
 DistanceDimension | 
getPaintDimension(PositionPaintType type)
Returns the stored paint dimension (the size of the document) for the given painter ID.  | 
 Node | 
getPaintStart()
 | 
 ScaleBar | 
getScaleBar()
 | 
 boolean | 
hasAllBranchLengths()
Tests is there are any branches without a defined length in the tree.  | 
static boolean | 
hasAllBranchLengths(Node root,
                    boolean needsRootLength)
Tests is there are any branches without a defined length in the subtree under root. | 
 boolean | 
isEmpty()
Tests if there are tree elements present.  | 
 double | 
longestPath()
Returns the longest path to a terminal in this tree.  | 
static double | 
longestPath(Node root,
            boolean includeRootBranch)
Returns the longest path to a terminal in the subtree of root. | 
static Node | 
mostRecentCommonAncestor(Node n1,
                         Node n2)
 | 
 String | 
newUniqueName()
Generates a random unique name for a node which is currently not present in this tree.  | 
 void | 
setPaintStart(Node paintStart)
 | 
 void | 
setScaleBar(ScaleBar scaleBar)
 | 
 void | 
updateElementSet()
 | 
| Methods inherited from class java.lang.Object | 
|---|
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait | 
| Field Detail | 
|---|
public static final float DEFAULT_LONGEST_PATH_LENGTH
NewickReader and 
 NexusReader).)
public static final String UNIQUE_NAME_CHARS
public static final int UNIQUE_NAME_LENGTH
private Node paintStart
private ScaleBar scaleBar
private Legends legends
private EnumMap<PositionPaintType,DistanceDimension> paintDimensions
private GlobalFormats formats
private TreeMap<String,Node> uniqueNameMap
private HashSet<ConcretePaintableElement> elementSet
| Constructor Detail | 
|---|
public Tree()
| Method Detail | 
|---|
public Node getPaintStart()
public void setPaintStart(Node paintStart)
public ScaleBar getScaleBar()
public void setScaleBar(ScaleBar scaleBar)
public Legends getLegends()
public GlobalFormats getFormats()
public boolean isEmpty()
public void clear()
public boolean contains(ConcretePaintableElement element)
element - the element to search for
public DistanceDimension getPaintDimension(PositionPaintType type)
DistanceDimension is stored
 for this ID and returned.
id - the painter ID
public String newUniqueName()
abcdefghijklmnopqrstuvwxyz01234567890. This means that 
 there are 2710 ≈ 2 • 1014 different possible names.
private void assignUniqueNamesToSubtree(Node root)
info.webinsel.treegraph.document.Tree.assignUniqueNames().
root - the root node of the subtreepublic void assignUniqueNames()
public void updateElementSet()
public Node getNodeByUniqueName(String uniqueName)
uniqueName - the searched unique name
public static Node getLinkedNode(PaintableElement element)
PaintableElement as follows:
 Node: The node itselfBranch: The target node of this branchLabel: The target node of the holding branchLegend: null
element - the element which linked node shall be returned
public static Node mostRecentCommonAncestor(Node n1, Node n2)
public static boolean hasAllBranchLengths(Node root, boolean needsRootLength)
root.
root - the root node of the treeneedsRootLength - specifies whether the root node needs a defined branch length
true, if there a no lengths missing or root was 
         null.public boolean hasAllBranchLengths()
hasAllBranchLengths(getPaintStart(), getFormats().getShowRooted()).
true, if there a no necessary lengths missingpublic static double longestPath(Node root, boolean includeRootBranch)
root. All branch lengths of
 the subtree under root must be defined except that of the root branch if 
 includeRootBranch is false.
root - the root node of the treeincludeRootBranch - indicates whether the length of the afferent branch of the root node
        shall be included
Double.NaN if not all branch lengths 
         are definedpublic double longestPath()
getFormats().getShowRooted() is false.
 If this tree is empty 0 is returned.
Double.NaN if not all branch lengths 
         are definedpublic static boolean containsDecimal(NodeBranchDataAdapter adapter, Node root)
root contains a node which would be 
 able to return a decimal value to the given adapter.
adapter - the adapter to obtain the decimal valueroot - the root of the subtree to be checked
true if at least one decimal value could be returnedpublic boolean containsDecimal(NodeBranchDataAdapter adapter)
adapter - the adapter to obtain the decimal value
true if at least one decimal value could be returned
  | 
||||||||||
| PREV CLASS NEXT CLASS | FRAMES NO FRAMES | |||||||||
| SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD | |||||||||