Class TLcdOGCSortBy

java.lang.Object
com.luciad.datamodel.TLcdDataObject
com.luciad.ogc.filter.model.TLcdOGCSortBy
All Implemented Interfaces:
ILcdDataObject, ILcdOGCSortBy, ILcdCloneable, ILcdDeepCloneable, Cloneable

public class TLcdOGCSortBy extends TLcdDataObject implements ILcdOGCSortBy

This class represents the <ogc:SortBy> element.

The <ogc:SortBy> element contains a list of properties that must be taken into account for sorting.

You can easily create instances using the comparing(com.luciad.ogc.filter.model.TLcdOGCPropertyName) and thenComparing(com.luciad.ogc.filter.model.TLcdOGCPropertyName) factory methods.

Example:


   TLcdOGCSortBy sortBy = comparing(property("AGE"), DESC).thenComparing(property("NAME"));
 

Note that while instances of this class are mutable, you should not modify them once in use.

  • Constructor Details

  • Method Details

    • insertSortPropertyAt

      public void insertSortPropertyAt(TLcdOGCSortProperty aSortProperty, int aIndex)
      Inserts a sort property at a given position.
      Parameters:
      aSortProperty - the sort property to be inserted.
      aIndex - the index of the given position.
    • getSortProperties

      public List<TLcdOGCSortProperty> getSortProperties()
      Returns the list of sort properties.
      Returns:
      the list of sort properties
    • addSortProperty

      public void addSortProperty(TLcdOGCSortProperty aSortProperty)
      Adds a sort property.
      Parameters:
      aSortProperty - the sort property to be added.
    • getSortPropertyCount

      public int getSortPropertyCount()
      Gets the number of sort properties.
      Returns:
      the number of sort properties.
    • removeSortProperty

      public boolean removeSortProperty(TLcdOGCSortProperty aSortProperty)
      Removes a given sort property.
      Parameters:
      aSortProperty - the sort property to be removed.
      Returns:
      true if the argument was a sort property of the list; false otherwise.
    • getSortProperty

      public TLcdOGCSortProperty getSortProperty(int aIndex)
      Gets the sort property at a given position.
      Parameters:
      aIndex - the index of the given position.
      Returns:
      the sort property.
    • equals

      public boolean equals(Object obj)
      Overrides:
      equals in class Object
    • hashCode

      public int hashCode()
      Overrides:
      hashCode in class Object
    • toString

      public String toString()
      Overrides:
      toString in class TLcdDataObject
    • comparing

      public static TLcdOGCSortBy comparing(TLcdOGCPropertyName aPropertyName)
      Create a "sort by" based on the given property.

      The sort order is ascending.

      You can sort on multiple properties by chaining with thenComparing(com.luciad.ogc.filter.model.TLcdOGCPropertyName).

      Example:

      
         TLcdOGCSortBy sortBy = comparing(property("AGE")).thenComparing(property("NAME"));
       
      Parameters:
      aPropertyName - The property to sort on
      Returns:
      A sort-by that sorts on the given property, ascending.
      Since:
      2017.0
      See Also:
    • comparing

      public static TLcdOGCSortBy comparing(TLcdOGCPropertyName aPropertyName, int aSortOrder)
      Create a "sort by" based on the given property.

      You can sort on multiple properties by chaining with thenComparing(com.luciad.ogc.filter.model.TLcdOGCPropertyName).

      Example:

      
         TLcdOGCSortBy sortBy = comparing(property("AGE"), DESC).thenComparing(property("NAME"));
       
      Parameters:
      aPropertyName - The property name to sort on
      aSortOrder - The sorting order, must be ASC or DESC.
      Returns:
      A sort-by that sorts on the given property.
      Since:
      2017.0
      See Also:
    • thenComparing

      public final TLcdOGCSortBy thenComparing(TLcdOGCPropertyName aPropertyName)
      Create a new "sort by" that first sorts using this sort-by, then on the given property when two elements are considered equal by this sort-by.

      Example:

      
         TLcdOGCSortBy sortBy = comparing(property("AGE")).thenComparing(property("NAME"));
       
      Parameters:
      aPropertyName - The property to sort on (ascending) after sorting on this sort-by.
      Returns:
      A new sort-by.
      Since:
      2017.0
      See Also:
    • thenComparing

      public final TLcdOGCSortBy thenComparing(TLcdOGCPropertyName aPropertyName, int aSortOrder)
      Create a new "sort by" that first sorts using this sort-by, then on the given property when two elements are considered equal by this sort-by.

      Example:

      
         TLcdOGCSortBy sortBy = comparing(property("NAME")).thenComparing(property("AGE"), DESC);
       
      Parameters:
      aPropertyName - The property to sort on, if the existing sorting order is indeterminate.
      Returns:
      A new sort-by.
      Since:
      2017.0
    • asComparator

      public final Comparator<Object> asComparator(TLcdOGCFilterContext aFilterContext)
      Builds a comparator that can be used to sort collections of (OGC) features based on this TLcdOGCSortBy object.
      Parameters:
      aFilterContext - the context in which to create the filter. The context defines amongst others how a property is retrieved from an (OGC) feature.
      Since:
      2017.0