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:
  • Field Details

    • FEATURE

      protected final LanguageFeature FEATURE
      Description of this ADQL Feature.
      Since:
      2.0
  • Constructor Details

    • ADQLList

      protected ADQLList(String name)
      Builds an ADQLList with only its name. This name will always prefix the list.
      Parameters:
      name - Prefix/Name of this list.
    • ADQLList

      protected ADQLList(String name, LanguageFeature implementedFeature)
      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

      protected ADQLList(ADQLList<T> toCopy) throws Exception
      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

      public LanguageFeature getFeatureDescription()
      Description copied from interface: ADQLObject
      Get 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:
      getFeatureDescription in interface ADQLObject
      Returns:
      Description of this ADQL object as an ADQL's feature.
    • add

      public boolean add(T item) throws NullPointerException
      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

      public void add(int index, T item) throws NullPointerException, ArrayIndexOutOfBoundsException
      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

      public T set(int index, T item) throws NullPointerException, ArrayIndexOutOfBoundsException
      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

      public T get(int index) throws ArrayIndexOutOfBoundsException
      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

      public T remove(int index) throws ArrayIndexOutOfBoundsException
      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

      public String getName()
      Description copied from interface: ADQLObject
      Gets the name of this object in ADQL.
      Specified by:
      getName in interface ADQLObject
      Returns:
      The name of this ADQL object.
    • getPosition

      public final TextPosition 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 interface ADQLObject
      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

      public final void setPosition(TextPosition position)
      Sets the position at which this ADQLList has been found in the original ADQL query string.
      Parameters:
      position - Position of this ADQLList.
      Since:
      1.4
    • toADQL

      public String toADQL()
      Description copied from interface: ADQLObject
      Gets the ADQL expression of this object.
      Specified by:
      toADQL in interface ADQLObject
      Returns:
      The corresponding ADQL expression.
    • iterator

      public Iterator<T> iterator()
      Specified by:
      iterator in interface Iterable<T extends ADQLObject>
    • adqlIterator

      public ADQLIterator 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 interface ADQLObject
      Returns:
      An ADQL objects iterator.
      See Also:
    • getPossibleSeparators

      public abstract String[] getPossibleSeparators()
      Gets the list of all possible separators for this ADQLList.
      Returns:
      Possible separators.
    • getSeparator

      public abstract String getSeparator(int index) throws ArrayIndexOutOfBoundsException
      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 than size().
    • getCopy

      public abstract ADQLObject getCopy() throws Exception
      Description copied from interface: ADQLObject
      Gets a (deep) copy of this ADQL object.
      Specified by:
      getCopy in interface ADQLObject
      Returns:
      The copy of this ADQL object.
      Throws:
      Exception - If there is any error during the copy.