public abstract class ADQLList<T extends ADQLObject> extends java.lang.Object implements ADQLObject, java.lang.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.
ClauseADQL
,
ClauseConstraints
,
Operation
,
Concatenation
Modifier and Type | Class and Description |
---|---|
static class |
ADQLList.ADQLListIterator
Lets iterating on all ADQL objects of the given
ADQLList . |
Modifier | Constructor and Description |
---|---|
protected |
ADQLList(ADQLList<T> toCopy)
Builds an ADQLList by copying the given one.
|
protected |
ADQLList(java.lang.String name)
Builds an ADQLList with only its name.
|
Modifier and Type | Method and Description |
---|---|
void |
add(int index,
T item)
Adds the given item (if not null) at the given position into this clause.
|
boolean |
add(T item)
Adds the given item (if not null) at the end of this clause.
|
ADQLIterator |
adqlIterator()
Gets an iterator on the intern ADQL objects.
|
void |
clear()
Clears this clause.
|
T |
get(int index)
Gets the specified ADQL item.
|
abstract ADQLObject |
getCopy()
Gets a (deep) copy of this ADQL object.
|
java.lang.String |
getName()
Gets the name of this object in ADQL.
|
TextPosition |
getPosition()
Gets the position of this object/token in the ADQL query.
|
abstract java.lang.String[] |
getPossibleSeparators()
Gets the list of all possible separators for this
ADQLList . |
abstract java.lang.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.
|
java.util.Iterator<T> |
iterator() |
T |
remove(int index)
Removes the specified ADQL item.
|
T |
set(int index,
T item)
Replaces the specified ADQL item by the given one.
|
void |
setPosition(TextPosition position)
Sets the position at which this
ADQLList has been found in the original ADQL query string. |
int |
size()
Gets the length of this clause.
|
java.lang.String |
toADQL()
Gets the ADQL expression of this object.
|
protected ADQLList(java.lang.String name)
name
- Prefix/Name of this list.public boolean add(T item) throws java.lang.NullPointerException
item
- The ADQL item to add to this clause.java.lang.NullPointerException
- If the given item is null.public void add(int index, T item) throws java.lang.NullPointerException, java.lang.ArrayIndexOutOfBoundsException
index
- Position at which the given item must be added.item
- ADQL item to add to this clause.java.lang.NullPointerException
- If the given item is null.java.lang.ArrayIndexOutOfBoundsException
- If the index is out of range (index < 0 || index > size()).public T set(int index, T item) throws java.lang.NullPointerException, java.lang.ArrayIndexOutOfBoundsException
index
- Position of the item to replace.item
- Replacer of the specified ADQL 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 T get(int index) throws java.lang.ArrayIndexOutOfBoundsException
index
- Index of the ADQL item to retrieve.java.lang.ArrayIndexOutOfBoundsException
- If the index is out of range (index < 0 || index > size()).public T remove(int index) throws java.lang.ArrayIndexOutOfBoundsException
index
- Index of the ADQL item to remove.java.lang.ArrayIndexOutOfBoundsException
- If the index is out of range (index < 0 || index > size()).public void clear()
public int size()
public boolean isEmpty()
public java.lang.String getName()
ADQLObject
getName
in interface ADQLObject
public final TextPosition getPosition()
ADQLObject
Gets the position of this object/token in the ADQL query.
By default, no position should be set.
getPosition
in interface ADQLObject
public final void setPosition(TextPosition position)
ADQLList
has been found in the original ADQL query string.position
- Position of this ADQLList
.public java.lang.String toADQL()
ADQLObject
toADQL
in interface ADQLObject
public java.util.Iterator<T> iterator()
iterator
in interface java.lang.Iterable<T extends ADQLObject>
public ADQLIterator adqlIterator()
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.
adqlIterator
in interface ADQLObject
ADQLIterator
,
ISearchHandler
public abstract java.lang.String[] getPossibleSeparators()
ADQLList
.public abstract java.lang.String getSeparator(int index) throws java.lang.ArrayIndexOutOfBoundsException
index
- Index of the right list item.java.lang.ArrayIndexOutOfBoundsException
- If the index is less or equal than 0, or is greater or equal than size()
.public abstract ADQLObject getCopy() throws java.lang.Exception
ADQLObject
getCopy
in interface ADQLObject
java.lang.Exception
- If there is any error during the copy.