borland Packages Class Hierarchy dx.dataset Package
java.lang.Object +----com.borland.dx.dataset.SortDescriptor
Constructors Properties Methods
Implements Serializable
The SortDescriptor
class describes the order by which rows of data that are visible to a DataSet
are accessed and presented. Sorting data is very easy and fast since indexes are built as they are needed.
The DataSet
can automatically reposition a new or updated row within the cursor based on the ordering of data by specified columns. In such instances, a row may "fly-away" to its correct position in the DataSet
.
In an ascending sort, null values appear at the bottom of the sort order.
There are no write-accessors for properties of the SortDescriptor
. To set its properties, use a SortDescriptor
constructor that takes the appropriate property as a parameter.
See "Sorting data" in the Database Application Developer's Guide for a tutorial using the SortDescriptor
.
public SortDescriptor(SortDescriptor desc)Constructs a
SortDescriptor
that contains the same values as the specified SortDescriptor
.
desc
SortDescriptor
to clone properties values from.
public SortDescriptor(String indexName)Constructs a
SortDescriptor
with the specified sort. Defaults to case-sensitive, ascending.
indexName
String
name of this index.
public SortDescriptor(String indexName, String[] sortKeys, boolean[] descending, boolean caseInsensitive, boolean unique, String localeName)Constructs a
SortDescriptor
, named with the specified indexName,
with the specified sort keys, as specified in its parameters.
indexName
sortKeys
descending
caseInsensitive
unique
DataSet
.
localeName
Locale.toString()
) of a locale to use for ordering. It is only respected for DataStore
. MemoryStore
will always use the Locale
of the associated StorageDataSet
.
public SortDescriptor(String indexName, String[] sortKeys, boolean[] descending, String localeName, int options)Constructs a
SortDescriptor
, named with the specified indexName,
with the specified sort keys, as specified in its parameters, using the specified options.
indexName
sortKeys
descending
localeName
Locale.toString()
) of a locale to use for ordering. It is only respected for DataStore
. MemoryStore
will always use the Locale
of the associated StorageDataSet
.
options
Sort
variables. Variables can be combined with the or operator.
public SortDescriptor(String[] sortKeys)Constructs a
SortDescriptor
with the specified sort keys. Defaults to case sensitive, ascending. Case-sensitivity applies for all specified String
columns. Ascending/descending applies to all specified columns.
sortKeys
String
array containing the names of the Column
components by which to sort the data.
public SortDescriptor(String[] sortKeys, boolean caseInsensitive, boolean descending)Constructs a
SortDescriptor
with properties as specified in its parameters.
sortKeys
String
array containing the names of the Column
components by which to sort the data.
caseInsensitive
String
columns. Defaults to false (case sensitive).
descending
public SortDescriptor(String[] sortKeys, boolean caseInsensitive, boolean descending, String localeName)Constructs a
SortDescriptor
with properties as specified in its parameters.
sortKeys
String
array containing the names of the Column
components by which to sort the data.
caseInsensitive
String
columns. Defaults to false (case sensitive).
descending
localeName
DataSet
.
public final boolean isCaseInsensitive()Read-only property that returns whether the sort considers (false) or ignores (true) upper and lower case differences. Valid only for
String
columns.
This property applies to all applicable String
columns specified in the keys
property.
public final boolean[] getDescending()Read-only property that returns an array that has the descending value for each key. This property applies to all applicable columns specified in the
keys
property. A value of null means that all keys are ascending.
public final String getIndexName()Specifies the name of an index that maintains this sorting.
MemoryStore
will ignore this property.
public final String[] getKeys()Read-only property that returns the
String
array containing the names of the Column
components by which the data is sorted.
public final Locale getLocale()Returns or specifies the locale that this
SortDescriptor
was created with.
public final String getLocaleName()
Returns or specifies the String name of locale that this SortDescriptor
was created with. If no localeName
was specified, null is returned. This property is ignored for MemoryStore
. MemoryStore
always uses the locale of the StorageDataSet
. DataStore
(which maintains persistent indexes) respects this setting. If this property is null, DataStore
will behave like MemoryStore
and use the Locale
of the StorageDataSet
.
public final int getOptions()Read-only property that returns the
Sort
options (variables).
public final boolean isPrimary()Read-only property that returns true if the
PRIMARY
option is enabled.
public final boolean isSortAsInserted()Read-only property that returns true if the
SORT_AS_INSERTED
option is enabled.
public final boolean isUnique()This a constraint on column values. A row with a column value for sortKeys that is not unique cannot be added to the
DataSet
.
public final boolean equals(SortDescriptor descriptor)Determines whether the
SortDescriptor
contains the same property values as the specified SortDescriptor
.
descriptor
SortDescriptor
to compare property values against.
public final boolean equals(SortDescriptor descriptor, Locale locale)Checks whether this
SortDescriptor
contains the same values as the descriptor
specified in the parameter of this method. If locale
is not specified, the default locale is used. This method returns true if the SortDescriptors
are the same, false otherwise.
The SortDescriptors can be equal in two ways:
indexName
property that are equal. If indexName
s are equal, no further tests for equality are made.
indexName
does not match, all of the other properties of the SortDescriptor
are compared for equality.
public final boolean isDescending(int i)Whether or not the values in column
i
are in ascending or descending order. Returns true if key i
is descending.
public final int keyCount()Returns the number of
Column
components involved in the sort.
public String toString()Returns the
String
representation of the values stored in the SortDescriptor
.