|
|||||||||
PREV CLASS NEXT CLASS | FRAMES NO FRAMES | ||||||||
SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD |
java.lang.Objectde.tkuhn.util.OrderComparator<T>
public class OrderComparator<T>
This class defines a Comparator
that is a wrapper for other
Comparator
s an can change the order of their comparisons.
Comparator
Field Summary | |
---|---|
static boolean |
ASCENDING
Ascending compare order |
static boolean |
DESCENDING
Descending compare order |
Constructor Summary | |
---|---|
OrderComparator()
Creates a new instance of OrderComparator using ascending order |
|
OrderComparator(boolean order)
Creates a new instance of OrderComparator using the given order. |
|
OrderComparator(java.util.Comparator<T> comparator)
Creates a new instance of OrderComparator using ascending order, delegating to the given Comparator. |
|
OrderComparator(java.util.Comparator<T> comparator,
boolean order)
Creates a new instance of OrderComparator using the given order, delegating to the given Comparator. |
Method Summary | |
---|---|
int |
compare(T o1,
T o2)
Implementation of compare(obj,obj) in the interface
java.util.Comparator . |
java.util.Comparator<T> |
getComparator()
Get the Comparator that is wrapped by this OrderComparator. |
boolean |
getOrder()
Get the order this wrapper uses to transform the comparisons to. |
void |
setComparator(java.util.Comparator<T> comparator)
Set the Comparator that will be wrapped by this OrderComparator. |
void |
setOrder(boolean order)
Set the order this wrapper will use to transform the comparisons to. |
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 |
Field Detail |
---|
public static final boolean ASCENDING
public static final boolean DESCENDING
Constructor Detail |
---|
public OrderComparator()
public OrderComparator(boolean order)
order
- transform comparisons to this orderpublic OrderComparator(java.util.Comparator<T> comparator)
comparator
- Comparator to delegate comparisons topublic OrderComparator(java.util.Comparator<T> comparator, boolean order)
comparator
- Comparator to delegate comparisons toorder
- transform comparisons to this orderMethod Detail |
---|
public java.util.Comparator<T> getComparator()
public void setComparator(java.util.Comparator<T> comparator)
comparator
- New value of property comparator.public int compare(T o1, T o2) throws java.lang.IllegalStateException
compare(obj,obj)
in the interface
java.util.Comparator
.
compare
in interface java.util.Comparator<T>
o1
- row one to be comparedo2
- row two to be compared
java.lang.IllegalStateException
- if no comparator for delegation is set.public boolean getOrder()
public void setOrder(boolean order)
order
- New value of property order.
|
|||||||||
PREV CLASS NEXT CLASS | FRAMES NO FRAMES | ||||||||
SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD |