info.bioinfweb.treegraph.document
Class IDManager

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

public class IDManager
extends Object


Field Summary
static String RAND_CHARS
           
static int RAND_LENGTH
           
private static Comparator<String> STRING_COMPARATOR
           
 
Constructor Summary
IDManager()
           
 
Method Summary
static boolean containsIDElements(Node root)
          Test whether the subtree under root contains at least one ID element (label or hidden data)
static IconLabel getFirstIconLabel(Node root, String id)
           
static Label getFirstLabel(Node root, String id)
           
static TextLabel getFirstTextLabel(Node root, String id)
           
static 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 Vector<String> getHiddenBranchDataIDVector(Node root)
           
static 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 Vector<String> getHiddenNodeDataIDVector(Node root)
           
static Vector<String> getIconLabelIDVector(Node root)
           
static String[] getIDs(Node root)
          Searches for all IDs (hidden data and label IDs) present in the subtree under root.
static Vector<String> getIDVector(Node root)
          Searches for all IDs present in the subtree under root.
static String[] getLabelIDs(Node root)
          Searches for all label IDs present in the subtree under root.
static Vector<String> getLabelIDVector(Node root)
           
static String[] getTextLabelIDs(Node root)
           
static Vector<String> getTextLabelIDVector(Node root)
           
private static Vector<String> getVector(Node root, boolean includeTextLabels, boolean includeIconLabels, boolean includeNodeHiddenData, boolean includeBranchHiddenData)
          Returns a vector of IDs which is sorted alphabetically.
static boolean idExists(Node root, String id)
           
static String newID(Vector<String> ids)
           
private static void renameHiddenDataID(HiddenDataElement element, String oldName, String newName)
           
static void renameID(String oldName, String newName, Node root)
          Changes all accurences of the given ID in the subtree under root.
private static void renameLabelIDInLabelBlock(String oldName, String newName, Labels labels, boolean above)
           
private static void searchHiddenDataIDs(HiddenDataElement element, Vector<String> list)
           
private static void searchIDsInSubtree(Node root, Vector<String> list, boolean includeTextLabels, boolean includeIconLabels, boolean includeNodeHiddenData, boolean includeBranchHiddenData)
           
private static void searchLabelIDsInLabelBlock(Labels labels, boolean above, boolean includeTextLabels, boolean includeIconLabels, Vector<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 String RAND_CHARS
See Also:
Constant Field Values

RAND_LENGTH

public static final int RAND_LENGTH
See Also:
Constant Field Values

STRING_COMPARATOR

private static final Comparator<String> STRING_COMPARATOR
Constructor Detail

IDManager

public IDManager()
Method Detail

searchLabelIDsInLabelBlock

private static void searchLabelIDsInLabelBlock(Labels labels,
                                               boolean above,
                                               boolean includeTextLabels,
                                               boolean includeIconLabels,
                                               Vector<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,
                                        Vector<String> list)

searchIDsInSubtree

private static void searchIDsInSubtree(Node root,
                                       Vector<String> list,
                                       boolean includeTextLabels,
                                       boolean includeIconLabels,
                                       boolean includeNodeHiddenData,
                                       boolean includeBranchHiddenData)

getIDs

public static 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)

containsIDElements

public static boolean containsIDElements(Node root)
Test whether the subtree under root contains at least one ID element (label or hidden data)

Parameters:
root -
Returns:
true if an ID element was found

getLabelIDs

public static 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)

getTextLabelIDs

public static String[] getTextLabelIDs(Node root)

getHiddenBranchDataIDs

public static 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 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 Vector<String> getVector(Node root,
                                        boolean includeTextLabels,
                                        boolean includeIconLabels,
                                        boolean includeNodeHiddenData,
                                        boolean includeBranchHiddenData)
Returns a vector of IDs which is sorted alphabetically.

Parameters:
root -
includeLabels -
includeNodeHiddenData -
includeBranchHiddenData -
Returns:

getIDVector

public static Vector<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 Vector<String> getLabelIDVector(Node root)

getTextLabelIDVector

public static Vector<String> getTextLabelIDVector(Node root)

getIconLabelIDVector

public static Vector<String> getIconLabelIDVector(Node root)

getHiddenBranchDataIDVector

public static Vector<String> getHiddenBranchDataIDVector(Node root)

getHiddenNodeDataIDVector

public static Vector<String> getHiddenNodeDataIDVector(Node root)

renameLabelIDInLabelBlock

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

renameHiddenDataID

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

renameID

public static void renameID(String oldName,
                            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 String newID(Vector<String> ids)

getFirstLabel

public static Label getFirstLabel(Node root,
                                  String id)

getFirstTextLabel

public static TextLabel getFirstTextLabel(Node root,
                                          String id)

getFirstIconLabel

public static IconLabel getFirstIconLabel(Node root,
                                          String id)

idExists

public static boolean idExists(Node root,
                               String id)