|
||||||||||
PREV CLASS NEXT CLASS | FRAMES NO FRAMES | |||||||||
SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD |
java.lang.Object com.metamatrix.query.processor.relational.ListNestedSortComparator
public class ListNestedSortComparator
This class can be used for comparing lists of elements, when the fields to be sorted on and the comparison mechanism are dynamically specified.
Typically, the lists are records in a collection that is to be sorted.
Records... { "a1", "b1", "c1" } { "a1", "b1", "c2" } { "a1", "b2", "c1" } { "a1", "b2", "c2" } { "a2", "b1", "c1" } { "a2", "b1", "c2" } { "a2", "b2", "c1" } { "a2", "b2", "c2" } Records sorted in ascending order on columns 0, 2... { "a1", "b1", "c1" } { "a1", "b2", "c1" } { "a1", "b2", "c2" } { "a1", "b1", "c2" } { "a2", "b1", "c1" } { "a2", "b2", "c1" } { "a2", "b1", "c2" } { "a2", "b2", "c2" }
Constructor Summary | |
---|---|
ListNestedSortComparator(int[] sortParameters)
Constructs an instance of this class given the indicies of the parameters to sort on, and whether the sort should be in ascending or descending order. |
|
ListNestedSortComparator(int[] sortParameters,
boolean ascending)
Constructs an instance of this class given the indicies of the parameters to sort on, and whether the sort should be in ascending or descending order. |
|
ListNestedSortComparator(int[] sortParameters,
java.util.List orderTypes)
Constructs an instance of this class given the indicies of the parameters to sort on, and orderList used to determine the order in which each column is sorted. |
Method Summary | |
---|---|
int |
compare(java.lang.Object o1,
java.lang.Object o2)
Compares its two arguments for order. |
boolean |
isDistinct()
|
void |
setDistinctIndex(int distinctIndex)
|
Methods inherited from class java.lang.Object |
---|
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait |
Methods inherited from interface java.util.Comparator |
---|
equals |
Constructor Detail |
---|
public ListNestedSortComparator(int[] sortParameters)
public ListNestedSortComparator(int[] sortParameters, boolean ascending)
public ListNestedSortComparator(int[] sortParameters, java.util.List orderTypes)
Method Detail |
---|
public boolean isDistinct()
public void setDistinctIndex(int distinctIndex)
public int compare(java.lang.Object o1, java.lang.Object o2)
The compare
method returns
compare
in interface java.util.Comparator
o1
- The first object being comparedo2
- The second object being compared
|
||||||||||
PREV CLASS NEXT CLASS | FRAMES NO FRAMES | |||||||||
SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD |