Package adql.query

Class ADQLOrder

  • All Implemented Interfaces:
    ADQLObject

    public class ADQLOrder
    extends ColumnReference
    Represents an item of the ORDER BY list: that's to say a column reference plus a sorting indication (ASC, DESC).
    Version:
    06/2011
    Author:
    Grégory Mantelet (CDS)
    • 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.
      ADQLOrder​(ADQLOrder toCopy)
      Builds an ORDER BY item by copying the given one.
      ADQLOrder​(java.lang.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​(java.lang.String colName, boolean desc)
      Builds an order indication with the name of the alias of the selected column on which the specified ordering will be done.
    • Constructor Detail

      • ADQLOrder

        public ADQLOrder​(int colIndex)
                  throws java.lang.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:
        java.lang.ArrayIndexOutOfBoundsException - If the index is less or equal 0.
        See Also:
        ADQLOrder(int, boolean)
      • ADQLOrder

        public ADQLOrder​(int colIndex,
                         boolean desc)
                  throws java.lang.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:
        java.lang.ArrayIndexOutOfBoundsException - If the index is less or equal 0.
      • ADQLOrder

        public ADQLOrder​(java.lang.String colName)
                  throws java.lang.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:
        java.lang.NullPointerException - If the given name is null or is an empty string.
        See Also:
        ADQLOrder(String, boolean)
      • ADQLOrder

        public ADQLOrder​(java.lang.String colName,
                         boolean desc)
                  throws java.lang.NullPointerException
        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:
        java.lang.NullPointerException - If the given name is null or is an empty string.
      • ADQLOrder

        public ADQLOrder​(ADQLOrder toCopy)
        Builds an ORDER BY item by copying the given one.
        Parameters:
        toCopy - The ORDER BY item to copy.
    • Method Detail

      • isDescSorting

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

        public void setOrder​(int colIndex,
                             boolean desc)
                      throws java.lang.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:
        java.lang.IndexOutOfBoundsException - If the given index is less or equal 0.
        java.lang.ArrayIndexOutOfBoundsException
      • setOrder

        public void setOrder​(java.lang.String colName,
                             boolean desc)
                      throws java.lang.NullPointerException
        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:
        java.lang.NullPointerException - If the given name is null or is an empty string.
      • getCopy

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

        public java.lang.String getName()
        Description copied from interface: ADQLObject
        Gets the name of this object in ADQL.
        Specified by:
        getName in interface ADQLObject
        Overrides:
        getName in class ColumnReference
        Returns:
        The name of this ADQL object.
      • toADQL

        public java.lang.String toADQL()
        Description copied from interface: ADQLObject
        Gets the ADQL expression of this object.
        Specified by:
        toADQL in interface ADQLObject
        Overrides:
        toADQL in class ColumnReference
        Returns:
        The corresponding ADQL expression.