Class RouteModelComparators
java.lang.Object
slash.navigation.converter.gui.comparators.RouteModelComparators
Creates
Comparators that sort the RouteModels of the browse routes table
when a column header is clicked. Name and creator sort case-insensitively with missing
values (via Comparator.nullsLast(java.util.Comparator<? super T>)) sorting last; length and duration sort numerically
on the underlying DistanceAndTime metadata.
Missing length/duration values (rendered as –) rank as the largest value. A
TableRowSorter negates the comparator for the descending order,
so missing rows sort last ascending and first descending; treating an
unknown value as the maximum is the intended, consistent semantic here. Pinning missing
values last in both directions is not achievable through a plain Comparator (the
row sorter negates the result after the comparator returns) without subclassing the row
sorter's internals, so it is deliberately not attempted.- Author:
- Christian Pesch
-
Constructor Summary
Constructors -
Method Summary
Modifier and TypeMethodDescriptionstatic Comparator<RouteModel> static Comparator<RouteModel> byDistance(RouteMetadataSource source) static Comparator<RouteModel> byDuration(RouteMetadataSource source) static Comparator<RouteModel> byName()
-
Constructor Details
-
RouteModelComparators
public RouteModelComparators()
-
-
Method Details
-
byName
-
byCreator
-