dsto.dfc.databeans
Class CategorySorter<T>
java.lang.Object
dsto.dfc.databeans.CategorySorter<T>
- All Implemented Interfaces:
- ISorter<T>, Comparator<T>
public abstract class CategorySorter<T>
- extends Object
- implements ISorter<T>
A sorter that makes it easier when sorting items in category, value
order. Subclasses define numeric categories for values that are
used as the first order sorting criteria. Values for equal
categories are sorted by value as usual.
- Author:
- Matthew Phillips
Methods inherited from class java.lang.Object |
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait |
CategorySorter
public CategorySorter()
compare
public int compare(T o1,
T o2)
- Description copied from interface:
ISorter
- See
Comparator.compare(Object, Object)
.
- Specified by:
compare
in interface ISorter<T>
- Specified by:
compare
in interface Comparator<T>
affectsOrder
public abstract boolean affectsOrder(PropertyPath path)
- Description copied from interface:
ISorter
- Return true if a change to a given path might affect the sort
order of the object at the root of the path. This is an
opportunity for optimization: simply returning true will work
at the cost of some wasted ovehead.
- Specified by:
affectsOrder
in interface ISorter<T>
compareValues
protected abstract int compareValues(T item1,
T item2)
- Compare two values that are in the same category. This will
usually be the same as
compare(Object, Object)
in a
non-category sorter.
category
protected abstract int category(T item)
- Generate a numeric category for a given item. Items are sorted in
category, value order.
Copyright © 2008 Commonwealth of Australia