java.lang.Object
org.klomp.snark.web.Sorters.FAISort
- All Implemented Interfaces:
Serializable, Comparator<Sorters.FileAndIndex>
- Direct Known Subclasses:
Sorters.FAIPriorityComparator, Sorters.FAIRemainingComparator, Sorters.FAISizeComparator, Sorters.FAITypeComparator
- Enclosing class:
Sorters
private abstract static class Sorters.FAISortextends Object implements Comparator<Sorters.FileAndIndex>, Serializable
Forward or reverse sort, but the fallback is always forward.
Field Summary
FieldsModifier and TypeFieldDescriptionprivate final booleanTrue to reverse the order.private static final longFixed id, the sorter is never serialized across versions.Constructor Summary
ConstructorsMethod Summary
Modifier and TypeMethodDescriptionintprotected abstract intCompare two file/index entries.protected static intcompLong(long l, long r) Compares two longs without overflow.Methods inherited from class Object
clone, equals, getClass, hashCode, notify, notifyAll, toString, wait, wait, waitMethods inherited from interface Comparator
equals, max, min, reversed, thenComparing, thenComparing, thenComparing, thenComparingDouble, thenComparingInt, thenComparingLong
Field Details
serialVersionUID
private static final long serialVersionUIDFixed id, the sorter is never serialized across versions.- See Also:
_rev
private final boolean _revTrue to reverse the order.
Constructor Details
FAISort
public FAISort(boolean rev) Creates a file sorter for one direction.- Parameters:
rev- true to reverse the order
Method Details
compare
- Specified by:
comparein interfaceComparator<Sorters.FileAndIndex>
compareIt
Compare two file/index entries.- Parameters:
l- the first entryr- the second entry- Returns:
- the order of the two entries
compLong
protected static int compLong(long l, long r) Compares two longs without overflow.- Parameters:
l- the first valuer- the second value- Returns:
- negative, zero or positive as l is less, equal or greater