Class Between

  • All Implemented Interfaces:
    ADQLObject, ADQLConstraint

    public class Between
    extends java.lang.Object
    implements ADQLConstraint

    It represents the BETWEEN predicate of SQL and ADQL.

    This predicate returns true if the value of the left operand is between the value of the two other operands, else it returns false.

    Version:
    1.4 (06/2015)
    Author:
    Grégory Mantelet (CDS;ARI)
    • Constructor Detail

      • Between

        public Between​(ADQLOperand operand,
                       ADQLOperand min,
                       ADQLOperand max)
                throws java.lang.NullPointerException
        Builds a BETWEEN constraints.
        Parameters:
        operand - The left operand (left part of the BETWEEN predicate).
        min - The operand which represents the minimum value.
        max - The operand which represents the maximum value.
        Throws:
        java.lang.NullPointerException - If one of the given parameters is null.
      • Between

        public Between​(ADQLOperand operand,
                       ADQLOperand min,
                       ADQLOperand max,
                       boolean notBetween)
                throws java.lang.NullPointerException
        Builds a BETWEEN constraints.
        Parameters:
        operand - The left operand (left part of the BETWEEN predicate).
        min - The operand which represents the minimum value.
        max - The operand which represents the maximum value.
        notBetween - true if the predicate NOT BETWEEN must be used or false for BETWEEN.
        Throws:
        java.lang.NullPointerException - If one of the given parameters is null.
      • Between

        public Between​(Between toCopy)
                throws java.lang.Exception
        Builds a BETWEEN constraint by copying the given one.
        Parameters:
        toCopy - The BETWEEN constraint to copy.
        Throws:
        java.lang.Exception - If there is an error during the copy.
    • Method Detail

      • getLeftOperand

        public final ADQLOperand getLeftOperand()
        Gets the left operand of this BETWEEN constraint.
        Returns:
        Its left operand.
      • setLeftOperand

        public void setLeftOperand​(ADQLOperand leftOperand)
                            throws java.lang.NullPointerException
        Replaces the left operand of this BETWEEN constraint.
        Parameters:
        leftOperand - Its new left operand.
        Throws:
        java.lang.NullPointerException - If the given operand is null.
      • getMinOperand

        public final ADQLOperand getMinOperand()
        Gets the operand which represents the minimum value.
        Returns:
        Its minimum value.
      • setMinOperand

        public void setMinOperand​(ADQLOperand minOperand)
                           throws java.lang.NullPointerException
        Replaces the operand which represents the minimum value.
        Parameters:
        minOperand - Its new minimum value.
        Throws:
        java.lang.NullPointerException - If the given operand is null.
      • getMaxOperand

        public final ADQLOperand getMaxOperand()
        Gets the operand which represents the maximum value.
        Returns:
        Its maximum value.
      • setMaxOperand

        public void setMaxOperand​(ADQLOperand maxOperand)
                           throws java.lang.NullPointerException
        Replaces the operand which represents the maximum value.
        Parameters:
        maxOperand - Its new maximum value.
        Throws:
        java.lang.NullPointerException - If the given operand is null.
      • isNotBetween

        public final boolean isNotBetween()
        Tells whether the predicate is BETWEEN or NOT BETWEEN.
        Returns:
        true for NOT BETWEEN, false for BETWEEN.
      • setNotBetween

        public void setNotBetween​(boolean notBetween)
        Lets indicating the predicate to use (BETWEEN or NOT BETWEEN).
        Parameters:
        notBetween - true for NOT BETWEEN, false for BETWEEN.
      • 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)
        Set the position of this Between in the given ADQL query string.
        Parameters:
        position - New position of this Between.
        Since:
        1.4
      • 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
        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
        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
        Returns:
        The corresponding ADQL expression.