public class IlrDefaultTreeSorter extends java.lang.Object implements IlrTreeSorter
IlrTreeSorter class.
IlrTreeSorter| Constructor and Description |
|---|
IlrDefaultTreeSorter()
Creates a tree sorter with no comparator.
|
IlrDefaultTreeSorter(java.util.Comparator<java.lang.String> comparator)
Creates a tree sorter with a comparator.
|
| Modifier and Type | Method and Description |
|---|---|
int |
category(IlrTreeNode node)
Returns the category of a node.
|
int |
compare(IlrTreeController controller,
IlrTreeNode node1,
IlrTreeNode node2,
boolean ignoreCase)
Returns a negative, zero, or positive number depending on whether the first element is less than, equal to, or greater than the second element.
|
protected java.util.Comparator<java.lang.String> |
getComparator()
Returns a comparator.
|
public IlrDefaultTreeSorter()
IlrDefaultTreeSorter(Comparator)public IlrDefaultTreeSorter(java.util.Comparator<java.lang.String> comparator)
comparator - The comparator.public int category(IlrTreeNode node)
IlrTreeSorterA common use is to categorize the node to optimize the sorting.
category in interface IlrTreeSorternode - The node.protected java.util.Comparator<java.lang.String> getComparator()
null if no comparator has been set.Comparatorpublic int compare(IlrTreeController controller, IlrTreeNode node1, IlrTreeNode node2, boolean ignoreCase)
Note: The ignoreCase argument is relevant in case of string comparisons.
The method returns a negative or positive number depending on whether the first category is less than or greater than the second category.
If the categories are equal, the comparison is done on the label of the nodes according to a comparator.
If no comparator is specified, the compare method of java.lang.String is called.
Note: If specified in the tree controller, the labels of the nodes are computed with the tree label provider if specified. Otherwise the IlrTreeNode.getLabel() is called.
compare in interface IlrTreeSortercontroller - The tree controller.node1 - The first node.node2 - The second node.ignoreCase - true if the method should not be case sensitive, and false otherwise.© Copyright IBM Corp. 1987, 2017