java.lang.Object
org.klomp.snark.web.Sorters.Sort
org.klomp.snark.web.Sorters.StatusComparator
- All Implemented Interfaces:
Serializable, Comparator<Snark>
- Enclosing class:
Sorters
Orders torrents by their download state.
Field Summary
FieldsModifier and TypeFieldDescriptionprivate static final longFixed id, the comparator is never serialized across versions.Constructor Summary
ConstructorsModifierConstructorDescriptionprivateStatusComparator(boolean rev, String lang) Creates the state comparator.Method Summary
Modifier and TypeMethodDescription(package private) static intCompare two torrents by status, with ties broken by swarm size for idle, inactive and magnet states, otherwise by active peer count.intCompare two torrents on the subclass's column, falling back to name order.(package private) static intGives the sort rank for a torrent's state.private static intgetStatusImpl(Snark snark) Computes the state rank, stopped torrents offset.Methods inherited from class Sorters.Sort
compare, compLongMethods 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 comparator is never serialized across versions.- See Also:
Constructor Details
StatusComparator
Creates the state comparator.- Parameters:
rev- true to reverse the orderlang- the language whose collation to use
Method Details
compareIt
Description copied from class:Sorters.SortCompare two torrents on the subclass's column, falling back to name order.- Specified by:
compareItin classSorters.Sort- Parameters:
l- the left-hand torrent to comparer- the right-hand torrent to compare- Returns:
- negative, zero or positive as l sorts before, with or after r
comp
getStatus
Gives the sort rank for a torrent's state.- Parameters:
snark- the torrent to rank- Returns:
- its state rank
getStatusImpl
Computes the state rank, stopped torrents offset.- Parameters:
snark- the torrent to rank- Returns:
- its state rank