Home / Development / Documentation / 2.0.44 / IDManager
TreeGraph 2
 


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 TextElementData getDataByID(Node node, String id)
          Returns the text element data specified by the given ID which is linked to this node (either from a text label, hidden node data or hidden branch data).
static IconLabel getFirstIconLabel(Node root, String id)
          Returns the first icon label with the specified ID to be found in the subtree under root.
static Label getFirstLabel(Node root, String id)
          Returns the first label with the specified ID to be found in the subtree under root.
static TextLabel getFirstTextLabel(Node root, String id)
          Returns the first text label with the specified ID to be found in the subtree under root.
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, Tree tree)
          Renames a data ID in the specified tree and updates possible links to this ID in pie chart labels.
private static void renameIDSubtree(String oldName, String newName, Node root)
          Changes all occurrences 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.
private static void updatePieChartLabels(String oldName, String newName, Node root)
          Updates the renamed ID if it is referenced by pie chart label in the subtree under root.
 
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)

renameIDSubtree

private static void renameIDSubtree(String oldName,
                                    String newName,
                                    Node root)
Changes all occurrences of the given ID in the subtree under root.

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

updatePieChartLabels

private static void updatePieChartLabels(String oldName,
                                         String newName,
                                         Node root)
Updates the renamed ID if it is referenced by pie chart label in the subtree under root.

Parameters:
oldName - the current ID
newName - the new ID
root - the root of the subtree to be updated

renameID

public static void renameID(String oldName,
                            String newName,
                            Tree tree)
Renames a data ID in the specified tree and updates possible links to this ID in pie chart labels.

Parameters:
oldName - the current ID
newName - the new ID
tree - the tree to rename the IDs in

newID

public static String newID(Vector<String> ids)

getDataByID

public static TextElementData getDataByID(Node node,
                                          String id)
Returns the text element data specified by the given ID which is linked to this node (either from a text label, hidden node data or hidden branch data). (The subtree is not searched.)

Parameters:
node - the node to which the returned value is linked
Returns:
the data or null of the specified ID is not present
Since:
2.0.43

getFirstLabel

public static Label getFirstLabel(Node root,
                                  String id)
Returns the first label with the specified ID to be found in the subtree under root.

Parameters:
root -
id -
Returns:

getFirstTextLabel

public static TextLabel getFirstTextLabel(Node root,
                                          String id)
Returns the first text label with the specified ID to be found in the subtree under root.

Parameters:
root -
id -
Returns:

getFirstIconLabel

public static IconLabel getFirstIconLabel(Node root,
                                          String id)
Returns the first icon label with the specified ID to be found in the subtree under root.

Parameters:
root -
id -
Returns:

idExists

public static boolean idExists(Node root,
                               String id)