Package ddf.catalog.util.impl
Class DistanceResultComparator
java.lang.Object
ddf.catalog.util.impl.DistanceResultComparator
- All Implemented Interfaces:
Comparator<ddf.catalog.data.Result>
Comparator for the distance (in meters) of 2
Result objects.-
Constructor Summary
ConstructorsConstructorDescriptionDistanceResultComparator(org.geotools.api.filter.sort.SortOrder distanceOrder) Constructs the comparator with the specified sort order, either distance ascending or distance descending. -
Method Summary
Modifier and TypeMethodDescriptionintcompare(ddf.catalog.data.Result contentA, ddf.catalog.data.Result contentB) Compares the distance (in meters) between the two results.Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, waitMethods inherited from interface java.util.Comparator
equals, reversed, thenComparing, thenComparing, thenComparing, thenComparingDouble, thenComparingInt, thenComparingLong
-
Constructor Details
-
DistanceResultComparator
public DistanceResultComparator(org.geotools.api.filter.sort.SortOrder distanceOrder) Constructs the comparator with the specified sort order, either distance ascending or distance descending.- Parameters:
distanceOrder- the distance sort order
-
-
Method Details
-
compare
public int compare(ddf.catalog.data.Result contentA, ddf.catalog.data.Result contentB) Compares the distance (in meters) between the two results.- Specified by:
comparein interfaceComparator<ddf.catalog.data.Result>- Returns:
- 1 if A is null and B is non-null -1 if A is non-null and B is null 0 if both A and B are null 1 if ascending sort order and A > B; -1 if ascending sort order and B > A -1 if descending sort order and A > B; 1 if descending sort order and B > A
-