Package adql.query
Class ADQLList<T extends ADQLObject>
java.lang.Object
adql.query.ADQLList<T>
- All Implemented Interfaces:
ADQLObject
,Iterable<T>
- Direct Known Subclasses:
ClauseADQL
,Concatenation
public abstract class ADQLList<T extends ADQLObject>
extends Object
implements ADQLObject, Iterable<T>
Represents a list of ADQL items.
Since it is a list, it is possible to add, remove, modify and iterate on a such object.
- Version:
- 1.4 (06/2015)
- Author:
- Grégory Mantelet (CDS;ARI)
- See Also:
-
Nested Class Summary
Nested ClassesModifier and TypeClassDescriptionstatic class
Lets iterating on all ADQL objects of the givenADQLList
. -
Constructor Summary
Constructors -
Method Summary
Modifier and TypeMethodDescriptionvoid
Adds the given item (if not null) at the given position into this clause.boolean
Adds the given item (if not null) at the end of this clause.Gets an iterator on the intern ADQL objects.void
clear()
Clears this clause.get
(int index) Gets the specified ADQL item.abstract ADQLObject
getCopy()
Gets a (deep) copy of this ADQL object.getName()
Gets the name of this object in ADQL.final TextPosition
Gets the position of this object/token in the ADQL query.abstract String[]
Gets the list of all possible separators for thisADQLList
.abstract String
getSeparator
(int index) Gets the separator between the list items index-1 and index.boolean
isEmpty()
Tells whether this clause contains at least one ADQL item.iterator()
remove
(int index) Removes the specified ADQL item.Replaces the specified ADQL item by the given one.final void
setPosition
(TextPosition position) Sets the position at which thisADQLList
has been found in the original ADQL query string.int
size()
Gets the length of this clause.toADQL()
Gets the ADQL expression of this object.Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
Methods inherited from interface java.lang.Iterable
forEach, spliterator
-
Constructor Details
-
ADQLList
Builds an ADQLList with only its name. This name will always prefix the list.- Parameters:
name
- Prefix/Name of this list.
-
ADQLList
Builds an ADQLList by copying the given one.
Note: It is a deep copy.
- Parameters:
toCopy
- The ADQLList to copy.- Throws:
Exception
- If there is an error during the copy.
-
-
Method Details
-
add
Adds the given item (if not null) at the end of this clause.- Parameters:
item
- The ADQL item to add to this clause.- Returns:
- true if the given item has been successfully added, false otherwise.
- Throws:
NullPointerException
- If the given item is null.
-
add
Adds the given item (if not null) at the given position into this clause.- Parameters:
index
- Position at which the given item must be added.item
- ADQL item to add to this clause.- Throws:
NullPointerException
- If the given item is null.ArrayIndexOutOfBoundsException
- If the index is out of range (index < 0 || index > size()).
-
set
Replaces the specified ADQL item by the given one.- Parameters:
index
- Position of the item to replace.item
- Replacer of the specified ADQL item.- Returns:
- The replaced ADQL item.
- Throws:
NullPointerException
- If the given item is null.ArrayIndexOutOfBoundsException
- If the index is out of range (index < 0 || index > size()).
-
get
Gets the specified ADQL item.- Parameters:
index
- Index of the ADQL item to retrieve.- Returns:
- The corresponding ADQL item.
- Throws:
ArrayIndexOutOfBoundsException
- If the index is out of range (index < 0 || index > size()).
-
remove
Removes the specified ADQL item.- Parameters:
index
- Index of the ADQL item to remove.- Returns:
- The removed ADQL item.
- Throws:
ArrayIndexOutOfBoundsException
- If the index is out of range (index < 0 || index > size()).
-
clear
public void clear()Clears this clause. -
size
public int size()Gets the length of this clause.- Returns:
- The number of ADQL items contained into this clause.
-
isEmpty
public boolean isEmpty()Tells whether this clause contains at least one ADQL item.- Returns:
- true if this clause is empty, false otherwise.
-
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.
-
getPosition
Description copied from interface:ADQLObject
Gets the position of this object/token in the ADQL query.
By default, no position should be set.
- Specified by:
getPosition
in interfaceADQLObject
- Returns:
- Position of this ADQL item in the ADQL query, or NULL if not written originally in the query (for example, if added afterwards.
-
setPosition
Sets the position at which thisADQLList
has been found in the original ADQL query string.- Parameters:
position
- Position of thisADQLList
.- Since:
- 1.4
-
toADQL
Description copied from interface:ADQLObject
Gets the ADQL expression of this object.- Specified by:
toADQL
in interfaceADQLObject
- Returns:
- The corresponding ADQL expression.
-
iterator
- Specified by:
iterator
in interfaceIterable<T extends ADQLObject>
-
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:
-
getPossibleSeparators
Gets the list of all possible separators for thisADQLList
.- Returns:
- Possible separators.
-
getSeparator
Gets the separator between the list items index-1 and index.- Parameters:
index
- Index of the right list item.- Returns:
- The corresponding separator.
- Throws:
ArrayIndexOutOfBoundsException
- If the index is less or equal than 0, or is greater or equal thansize()
.
-
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.
-