info.bioinfweb.treegraph.document
Class IDManager

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

public class IDManager
extends java.lang.Object


Field Summary
static java.lang.String RAND_CHARS
           
static int RAND_LENGTH
           
 
Constructor Summary
IDManager()
           
 
Method Summary
static Label getFirstLabel(Node root, java.lang.String id)
           
static java.lang.String[] getHiddenBranchDataIDs(Node root)
          Searches for all the IDs of hidden data that is assigned to a branch present in the subtree under root.
static java.util.Vector<java.lang.String> getHiddenBranchDataIDVector(Node root)
           
static java.lang.String[] getHiddenNodeDataIDs(Node root)
          Searches for all the IDs of hidden data that is assigned to a node present in the subtree under root.
static java.util.Vector<java.lang.String> getHiddenNodeDataIDVector(Node root)
           
static java.lang.String[] getIDs(Node root)
          Searches for all IDs (hidden data and label IDs) present in the subtree under root.
static java.util.Vector<java.lang.String> getIDVector(Node root)
          Searches for all IDs present in the subtree under root.
static java.lang.String[] getLabelIDs(Node root)
          Searches for all label IDs present in the subtree under root.
static java.util.Vector<java.lang.String> getLabelIDVector(Node root)
           
private static java.util.Vector<java.lang.String> getVector(Node root, boolean includeLabels, boolean includeNodeHiddenData, boolean includeBranchHiddenData)
           
static boolean idExists(Node root, java.lang.String id)
           
static java.lang.String newID(java.util.Vector<java.lang.String> ids)
           
private static void renameHiddenDataID(HiddenDataElement element, java.lang.String oldName, java.lang.String newName)
           
static void renameID(java.lang.String oldName, java.lang.String newName, Node root)
          Changes all accurences of the given ID in the subtree under root.
private static void renameLabelIDInLabelBlock(java.lang.String oldName, java.lang.String newName, Labels labels, boolean above)
           
private static void searchHiddenDataIDs(HiddenDataElement element, java.util.Vector<java.lang.String> list)
           
private static void searchIDsInSubtree(Node root, java.util.Vector<java.lang.String> list, boolean includeLabels, boolean includeNodeHiddenData, boolean includeBranchHiddenData)
           
private static void searchLabelIDsInLabelBlock(Labels labels, boolean above, java.util.Vector<java.lang.String> list)
          Adds all label IDs to the specified list.
 
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
 

Field Detail

RAND_CHARS

public static final java.lang.String RAND_CHARS
See Also:
Constant Field Values

RAND_LENGTH

public static final int RAND_LENGTH
See Also:
Constant Field Values
Constructor Detail

IDManager

public IDManager()
Method Detail

searchLabelIDsInLabelBlock

private static void searchLabelIDsInLabelBlock(Labels labels,
                                               boolean above,
                                               java.util.Vector<java.lang.String> list)
Adds all label IDs to the specified list. If one ID is present several times, it is only added once. Empty IDs ("") are not added.

Parameters:
labels -
above -
list -

searchHiddenDataIDs

private static void searchHiddenDataIDs(HiddenDataElement element,
                                        java.util.Vector<java.lang.String> list)

searchIDsInSubtree

private static void searchIDsInSubtree(Node root,
                                       java.util.Vector<java.lang.String> list,
                                       boolean includeLabels,
                                       boolean includeNodeHiddenData,
                                       boolean includeBranchHiddenData)

getIDs

public static java.lang.String[] getIDs(Node root)
Searches for all IDs (hidden data and label IDs) present in the subtree under root.

Parameters:
root - - the root node of the subtree to be searched.
Returns:
a list of all IDs (every string is contained only once)

getLabelIDs

public static java.lang.String[] getLabelIDs(Node root)
Searches for all label IDs present in the subtree under root.

Parameters:
root - - the root node of the subtree to be searched.
Returns:
a list of all IDs (every string is contained only once)

getHiddenBranchDataIDs

public static java.lang.String[] getHiddenBranchDataIDs(Node root)
Searches for all the IDs of hidden data that is assigned to a branch present in the subtree under root.

Parameters:
root - - the root node of the subtree to be searched.
Returns:
a list of all IDs (every string is contained only once)

getHiddenNodeDataIDs

public static java.lang.String[] getHiddenNodeDataIDs(Node root)
Searches for all the IDs of hidden data that is assigned to a node present in the subtree under root.

Parameters:
root - - the root node of the subtree to be searched.
Returns:
a list of all IDs (every string is contained only once)

getVector

private static java.util.Vector<java.lang.String> getVector(Node root,
                                                            boolean includeLabels,
                                                            boolean includeNodeHiddenData,
                                                            boolean includeBranchHiddenData)

getIDVector

public static java.util.Vector<java.lang.String> getIDVector(Node root)
Searches for all IDs present in the subtree under root.

Parameters:
root - - the root node of the subtree to be searched.
Returns:
a list of all IDs (every string is contained only once)

getLabelIDVector

public static java.util.Vector<java.lang.String> getLabelIDVector(Node root)

getHiddenBranchDataIDVector

public static java.util.Vector<java.lang.String> getHiddenBranchDataIDVector(Node root)

getHiddenNodeDataIDVector

public static java.util.Vector<java.lang.String> getHiddenNodeDataIDVector(Node root)

renameLabelIDInLabelBlock

private static void renameLabelIDInLabelBlock(java.lang.String oldName,
                                              java.lang.String newName,
                                              Labels labels,
                                              boolean above)

renameHiddenDataID

private static void renameHiddenDataID(HiddenDataElement element,
                                       java.lang.String oldName,
                                       java.lang.String newName)

renameID

public static void renameID(java.lang.String oldName,
                            java.lang.String newName,
                            Node root)
Changes all accurences of the given ID in the subtree under root.

Parameters:
root - - the root node of the subtree where the renaming should take place

newID

public static java.lang.String newID(java.util.Vector<java.lang.String> ids)

getFirstLabel

public static Label getFirstLabel(Node root,
                                  java.lang.String id)

idExists

public static boolean idExists(Node root,
                               java.lang.String id)