Package adql.query
Class ADQLOrder
java.lang.Object
adql.query.ADQLOrder
- All Implemented Interfaces:
ADQLObject
Represents an item of the ORDER BY list: that's to say a column reference
or a value expression, and an optional sorting indication (ASC, DESC).
-
Field Summary
FieldsModifier and TypeFieldDescriptionprotected ColumnReference
Reference to the column on which the query result must be ordered.protected ADQLOperand
Value on which the query result must be ordered.static final LanguageFeature
Description of this ADQL Feature. -
Constructor Summary
ConstructorsConstructorDescriptionADQLOrder
(int colIndex) Builds an order indication with the index of the selected column on which an ASCending ordering will be done.ADQLOrder
(int colIndex, boolean desc) Builds an order indication with the index of the selected column on which the specified ordering will be done.Builds an ORDER BY item by copying the given one.ADQLOrder
(ADQLOperand expr) Builds an order indication with the expression on which an ASCending ordering will be done.ADQLOrder
(ADQLOperand expr, boolean desc) Builds an order indication with the expression on which the specified ordering will be done.Builds an order indication with the name or the alias of the selected column on which an ASCending ordering will be done.Deprecated.Since ADQL-2.1, a column reference can be a qualified column (i.e. -
Method Summary
Modifier and TypeMethodDescriptionGets an iterator on the intern ADQL objects.final ColumnReference
Get the reference of column on which the query result will be ordered.getCopy()
Gets a (deep) copy of this ADQL object.final ADQLOperand
Get the expression on which the query result will be ordered.final LanguageFeature
Get the description of this ADQL's Language Feature.getName()
Gets the name of this object in ADQL.final TextPosition
Gets the position in the original ADQL query string.boolean
Tells how the results will be sorted.void
setOrder
(int colIndex, boolean desc) Updates the current order indication.void
setOrder
(ADQLOperand expr, boolean desc) Updates the current order indication.void
Deprecated.Since ADQL-2.1, a column reference can be a qualified column (i.e.void
setPosition
(TextPosition pos) Sets the position at which thisColumnReference
has been found in the original ADQL query string.toADQL()
Gets the ADQL expression of this object.
-
Field Details
-
FEATURE
Description of this ADQL Feature.- Since:
- 2.0
-
colRef
Reference to the column on which the query result must be ordered.Important note: If NULL, this ORDER BY is done on a value expression. In such case, see
expression
.- Since:
- 2.0
-
expression
Value on which the query result must be ordered.Important note: If NULL, this ORDER BY is done on a column reference. In such case, see
colRef
.- Since:
- 2.0
-
-
Constructor Details
-
ADQLOrder
Builds an order indication with the index of the selected column on which an ASCending ordering will be done.- Parameters:
colIndex
- The index of a selected column (from 1).- Throws:
ArrayIndexOutOfBoundsException
- If the index is less or equal 0.- See Also:
-
ADQLOrder
Builds an order indication with the index of the selected column on which the specified ordering will be done.- Parameters:
colIndex
- The index of a selected column (from 1).desc
-true
means DESCending order,false
means ASCending order.- Throws:
ArrayIndexOutOfBoundsException
- If the index is less or equal 0.- See Also:
-
ADQLOrder
Builds an order indication with the name or the alias of the selected column on which an ASCending ordering will be done.- Parameters:
colName
- The name or the alias of a selected column.- Throws:
NullPointerException
- If the given name is NULL or is an empty string.- See Also:
-
ADQLOrder
Deprecated.Since ADQL-2.1, a column reference can be a qualified column (i.e. anADQLColumn
). You should useADQLOrder(ADQLOperand)
instead.Builds an order indication with the name of the alias of the selected column on which the specified ordering will be done.- Parameters:
colName
- The name of the alias of a selected column.desc
-true
means DESCending order,false
means ASCending order.- Throws:
NullPointerException
- If the given name is NULL or is an empty string.- See Also:
-
ColumnReference(String)
-
ADQLOrder
Builds an order indication with the expression on which an ASCending ordering will be done.- Parameters:
expr
- The expression to order on.- Throws:
NullPointerException
- If the given expression is NULL.- Since:
- 2.0
- See Also:
-
ADQLOrder
Builds an order indication with the expression on which the specified ordering will be done.- Parameters:
expr
- The expression to order on.desc
-true
means DESCending order,false
means ASCending order.- Throws:
NullPointerException
- If the given expression is NULL.- Since:
- 2.0
-
ADQLOrder
Builds an ORDER BY item by copying the given one.- Parameters:
toCopy
- The ORDER BY item to copy.- Throws:
Exception
- If the copy failed.
-
-
Method Details
-
isDescSorting
public boolean isDescSorting()Tells how the results will be sorted.- Returns:
true
DESCending order,false
ASCending order.
-
getColumnReference
Get the reference of column on which the query result will be ordered.- Returns:
- The set column reference. Might be NULL.
- Since:
- 2.0
-
getExpression
Get the expression on which the query result will be ordered.- Returns:
- The set expression. Might be NULL.
- Since:
- 2.0
-
setOrder
Updates the current order indication.- Parameters:
colIndex
- The index of a selected column (from 1).desc
-true
means DESCending order,false
means ASCending order.- Throws:
IndexOutOfBoundsException
- If the given index is less or equal 0.ArrayIndexOutOfBoundsException
-
setOrder
Deprecated.Since ADQL-2.1, a column reference can be a qualified column (i.e. anADQLColumn
). You should usesetOrder(ADQLOperand, boolean)
instead.Updates the current order indication.- Parameters:
colName
- The name or the alias of a selected column.desc
-true
means DESCending order,false
means ASCending order.- Throws:
NullPointerException
- If the given name is NULL or is an empty string.
-
setOrder
Updates the current order indication.- Parameters:
expr
- The expression to order on.desc
-true
means DESCending order,false
means ASCending order.- Throws:
NullPointerException
- If the given expression is NULL.- Since:
- 2.0
-
getCopy
Description copied from interface:ADQLObject
Gets a (deep) copy of this ADQL object.- Specified by:
getCopy
in interfaceADQLObject
- Returns:
- The copy of this ADQL object.
- Throws:
Exception
- If there is any error during the copy.
-
getName
Description copied from interface:ADQLObject
Gets the name of this object in ADQL.- Specified by:
getName
in interfaceADQLObject
- Returns:
- The name of this ADQL object.
-
toADQL
Description copied from interface:ADQLObject
Gets the ADQL expression of this object.- Specified by:
toADQL
in interfaceADQLObject
- Returns:
- The corresponding ADQL expression.
-
getPosition
Gets the position in the original ADQL query string.- Specified by:
getPosition
in interfaceADQLObject
- Returns:
- The position of this
ColumnReference
.
-
setPosition
Sets the position at which thisColumnReference
has been found in the original ADQL query string.- Parameters:
pos
- Position of thisColumnReference
.
-
getFeatureDescription
Description copied from interface:ADQLObject
Get the description of this ADQL's Language Feature.Note: Getting this description is generally only useful when discovery optional features so that determining if they are allowed to be used in ADQL queries.
- Specified by:
getFeatureDescription
in interfaceADQLObject
- Returns:
- Description of this ADQL object as an ADQL's feature.
-
adqlIterator
Description copied from interface:ADQLObject
Gets an iterator on the intern ADQL objects.Note: The returned iterator is particularly used by a
ISearchHandler
extension to browse a whole ADQL tree.- Specified by:
adqlIterator
in interfaceADQLObject
- Returns:
- An ADQL objects iterator.
- See Also:
-