Package ddf.catalog.util.impl
Class RelevanceResultComparator
java.lang.Object
ddf.catalog.util.impl.RelevanceResultComparator
- All Implemented Interfaces:
Comparator<ddf.catalog.data.Result>
public class RelevanceResultComparator
extends Object
implements Comparator<ddf.catalog.data.Result>
Comparator for the relevance of 2
Result objects.-
Constructor Summary
ConstructorsConstructorDescriptionRelevanceResultComparator(org.geotools.api.filter.sort.SortOrder relevanceOrder) Constructs the comparator with the specified sort order, either relevance ascending or relevance descending. -
Method Summary
Modifier and TypeMethodDescriptionintcompare(ddf.catalog.data.Result contentA, ddf.catalog.data.Result contentB) Compares the relevance 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
-
RelevanceResultComparator
public RelevanceResultComparator(org.geotools.api.filter.sort.SortOrder relevanceOrder) Constructs the comparator with the specified sort order, either relevance ascending or relevance descending.- Parameters:
relevanceOrder- the relevance sort order
-
-
Method Details
-
compare
public int compare(ddf.catalog.data.Result contentA, ddf.catalog.data.Result contentB) Compares the relevance 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 relevance and A > B; -1 if ascending relevance and B > A -1 if descending relevance and A > B; 1 if descending relevance and B > A
-