public class SortOrder extends Object implements Comparator<Value[]>
Modifier and Type | Field and Description |
---|---|
static int |
ASCENDING
This bit mask means the values should be sorted in ascending order.
|
static int |
DESCENDING
This bit mask means the values should be sorted in descending order.
|
static int |
NULLS_FIRST
This bit mask means NULLs should be sorted before other data, no matter
if ascending or descending order is used.
|
static int |
NULLS_LAST
This bit mask means NULLs should be sorted after other data, no matter
if ascending or descending order is used.
|
Constructor and Description |
---|
SortOrder(Database database,
int[] index,
int[] sortType)
Construct a new sort order object.
|
Modifier and Type | Method and Description |
---|---|
int |
compare(Value[] a,
Value[] b)
Compare two expression lists.
|
static int |
compareNull(boolean aNull,
boolean bNull,
int sortType)
Compare two expressions where one of them is NULL.
|
int[] |
getIndexes()
Get the column index list.
|
int[] |
getSortTypes()
Get the sort order bit masks.
|
String |
getSQL(Expression[] list,
int visible)
Create the SQL snippet that describes this sort order.
|
void |
sort(ArrayList<Value[]> rows)
Sort a list of rows.
|
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
equals
public static final int ASCENDING
public static final int DESCENDING
public static final int NULLS_FIRST
public static final int NULLS_LAST
public SortOrder(Database database, int[] index, int[] sortType)
database
- the databaseindex
- the column index listsortType
- the sort order bit maskspublic String getSQL(Expression[] list, int visible)
list
- the expression listvisible
- the number of columns in the select listpublic static int compareNull(boolean aNull, boolean bNull, int sortType)
aNull
- whether the first expression is nullbNull
- whether the second expression is nullsortType
- the sort bit mask to usepublic int compare(Value[] a, Value[] b)
compare
in interface Comparator<Value[]>
a
- the first expression listb
- the second expression listpublic void sort(ArrayList<Value[]> rows)
rows
- the list of rowspublic int[] getIndexes()
public int[] getSortTypes()
Copyright © 2012 JBoss by Red Hat. All Rights Reserved.