Package adql.query

Class ADQLSet

java.lang.Object
adql.query.ADQLSet
All Implemented Interfaces:
ADQLObject
Direct Known Subclasses:
ADQLQuery, SetOperation

public abstract class ADQLSet extends Object implements ADQLObject
Object representation of an ADQL's rows set.

The resulting object of the ADQLParser is an object of this class.

Since:
2.0
  • Field Details

    • adqlVersion

      protected final ADQLParser.ADQLVersion adqlVersion
      Version of the ADQL grammar in which this query is written.
    • with

      protected ClauseADQL<WithItem> with
      The ADQL clause WITH.
    • orderBy

      protected ClauseADQL<ADQLOrder> orderBy
      The ADQL clause ORDER BY.
    • offset

      protected ClauseOffset offset
      The ADQL clause OFFSET.
    • position

      protected TextPosition position
      Position of this Query (or sub-query) inside the whole given ADQL query string.
  • Constructor Details

    • ADQLSet

      public ADQLSet()
      Builds an empty ADQL set.
    • ADQLSet

      public ADQLSet(ADQLParser.ADQLVersion version)
      Builds an empty ADQL set following the specified ADQL grammar.
      Parameters:
      version - Followed version of the ADQL grammar. If NULL, the default version will be set.
    • ADQLSet

      public ADQLSet(ADQLSet toCopy) throws Exception
      Builds an ADQL set by copying the given one.
      Parameters:
      toCopy - The ADQL set to copy.
      Throws:
      Exception - If there is an error during the copy.
  • Method Details

    • getADQLVersion

      public final ADQLParser.ADQLVersion getADQLVersion()
      Get the followed version of the ADQL grammar.
      Returns:
      The followed ADQL grammar version.
    • reset

      public void reset()
      Clear all the clauses.
    • getWith

      public final ClauseADQL<WithItem> getWith()
      Gets the WITH clause of this query.
      Returns:
      Its WITH clause.
    • setWith

      public void setWith(ClauseADQL<WithItem> newWith) throws NullPointerException
      Replaces its WITH clause by the given one.

      Note: The position of the query is erased.

      Parameters:
      newWith - The new WITH clause.
      Throws:
      NullPointerException - If the given WITH clause is NULL.
    • getOrderBy

      public final ClauseADQL<ADQLOrder> getOrderBy()
      Gets the ORDER BY clause of this rows set.
      Returns:
      Its ORDER BY clause.
    • setOrderBy

      public void setOrderBy(ClauseADQL<ADQLOrder> newOrderBy) throws NullPointerException
      Replaces its ORDER BY clause by the given one.

      Note: The position inside the query is erased.

      Parameters:
      newOrderBy - The new ORDER BY clause.
      Throws:
      NullPointerException - If the given ORDER BY clause is NULL.
    • hasLimit

      public abstract boolean hasLimit()
      Indicates whether this rows set imposes a maximum number of rows.
      Returns:
      true this clause has a limited number of rows, false otherwise.
    • getLimit

      public abstract int getLimit()
      Gets the maximum number of rows imposed in this rows set.
      Returns:
      Maximum number of rows the query must return.
    • setNoLimit

      public abstract void setNoLimit()
      Sets no maximum number of rows returned in this rows set.
    • setLimit

      public abstract void setLimit(int limit)
      Changes the maximum number of rows returned in this rows set.
      Parameters:
      limit - The maximum number of returned rows.
    • getOffset

      public final ClauseOffset getOffset()
      Gets the OFFSET value of this rows set.
      Returns:
      Its OFFSET value, or NULL if not OFFSET is set.
    • setOffset

      public void setOffset(ClauseOffset newOffset)
      Replaces its OFFSET value by the given one.

      Note: The position inside the query is erased.

      Parameters:
      newOffset - The new OFFSET value, or NULL to remove the current OFFSET.
    • getPosition

      public 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)
      Set the position of this ADQLSet inside the whole given ADQL query string.
      Parameters:
      position - New position of this ADQLSet.
    • getResultingColumns

      public abstract DBColumn[] getResultingColumns()
    • search

      public Iterator<ADQLObject> search(ISearchHandler sHandler)
      Lets searching ADQL objects into this rows set thanks to the given search handler.
      Parameters:
      sHandler - A search handler.
      Returns:
      An iterator on all ADQL objects found.