ahc.util
Class VarDirectionComparator
java.lang.Object
|
+--ahc.util.VarDirectionComparator
- All Implemented Interfaces:
- java.util.Comparator
- public class VarDirectionComparator
- extends java.lang.Object
- implements java.util.Comparator
This class provides a decorator for another Comparator that allows inverting the direction of the
resulting sorting.
For example, a normal Collator provides lexical ordering (placing 'a' before 'b' etc.). Using this
decorator class, it becomes possible to switch between this normal ordering and its inverse (placing 'b'
before 'a').
This class is particularly useful in the context of user interfaces where the user may want to control
the sort order of a table interactively.
- Author:
- Arno Haase
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 |
VarDirectionComparator
public VarDirectionComparator(java.util.Comparator inner)
VarDirectionComparator
public VarDirectionComparator(java.util.Comparator inner,
boolean dirInverted)
compare
public int compare(java.lang.Object o1,
java.lang.Object o2)
- Specified by:
compare
in interface java.util.Comparator
isDirInverted
public boolean isDirInverted()
setDirInverted
public void setDirInverted(boolean dirInverted)
toggleDirection
public void toggleDirection()