Enum GenericInequalitySearch.Inequality

    • Enum Constant Summary

      Enum Constants 
      Enum Constant Description
      EQ
      Given a sorted array of increasing values arr[] and a key value V, this criterion instructs the binary search algorithm to find the adjacent pair of values {A,B} such that A ≤ V ≤ B.
      GE
      Given a sorted array of increasing values arr[] and a key value V, this criterion instructs the binary search algorithm to find the lowest adjacent pair of values {A,B} such that A < V ≤ B.
      Let low = index of the lowest value in the range.
      Let high = index of the highest value in the range.
      GT
      Given a sorted array of increasing values arr[] and a key value V, this criterion instructs the binary search algorithm to find the lowest adjacent pair of values {A,B} such that A ≤ V < B.
      Let low = index of the lowest value in the range.
      Let high = index of the highest value in the range.
      LE
      Given a sorted array of increasing values arr[] and a key value V, this criterion instructs the binary search algorithm to find the highest adjacent pair of values {A,B} such that A ≤ V < B.
      Let low = index of the lowest value in the range.
      Let high = index of the highest value in the range.
      LT
      Given a sorted array of increasing values arr[] and a key value v, this criterion instructs the binary search algorithm to find the highest adjacent pair of values {A,B} such that A < v ≤ B.
      Let low = index of the lowest value in the range.
      Let high = index of the highest value in the range.
    • Enum Constant Detail

      • LT

        public static final GenericInequalitySearch.Inequality LT
        Given a sorted array of increasing values arr[] and a key value v, this criterion instructs the binary search algorithm to find the highest adjacent pair of values {A,B} such that A < v ≤ B.
        Let low = index of the lowest value in the range.
        Let high = index of the highest value in the range.

        If v > arr[high], return arr[high].
        If v ≤ arr[low], return -1.
        Else return index of A.

      • LE

        public static final GenericInequalitySearch.Inequality LE
        Given a sorted array of increasing values arr[] and a key value V, this criterion instructs the binary search algorithm to find the highest adjacent pair of values {A,B} such that A ≤ V < B.
        Let low = index of the lowest value in the range.
        Let high = index of the highest value in the range.

        If v ≥ arr[high], return arr[high].
        If v < arr[low], return -1.
        Else return index of A.

      • EQ

        public static final GenericInequalitySearch.Inequality EQ
        Given a sorted array of increasing values arr[] and a key value V, this criterion instructs the binary search algorithm to find the adjacent pair of values {A,B} such that A ≤ V ≤ B. The returned value from the binary search algorithm will be the index of A or B, if one of them is equal to V, or -1 if V is not equal to either one.
      • GE

        public static final GenericInequalitySearch.Inequality GE
        Given a sorted array of increasing values arr[] and a key value V, this criterion instructs the binary search algorithm to find the lowest adjacent pair of values {A,B} such that A < V ≤ B.
        Let low = index of the lowest value in the range.
        Let high = index of the highest value in the range.

        If v ≤ arr[low], return arr[low].
        If v > arr[high], return -1.
        Else return index of B.

      • GT

        public static final GenericInequalitySearch.Inequality GT
        Given a sorted array of increasing values arr[] and a key value V, this criterion instructs the binary search algorithm to find the lowest adjacent pair of values {A,B} such that A ≤ V < B.
        Let low = index of the lowest value in the range.
        Let high = index of the highest value in the range.

        If v < arr[low], return arr[low].
        If v ≥ arr[high], return -1.
        Else return index of B.

    • Method Detail

      • values

        public static GenericInequalitySearch.Inequality[] values()
        Returns an array containing the constants of this enum type, in the order they are declared. This method may be used to iterate over the constants as follows:
        for (GenericInequalitySearch.Inequality c : GenericInequalitySearch.Inequality.values())
            System.out.println(c);
        
        Returns:
        an array containing the constants of this enum type, in the order they are declared
      • valueOf

        public static GenericInequalitySearch.Inequality valueOf​(String name)
        Returns the enum constant of this type with the specified name. The string must match exactly an identifier used to declare an enum constant in this type. (Extraneous whitespace characters are not permitted.)
        Parameters:
        name - the name of the enum constant to be returned.
        Returns:
        the enum constant with the specified name
        Throws:
        IllegalArgumentException - if this enum type has no constant with the specified name
        NullPointerException - if the argument is null