Package com.luciad.ogc.filter.model
Class TLcdOGCSortBy
java.lang.Object
com.luciad.datamodel.TLcdDataObject
com.luciad.ogc.filter.model.TLcdOGCSortBy
- All Implemented Interfaces:
ILcdDataObject
,ILcdOGCSortBy
,ILcdCloneable
,ILcdDeepCloneable
,Cloneable
This class represents the <ogc:SortBy>
element.
The <ogc:SortBy>
element contains a list of properties that must be taken into account for sorting.
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 Summary
-
Method Summary
Modifier and TypeMethodDescriptionvoid
addSortProperty
(TLcdOGCSortProperty aSortProperty) Adds a sort property.final Comparator
<Object> asComparator
(TLcdOGCFilterContext aFilterContext) Builds a comparator that can be used to sort collections of (OGC) features based on thisTLcdOGCSortBy
object.static TLcdOGCSortBy
comparing
(TLcdOGCPropertyName aPropertyName) Create a "sort by" based on the given property.static TLcdOGCSortBy
comparing
(TLcdOGCPropertyName aPropertyName, int aSortOrder) Create a "sort by" based on the given property.boolean
Returns the list of sort properties.getSortProperty
(int aIndex) Gets the sort property at a given position.int
Gets the number of sort properties.int
hashCode()
void
insertSortPropertyAt
(TLcdOGCSortProperty aSortProperty, int aIndex) Inserts a sort property at a given position.boolean
removeSortProperty
(TLcdOGCSortProperty aSortProperty) Removes a given sort property.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.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.toString()
Methods inherited from class com.luciad.datamodel.TLcdDataObject
clone, clone, getDataType, getValue, getValue, hasValue, hasValue, setValue, setValue
-
Constructor Details
-
TLcdOGCSortBy
public TLcdOGCSortBy()Default constructor. Consider using thecomparing(com.luciad.ogc.filter.model.TLcdOGCPropertyName)
andthenComparing(com.luciad.ogc.filter.model.TLcdOGCPropertyName)
factory methods instead of directly instantiating this. Example:
Note that while instances of this class are mutable, you should not modify them once in use.TLcdOGCSortBy sortBy = comparing(property("AGE"), DESC).thenComparing(property("NAME"));
-
-
Method Details
-
insertSortPropertyAt
Inserts a sort property at a given position.- Parameters:
aSortProperty
- the sort property to be inserted.aIndex
- the index of the given position.
-
getSortProperties
Returns the list of sort properties.- Returns:
- the list of sort properties
-
addSortProperty
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
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
Gets the sort property at a given position.- Parameters:
aIndex
- the index of the given position.- Returns:
- the sort property.
-
equals
-
hashCode
public int hashCode() -
toString
- Overrides:
toString
in classTLcdDataObject
-
comparing
Create a "sort by" based on the given property. The sort order isascending
. You can sort on multiple properties by chaining withthenComparing(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
Create a "sort by" based on the given property. You can sort on multiple properties by chaining withthenComparing(com.luciad.ogc.filter.model.TLcdOGCPropertyName)
. Example:TLcdOGCSortBy sortBy = comparing(property("AGE"), DESC).thenComparing(property("NAME"));
-
thenComparing
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
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
Builds a comparator that can be used to sort collections of (OGC) features based on thisTLcdOGCSortBy
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
-