public class ClauseSelect extends ClauseADQL<SelectItem>
The SELECT clause of an ADQL query.
This ADQL clause is not only a list of ADQL items:
ADQLList.ADQLListIterator
Constructor and Description |
---|
ClauseSelect()
Builds an empty SELECT clause.
|
ClauseSelect(boolean distinctColumns)
Builds an empty SELECT clause by specifying whether the returned rows are unique (regarding the first returned columns).
|
ClauseSelect(boolean distinctColumns,
int limit)
Builds an empty SELECT clause.
|
ClauseSelect(ClauseSelect toCopy)
Builds a SELECT clause by copying the given one.
|
ClauseSelect(int limit)
Builds an empty SELECT clause whose the returned rows must be limited to the given number.
|
Modifier and Type | Method and Description |
---|---|
boolean |
add(ADQLOperand operand)
Adds an operand to this SELECT clause.
|
void |
add(int index,
ADQLOperand operand)
Adds an operand to this SELECT clause at the given position.
|
boolean |
distinctColumns()
Tells whether this clause imposes that returned rows are unique (regarding the first returned column).
|
ADQLObject |
getCopy()
Gets a (deep) copy of this ADQL object.
|
int |
getLimit()
Gets the maximum number of rows imposed by this SELECT clause.
|
boolean |
hasLimit()
Indicates whether this SELECT clause imposes a maximum number of rows.
|
ADQLOperand |
searchByAlias(java.lang.String alias)
Gets the operand which is associated with the given alias (case sensitive).
|
java.util.List<SelectItem> |
searchByAlias(java.lang.String alias,
boolean caseSensitive)
Gets all the select items which are associated with the given alias.
|
ADQLOperand |
searchByIndex(int index)
Gets the specified operand.
|
ADQLOperand |
set(int index,
ADQLOperand operand)
Replaces the specified operand by the given one.
|
void |
setDistinctColumns(boolean distinct)
Changes the DISTINCT flag of this SELECT clause.
|
void |
setLimit(int limit)
Changes the maximum number of rows this clause imposes.
|
void |
setNoLimit()
Sets no maximum number of rows (classic SELECT).
|
java.lang.String |
toADQL()
Gets the ADQL expression of this object.
|
getPossibleSeparators, getSeparator
add, add, adqlIterator, clear, get, getName, getPosition, isEmpty, iterator, remove, set, setPosition, size
public ClauseSelect()
public ClauseSelect(boolean distinctColumns)
distinctColumns
- true means unique rows (= SELECT DISTINCT), false otherwise (= SELECT or = SELECT ALL).public ClauseSelect(int limit)
limit
- Maximum number of returned rows (= SELECT TOP limit).public ClauseSelect(boolean distinctColumns, int limit)
distinctColumns
- true means unique rows (= SELECT DISTINCT), false otherwise (= SELECT or = SELECT ALL).limit
- Maximum number of returned rows (= SELECT TOP limit).public ClauseSelect(ClauseSelect toCopy) throws java.lang.Exception
toCopy
- The SELECT clause to copy.java.lang.Exception
- If there is an error during the copy.public final boolean distinctColumns()
public final void setDistinctColumns(boolean distinct)
distinct
- true for SELECY DISTINCT, false for SELECT ALL.public final boolean hasLimit()
public final int getLimit()
public final void setNoLimit()
public final void setLimit(int limit)
limit
- The maximum number of returned rows (SELECT TOP limit).public boolean add(ADQLOperand operand) throws java.lang.NullPointerException
Adds an operand to this SELECT clause.
IMPORTANT: The given operand will not be added directly !
It will be encapsulated in a SelectItem
object which will be then added to the SELECT clause.
operand
- The operand to add.java.lang.NullPointerException
- If the given item is null.SelectItem
public void add(int index, ADQLOperand operand) throws java.lang.NullPointerException, java.lang.ArrayIndexOutOfBoundsException
Adds an operand to this SELECT clause at the given position.
IMPORTANT: The given operand will not be added directly !
It will be encapsulated in a SelectItem
object which will be then added to the SELECT clause.
index
- The position at which the given operand must be added.operand
- The operand to add.java.lang.NullPointerException
- If the given item is null.java.lang.ArrayIndexOutOfBoundsException
- If the index is out of range (index < 0 || index > size()).SelectItem
public ADQLOperand set(int index, ADQLOperand operand) throws java.lang.NullPointerException, java.lang.ArrayIndexOutOfBoundsException
Replaces the specified operand by the given one.
IMPORTANT: The given operand will not be added directly !
It will be encapsulated in a SelectItem
object which will be then added to the SELECT clause.
index
- The position of the SELECT item to replace.operand
- The replacer of the specified SELECT item.java.lang.NullPointerException
- If the given item is null.java.lang.ArrayIndexOutOfBoundsException
- If the index is out of range (index < 0 || index > size()).public ADQLOperand searchByIndex(int index) throws java.lang.ArrayIndexOutOfBoundsException
index
- Index of the operand to retrieve.java.lang.ArrayIndexOutOfBoundsException
- If the index is out of range (index < 0 || index > size()).public ADQLOperand searchByAlias(java.lang.String alias)
alias
- Alias of the operand to retrieve.searchByAlias(String, boolean)
public java.util.List<SelectItem> searchByAlias(java.lang.String alias, boolean caseSensitive)
alias
- Alias of the operand to retrieve.public ADQLObject getCopy() throws java.lang.Exception
ADQLObject
getCopy
in interface ADQLObject
getCopy
in class ClauseADQL<SelectItem>
java.lang.Exception
- If there is any error during the copy.public java.lang.String toADQL()
ADQLObject
toADQL
in interface ADQLObject
toADQL
in class ADQLList<SelectItem>