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

      public ADQLOrder(String colName, boolean desc) throws 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:
      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 Details

    • 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 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

      public void setOrder(String colName, boolean desc) throws 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:
      NullPointerException - If the given name is null or is an empty string.
    • 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
      Overrides:
      getCopy in class ColumnReference
      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
      Overrides:
      getName in class ColumnReference
      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
      Overrides:
      toADQL in class ColumnReference
      Returns:
      The corresponding ADQL expression.