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.
- See Also:
-
Nested Class Summary
Nested ClassesModifier and TypeClassDescriptionstatic classLets iterating on all ADQL objects of the givenADQLList. -
Field Summary
FieldsModifier and TypeFieldDescriptionprotected final LanguageFeatureDescription of this ADQL Feature. -
Constructor Summary
ConstructorsModifierConstructorDescriptionprotectedBuilds an ADQLList by copying the given one.protectedBuilds an ADQLList with only its name.protectedADQLList(String name, LanguageFeature implementedFeature) Builds an ADQLList with only its name and its corresponding language feature. -
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.Get the description of this ADQL's Language Feature.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
-
Field Details
-
FEATURE
Description of this ADQL Feature.- Since:
- 2.0
-
-
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 with only its name and its corresponding language feature.The given name will always prefix the list.
The language feature is optional. If omitted, a default non-optional one will be created using the list's name.
- Parameters:
name- Prefix/Name of this list.implementedFeature- Language Feature implemented by this list.- Since:
- 2.0
-
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
-
getFeatureDescription
Description copied from interface:ADQLObjectGet the description of this ADQL's Language Feature.Note: Getting this description is generally only useful when discovery optional features so that determining if they are allowed to be used in ADQL queries.
- Specified by:
getFeatureDescriptionin interfaceADQLObject- Returns:
- Description of this ADQL object as an ADQL's feature.
-
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:
trueif the given item has been successfully added,falseotherwise.- 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 invalid input: '<' 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 invalid input: '<' 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 invalid input: '<' 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 invalid input: '<' 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:
trueif this clause is empty,falseotherwise.
-
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.
-