Package adql.query
Class ADQLOrder
- java.lang.Object
-
- adql.query.ColumnReference
-
- adql.query.ADQLOrder
-
- All Implemented Interfaces:
ADQLObject
public class ADQLOrder extends ColumnReference
Represents an item of the ORDER BY list: that's to say a column reference plus a sorting indication (ASC, DESC).- Version:
- 06/2011
- Author:
- Grégory Mantelet (CDS)
-
-
Constructor Summary
Constructors Constructor Description ADQLOrder(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.ADQLOrder(ADQLOrder toCopy)
Builds an ORDER BY item by copying the given one.ADQLOrder(java.lang.String colName)
Builds an order indication with the name or the alias of the selected column on which an ASCending ordering will be done.ADQLOrder(java.lang.String colName, boolean desc)
Builds an order indication with the name of the alias of the selected column on which the specified ordering will be done.
-
Method Summary
All Methods Instance Methods Concrete Methods Modifier and Type Method Description ADQLObject
getCopy()
Gets a (deep) copy of this ADQL object.java.lang.String
getName()
Gets the name of this object in ADQL.boolean
isDescSorting()
Tells how the results will be sorted.void
setOrder(int colIndex, boolean desc)
Updates the current order indication.void
setOrder(java.lang.String colName, boolean desc)
Updates the current order indication.java.lang.String
toADQL()
Gets the ADQL expression of this object.-
Methods inherited from class adql.query.ColumnReference
adqlIterator, getAdqlTable, getColumnIndex, getColumnName, getDBLink, getPosition, isCaseSensitive, isIndex, setAdqlTable, setCaseSensitive, setColumnIndex, setColumnName, setDBLink, setPosition
-
-
-
-
Constructor Detail
-
ADQLOrder
public ADQLOrder(int colIndex) throws java.lang.ArrayIndexOutOfBoundsException
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:
java.lang.ArrayIndexOutOfBoundsException
- If the index is less or equal 0.- See Also:
ADQLOrder(int, boolean)
-
ADQLOrder
public ADQLOrder(int colIndex, boolean desc) throws java.lang.ArrayIndexOutOfBoundsException
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:
java.lang.ArrayIndexOutOfBoundsException
- If the index is less or equal 0.
-
ADQLOrder
public ADQLOrder(java.lang.String colName) throws java.lang.NullPointerException
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:
java.lang.NullPointerException
- If the given name is null or is an empty string.- See Also:
ADQLOrder(String, boolean)
-
ADQLOrder
public ADQLOrder(java.lang.String colName, boolean desc) throws java.lang.NullPointerException
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:
java.lang.NullPointerException
- If the given name is null or is an empty string.
-
ADQLOrder
public ADQLOrder(ADQLOrder toCopy)
Builds an ORDER BY item by copying the given one.- Parameters:
toCopy
- The ORDER BY item to copy.
-
-
Method Detail
-
isDescSorting
public boolean isDescSorting()
Tells how the results will be sorted.- Returns:
- true DESCending order, false ASCending order.
-
setOrder
public void setOrder(int colIndex, boolean desc) throws java.lang.ArrayIndexOutOfBoundsException
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:
java.lang.IndexOutOfBoundsException
- If the given index is less or equal 0.java.lang.ArrayIndexOutOfBoundsException
-
setOrder
public void setOrder(java.lang.String colName, boolean desc) throws java.lang.NullPointerException
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:
java.lang.NullPointerException
- If the given name is null or is an empty string.
-
getCopy
public ADQLObject getCopy() throws java.lang.Exception
Description copied from interface:ADQLObject
Gets a (deep) copy of this ADQL object.- Specified by:
getCopy
in interfaceADQLObject
- Overrides:
getCopy
in classColumnReference
- Returns:
- The copy of this ADQL object.
- Throws:
java.lang.Exception
- If there is any error during the copy.
-
getName
public java.lang.String getName()
Description copied from interface:ADQLObject
Gets the name of this object in ADQL.- Specified by:
getName
in interfaceADQLObject
- Overrides:
getName
in classColumnReference
- Returns:
- The name of this ADQL object.
-
toADQL
public java.lang.String toADQL()
Description copied from interface:ADQLObject
Gets the ADQL expression of this object.- Specified by:
toADQL
in interfaceADQLObject
- Overrides:
toADQL
in classColumnReference
- Returns:
- The corresponding ADQL expression.
-
-