borland Packages  Class Hierarchy  dx.dataset Package 

SortDescriptor class

java.lang.Object
   +----com.borland.dx.dataset.SortDescriptor

About the SortDescriptor class

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.


SortDescriptor constructors

SortDescriptor properties

*Read-only properties **Write-only properties

Properties implemented in this class

Properties implemented in java.lang.Object

SortDescriptor methods

Methods implemented in this class

Methods implemented in java.lang.Object


SortDescriptor constructors

SortDescriptor(com.borland.dx.dataset.SortDescriptor)

  public SortDescriptor(SortDescriptor desc)
Constructs a SortDescriptor that contains the same values as the specified SortDescriptor.

Parameters:

desc
The SortDescriptor to clone properties values from.

SortDescriptor(java.lang.String)

  public SortDescriptor(String indexName)
Constructs a SortDescriptor with the specified sort. Defaults to case-sensitive, ascending.

Parameters:

indexName
The String name of this index.

SortDescriptor(java.lang.String, java.lang.String[], boolean[], boolean, boolean, java.lang.String)

  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.

Parameters:

indexName
A unique name for this index.
sortKeys
An array of columns on which to sort the data.
descending
An array of booleans that indicate which sortKeys columns are sorted in descending order. The dimension of sortKeys and descending should be equal if they are both non-null.
caseInsensitive
If true, data ordering of String type will not be sensitive to the case of the data. If false, the data will be ordered with respect to the case of the String.
unique
A constraint on column values. A row with column value for sortKeys that is not unique cannot be added to the DataSet.
localeName
The name (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.

SortDescriptor(java.lang.String, java.lang.String[], boolean[], java.lang.String, int)

  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.

Parameters:

indexName
A unique name for this index.
sortKeys
An array of columns on which to sort the data.
descending
An array of booleans that indicate which sortKeys columns are sorted in descending order. The dimension of sortKeys and descending should be equal if they are both non-null.
localeName
The name (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.

SortDescriptor(java.lang.String[])

  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.

Parameters:

sortKeys
The String array containing the names of the Column components by which to sort the data.

SortDescriptor(java.lang.String[], boolean, boolean)

  public SortDescriptor(String[]sortKeys, boolean caseInsensitive, boolean descending)
Constructs a SortDescriptor with properties as specified in its parameters.

Parameters:

sortKeys
The String array containing the names of the Column components by which to sort the data.
caseInsensitive
Whether the sort considers (false) or ignores (true) upper and lower case differences. Valid only for String columns. Defaults to false (case sensitive).
descending
Whether the sort is in ascending (false, the default) or descending (true) order.

SortDescriptor(java.lang.String[], boolean, boolean, java.lang.String)

  public SortDescriptor(String[]sortKeys, boolean caseInsensitive, boolean descending, String localeName)
Constructs a SortDescriptor with properties as specified in its parameters.

Parameters:

sortKeys
The String array containing the names of the Column components by which to sort the data.
caseInsensitive
Whether the sort considers (false) or ignores (true) upper and lower case differences. Valid only for String columns. Defaults to false (case sensitive).
descending
Whether the sort is in ascending (false, the default) or descending (true) order.
localeName
The String name of the locale used for sorting of the data in the DataSet.

SortDescriptor properties

caseInsensitive

 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.

descending

 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.

indexName

 public final String getIndexName()
Specifies the name of an index that maintains this sorting. MemoryStore will ignore this property.

keys

 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.

locale

 public final Locale getLocale()
Returns or specifies the locale that this SortDescriptor was created with.

localeName

 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.

options

 public final int getOptions()
Read-only property that returns the Sort options (variables).

primary

 public final boolean isPrimary()
Read-only property that returns true if the PRIMARY option is enabled.

sortAsInserted

 public final boolean isSortAsInserted()
Read-only property that returns true if the SORT_AS_INSERTED option is enabled.

unique

 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.

SortDescriptor methods

equals(com.borland.dx.dataset.SortDescriptor)

  public final boolean equals(SortDescriptor descriptor)
Determines whether the SortDescriptor contains the same property values as the specified SortDescriptor.

Parameters:

descriptor
The SortDescriptor to compare property values against.

equals(com.borland.dx.dataset.SortDescriptor, java.util.Locale)

  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:

isDescending(int)

  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.

keyCount()

  public final int keyCount()
Returns the number of Column components involved in the sort.

toString()

  public String toString()
Returns the String representation of the values stored in the SortDescriptor.

Overrides: java.lang.Object.toString()