Package ddf.catalog.util.impl
Class TemporalResultComparator
java.lang.Object
ddf.catalog.util.impl.TemporalResultComparator
- All Implemented Interfaces:
Comparator<ddf.catalog.data.Result>
Comparator for the temporal attribute of 2
Result objects.-
Constructor Summary
ConstructorsConstructorDescriptionTemporalResultComparator(org.geotools.api.filter.sort.SortOrder sortOrder) Constructs the comparator with the specified sort order, either temporal ascending or temporal descending.TemporalResultComparator(org.geotools.api.filter.sort.SortOrder sortOrder, String temporalAttribute) Constructs the comparator with the specified sort order, either temporal ascending or temporal descending and the Attribute Name to sort on. -
Method Summary
Modifier and TypeMethodDescriptionintcompare(ddf.catalog.data.Result contentA, ddf.catalog.data.Result contentB) Compares the effective date 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
-
TemporalResultComparator
public TemporalResultComparator(org.geotools.api.filter.sort.SortOrder sortOrder) Constructs the comparator with the specified sort order, either temporal ascending or temporal descending.- Parameters:
sortOrder- the temporal sort order, if null is passed in, then the default SortOrder applies, which is SortOrder.DESCENDING.
-
TemporalResultComparator
public TemporalResultComparator(org.geotools.api.filter.sort.SortOrder sortOrder, String temporalAttribute) Constructs the comparator with the specified sort order, either temporal ascending or temporal descending and the Attribute Name to sort on.- Parameters:
sortOrder- the temporal sort order, if null is passed in, then the default SortOrder applies, which is SortOrder.DESCENDING.temporalAttribute- the name of the attribute to sort on. Default is Metacard.EFFECTIVE
-
-
Method Details
-
compare
public int compare(ddf.catalog.data.Result contentA, ddf.catalog.data.Result contentB) Compares the effective date 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 temporal ascending and A > B; -1 if temporal ascending and B > A -1 if temporal descending and A > B; 1 if temporal descending and B > A
-