Class TemporalResultComparator

java.lang.Object
ddf.catalog.util.impl.TemporalResultComparator
All Implemented Interfaces:
Comparator<ddf.catalog.data.Result>

public class TemporalResultComparator extends Object implements Comparator<ddf.catalog.data.Result>
Comparator for the temporal attribute of 2 Result objects.
  • 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:
      compare in interface Comparator<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