Package adql.query

Class ADQLOrder

java.lang.Object
adql.query.ADQLOrder
All Implemented Interfaces:
ADQLObject

public class ADQLOrder extends Object implements ADQLObject
Represents an item of the ORDER BY list: that's to say a column reference or a value expression, and an optional sorting indication (ASC, DESC).
  • Field Summary

    Fields
    Modifier and Type
    Field
    Description
    protected ColumnReference
    Reference to the column on which the query result must be ordered.
    protected ADQLOperand
    Value on which the query result must be ordered.
    static final LanguageFeature
    Description of this ADQL Feature.
  • Constructor Summary

    Constructors
    Constructor
    Description
    ADQLOrder(int colIndex)
    Builds an order indication with the index of the selected column on which an ASCending ordering will be done.
    ADQLOrder(int colIndex, boolean desc)
    Builds an order indication with the index of the selected column on which the specified ordering will be done.
    Builds an ORDER BY item by copying the given one.
    Builds an order indication with the expression on which an ASCending ordering will be done.
    ADQLOrder(ADQLOperand expr, boolean desc)
    Builds an order indication with the expression on which the specified ordering will be done.
    ADQLOrder(String colName)
    Builds an order indication with the name or the alias of the selected column on which an ASCending ordering will be done.
    ADQLOrder(String colName, boolean desc)
    Deprecated.
    Since ADQL-2.1, a column reference can be a qualified column (i.e.
  • Method Summary

    Modifier and Type
    Method
    Description
    Gets an iterator on the intern ADQL objects.
    Get the reference of column on which the query result will be ordered.
    Gets a (deep) copy of this ADQL object.
    Get the expression on which the query result will be ordered.
    Get the description of this ADQL's Language Feature.
    Gets the name of this object in ADQL.
    Gets the position in the original ADQL query string.
    boolean
    Tells how the results will be sorted.
    void
    setOrder(int colIndex, boolean desc)
    Updates the current order indication.
    void
    setOrder(ADQLOperand expr, boolean desc)
    Updates the current order indication.
    void
    setOrder(String colName, boolean desc)
    Deprecated.
    Since ADQL-2.1, a column reference can be a qualified column (i.e.
    void
    Sets the position at which this ColumnReference has been found in the original ADQL query string.
    Gets the ADQL expression of this object.

    Methods inherited from class java.lang.Object

    clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
  • Field Details

    • FEATURE

      public static final LanguageFeature FEATURE
      Description of this ADQL Feature.
      Since:
      2.0
    • colRef

      protected ColumnReference colRef
      Reference to the column on which the query result must be ordered.

      Important note: If NULL, this ORDER BY is done on a value expression. In such case, see expression.

      Since:
      2.0
    • expression

      protected ADQLOperand expression
      Value on which the query result must be ordered.

      Important note: If NULL, this ORDER BY is done on a column reference. In such case, see colRef.

      Since:
      2.0
  • Constructor Details

    • ADQLOrder

      public ADQLOrder(int colIndex) throws ArrayIndexOutOfBoundsException
      Builds an order indication with the index of the selected column on which an ASCending ordering will be done.
      Parameters:
      colIndex - The index of a selected column (from 1).
      Throws:
      ArrayIndexOutOfBoundsException - If the index is less or equal 0.
      See Also:
    • ADQLOrder

      public ADQLOrder(int colIndex, boolean desc) throws ArrayIndexOutOfBoundsException
      Builds an order indication with the index of the selected column on which the specified ordering will be done.
      Parameters:
      colIndex - The index of a selected column (from 1).
      desc - true means DESCending order, false means ASCending order.
      Throws:
      ArrayIndexOutOfBoundsException - If the index is less or equal 0.
      See Also:
    • ADQLOrder

      public ADQLOrder(String colName) throws NullPointerException
      Builds an order indication with the name or the alias of the selected column on which an ASCending ordering will be done.
      Parameters:
      colName - The name or the alias of a selected column.
      Throws:
      NullPointerException - If the given name is NULL or is an empty string.
      See Also:
    • ADQLOrder

      @Deprecated public ADQLOrder(String colName, boolean desc) throws NullPointerException
      Deprecated.
      Since ADQL-2.1, a column reference can be a qualified column (i.e. an ADQLColumn). You should use ADQLOrder(ADQLOperand) instead.
      Builds an order indication with the name of the alias of the selected column on which the specified ordering will be done.
      Parameters:
      colName - The name of the alias of a selected column.
      desc - true means DESCending order, false means ASCending order.
      Throws:
      NullPointerException - If the given name is NULL or is an empty string.
      See Also:
      • invalid reference
        ColumnReference(String)
    • ADQLOrder

      public ADQLOrder(ADQLOperand expr) throws NullPointerException
      Builds an order indication with the expression on which an ASCending ordering will be done.
      Parameters:
      expr - The expression to order on.
      Throws:
      NullPointerException - If the given expression is NULL.
      Since:
      2.0
      See Also:
    • ADQLOrder

      public ADQLOrder(ADQLOperand expr, boolean desc) throws NullPointerException
      Builds an order indication with the expression on which the specified ordering will be done.
      Parameters:
      expr - The expression to order on.
      desc - true means DESCending order, false means ASCending order.
      Throws:
      NullPointerException - If the given expression is NULL.
      Since:
      2.0
    • ADQLOrder

      public ADQLOrder(ADQLOrder toCopy) throws Exception
      Builds an ORDER BY item by copying the given one.
      Parameters:
      toCopy - The ORDER BY item to copy.
      Throws:
      Exception - If the copy failed.
  • Method Details

    • isDescSorting

      public boolean isDescSorting()
      Tells how the results will be sorted.
      Returns:
      true DESCending order, false ASCending order.
    • getColumnReference

      public final ColumnReference getColumnReference()
      Get the reference of column on which the query result will be ordered.
      Returns:
      The set column reference. Might be NULL.
      Since:
      2.0
    • getExpression

      public final ADQLOperand getExpression()
      Get the expression on which the query result will be ordered.
      Returns:
      The set expression. Might be NULL.
      Since:
      2.0
    • setOrder

      public void setOrder(int colIndex, boolean desc) throws ArrayIndexOutOfBoundsException
      Updates the current order indication.
      Parameters:
      colIndex - The index of a selected column (from 1).
      desc - true means DESCending order, false means ASCending order.
      Throws:
      IndexOutOfBoundsException - If the given index is less or equal 0.
      ArrayIndexOutOfBoundsException
    • setOrder

      @Deprecated public void setOrder(String colName, boolean desc) throws NullPointerException
      Deprecated.
      Since ADQL-2.1, a column reference can be a qualified column (i.e. an ADQLColumn). You should use setOrder(ADQLOperand, boolean) instead.
      Updates the current order indication.
      Parameters:
      colName - The name or the alias of a selected column.
      desc - true means DESCending order, false means ASCending order.
      Throws:
      NullPointerException - If the given name is NULL or is an empty string.
    • setOrder

      public void setOrder(ADQLOperand expr, boolean desc) throws NullPointerException
      Updates the current order indication.
      Parameters:
      expr - The expression to order on.
      desc - true means DESCending order, false means ASCending order.
      Throws:
      NullPointerException - If the given expression is NULL.
      Since:
      2.0
    • getCopy

      public 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.
    • 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.
    • 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.
    • getPosition

      public final TextPosition getPosition()
      Gets the position in the original ADQL query string.
      Specified by:
      getPosition in interface ADQLObject
      Returns:
      The position of this ColumnReference.
    • setPosition

      public void setPosition(TextPosition pos)
      Sets the position at which this ColumnReference has been found in the original ADQL query string.
      Parameters:
      pos - Position of this ColumnReference.
    • getFeatureDescription

      public final 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.
    • 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: