|
||||||||||
PREV CLASS NEXT CLASS | FRAMES NO FRAMES | |||||||||
SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD |
java.lang.Object edu.nrao.sss.sort.CompoundComparator<T>
public class CompoundComparator<T>
A comparator
that is a chain of other comparators.
The first comparator in this one's list functions as the primary key, the next as a secondary key (in case of a tie in primary keys), and so on.
Rather than wrapping its internal list, this comparator provides its list of components for its clients to access directly.
Version Info:
$Revision: 593 $ |
$Date: 2007-05-07 15:54:14 -0600 (Mon, 07 May 2007) $ |
$Author: dharland $ |
Constructor Summary | |
---|---|
CompoundComparator()
Creates a new instance with no contained comparators. |
|
CompoundComparator(Collection<? extends Comparator<T>> newComparators)
Creates a new compound comparator with the given elements. |
|
CompoundComparator(Comparator<T>... newComparators)
Creates a new compound comparator with the given elements. |
Method Summary | |
---|---|
int |
compare(T o1,
T o2)
|
List<Comparator<T>> |
getComponents()
Returns the list of component comparators held by this one. |
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 CompoundComparator()
public CompoundComparator(Comparator<T>... newComparators)
newComparators
- the comparators held by this one.public CompoundComparator(Collection<? extends Comparator<T>> newComparators)
newComparators
- the comparators held by this one.Method Detail |
---|
public List<Comparator<T>> getComponents()
The returned list is the one actually held by this comparator. Clients who wish to add, remove, or otherwise manipulate the components, or their status in the list, should work directly with this list.
public int compare(T o1, T o2)
compare
in interface Comparator<T>
|
||||||||||
PREV CLASS NEXT CLASS | FRAMES NO FRAMES | |||||||||
SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD |