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 classLets iterating on all ADQL objects of the givenADQLList. -
Constructor Summary
Constructors -
Method Summary
Modifier and TypeMethodDescriptionvoidAdds the given item (if not null) at the given position into this clause.booleanAdds the given item (if not null) at the end of this clause.Gets an iterator on the intern ADQL objects.voidclear()Clears this clause.get(int index) Gets the specified ADQL item.abstract ADQLObjectgetCopy()Gets a (deep) copy of this ADQL object.getName()Gets the name of this object in ADQL.final TextPositionGets the position of this object/token in the ADQL query.abstract String[]Gets the list of all possible separators for thisADQLList.abstract StringgetSeparator(int index) Gets the separator between the list items index-1 and index.booleanisEmpty()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 voidsetPosition(TextPosition position) Sets the position at which thisADQLListhas been found in the original ADQL query string.intsize()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, waitMethods 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:ADQLObjectGets the name of this object in ADQL.- Specified by:
getNamein interfaceADQLObject- Returns:
- The name of this ADQL object.
-
getPosition
Description copied from interface:ADQLObjectGets the position of this object/token in the ADQL query.
By default, no position should be set.
- Specified by:
getPositionin 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 thisADQLListhas been found in the original ADQL query string.- Parameters:
position- Position of thisADQLList.- Since:
- 1.4
-
toADQL
Description copied from interface:ADQLObjectGets the ADQL expression of this object.- Specified by:
toADQLin interfaceADQLObject- Returns:
- The corresponding ADQL expression.
-
iterator
- Specified by:
iteratorin interfaceIterable<T extends ADQLObject>
-
adqlIterator
Description copied from interface:ADQLObjectGets an iterator on the intern ADQL objects.
Note:The returned iterator is particularly used by a
ISearchHandlerextension to browse a whole ADQL tree.- Specified by:
adqlIteratorin 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:ADQLObjectGets a (deep) copy of this ADQL object.- Specified by:
getCopyin interfaceADQLObject- Returns:
- The copy of this ADQL object.
- Throws:
Exception- If there is any error during the copy.
-