congrats Icon
New! Announcing Tabnine Chat Beta
Learn More
Tabnine Logo
BinarySearch
Code IndexAdd Tabnine to your IDE (free)

How to use
BinarySearch
in
org.apache.calcite.runtime

Best Java code snippets using org.apache.calcite.runtime.BinarySearch (Showing top 14 results out of 315)

origin: org.apache.calcite/calcite-core

/**
 * Performs binary search of the lower bound in the given array.
 * The elements in the array are transformed before the comparison.
 * It is assumed that the array is sorted.
 * The method is guaranteed to return the minimal index of the element that is
 * greater or equal to the given key.
 * @param a array that holds the values
 * @param key element to look for
 * @param keySelector function that transforms array contents to the type
 *                    of the key
 * @param comparator comparator that compares keys
 * @param <T> the type of elements in array
 * @param <K> the type of lookup key
 * @return minimal index of the element that is
 *   greater or equal to the given key. Returns -1 when all elements exceed
 *   the given key or the array is empty. Returns {@code a.length} when all
 *   elements are less than the given key.
 */
public static <T, K> int lowerBound(T[] a, K key, Function1<T, K> keySelector,
  Comparator<K> comparator) {
 return lowerBound(a, key, 0, a.length - 1, keySelector, comparator);
}
origin: Qihoo360/Quicksql

/**
 * Performs binary search of the upper bound in the given array.
 * The elements in the array are transformed before the comparison.
 * It is assumed that the array is sorted.
 * The method is guaranteed to return the maximal index of the element that is
 * less or equal to the given key.
 * @param a array that holds the values
 * @param key element to look for
 * @param keySelector function that transforms array contents to the type
 *                    of the key
 * @param comparator comparator that compares keys
 * @param <T> the type of elements in array
 * @param <K> the type of lookup key
 * @return maximal index of the element that is
 *   less or equal to the given key. Returns -1 when all elements are less
 *   than the given key or the array is empty. Returns {@code a.length} when
 *   all elements exceed the given key.
 */
public static <T, K> int upperBound(T[] a, K key, Function1<T, K> keySelector,
  Comparator<K> comparator) {
 return upperBound(a, key, 0, a.length - 1, keySelector, comparator);
}
origin: Qihoo360/Quicksql

private void search(int key, int lower, int upper, Integer... array) {
 Assert.assertEquals(
   "lower bound of " + key + " in " + Arrays.toString(array), lower,
   BinarySearch.lowerBound(array, key, Ordering.natural()));
 Assert.assertEquals(
   "upper bound of " + key + " in " + Arrays.toString(array), upper,
   BinarySearch.upperBound(array, key, Ordering.natural()));
}
origin: org.apache.calcite/calcite-core

private void search(int key, int lower, int upper, Integer... array) {
 Assert.assertEquals(
   "lower bound of " + key + " in " + Arrays.toString(array), lower,
   BinarySearch.lowerBound(array, key, Ordering.natural()));
 Assert.assertEquals(
   "upper bound of " + key + " in " + Arrays.toString(array), upper,
   BinarySearch.upperBound(array, key, Ordering.natural()));
}
origin: org.apache.calcite/calcite-core

/**
 * Performs binary search of the upper bound in the given array.
 * The elements in the array are transformed before the comparison.
 * It is assumed that the array is sorted.
 * The method is guaranteed to return the maximal index of the element that is
 * less or equal to the given key.
 * @param a array that holds the values
 * @param key element to look for
 * @param keySelector function that transforms array contents to the type
 *                    of the key
 * @param comparator comparator that compares keys
 * @param <T> the type of elements in array
 * @param <K> the type of lookup key
 * @return maximal index of the element that is
 *   less or equal to the given key. Returns -1 when all elements are less
 *   than the given key or the array is empty. Returns {@code a.length} when
 *   all elements exceed the given key.
 */
public static <T, K> int upperBound(T[] a, K key, Function1<T, K> keySelector,
  Comparator<K> comparator) {
 return upperBound(a, key, 0, a.length - 1, keySelector, comparator);
}
origin: Qihoo360/Quicksql

/**
 * Performs binary search of the lower bound in the given array.
 * The elements in the array are transformed before the comparison.
 * It is assumed that the array is sorted.
 * The method is guaranteed to return the minimal index of the element that is
 * greater or equal to the given key.
 * @param a array that holds the values
 * @param key element to look for
 * @param keySelector function that transforms array contents to the type
 *                    of the key
 * @param comparator comparator that compares keys
 * @param <T> the type of elements in array
 * @param <K> the type of lookup key
 * @return minimal index of the element that is
 *   greater or equal to the given key. Returns -1 when all elements exceed
 *   the given key or the array is empty. Returns {@code a.length} when all
 *   elements are less than the given key.
 */
public static <T, K> int lowerBound(T[] a, K key, Function1<T, K> keySelector,
  Comparator<K> comparator) {
 return lowerBound(a, key, 0, a.length - 1, keySelector, comparator);
}
origin: Qihoo360/Quicksql

/**
 * Performs binary search of the upper bound in the given array.
 * It is assumed that the array is sorted.
 * The method is guaranteed to return the maximal index of the element that is
 * less or equal to the given key.
 * @param a array that holds the values
 * @param key element to look for
 * @param comparator comparator that compares keys
 * @param <T> the type of elements in array
 * @return maximal index of the element that is
 *   less or equal to the given key. Returns -1 when all elements are less
 *   than the given key or the array is empty. Returns {@code a.length} when
 *   all elements exceed the given key.
 */
public static <T> int upperBound(T[] a, T key, Comparator<T> comparator) {
 return upperBound(a, key, 0, a.length - 1,
   Functions.identitySelector(), comparator);
}
origin: Qihoo360/Quicksql

/**
 * Performs binary search of the lower bound in the given array.
 * It is assumed that the array is sorted.
 * The method is guaranteed to return the minimal index of the element that is
 * greater or equal to the given key.
 * @param a array that holds the values
 * @param key element to look for
 * @param comparator comparator that compares keys
 * @param <T> the type of elements in array
 * @return minimal index of the element that is
 *   greater or equal to the given key. Returns -1 when all elements exceed
 *   the given key or the array is empty. Returns {@code a.length} when all
 *   elements are less than the given key.
 */
public static <T> int lowerBound(T[] a, T key, Comparator<T> comparator) {
 return lowerBound(a, key, 0, a.length - 1,
   Functions.identitySelector(), comparator);
}
origin: org.apache.calcite/calcite-core

/**
 * Performs binary search of the upper bound in the given array.
 * It is assumed that the array is sorted.
 * The method is guaranteed to return the maximal index of the element that is
 * less or equal to the given key.
 * @param a array that holds the values
 * @param key element to look for
 * @param comparator comparator that compares keys
 * @param <T> the type of elements in array
 * @return maximal index of the element that is
 *   less or equal to the given key. Returns -1 when all elements are less
 *   than the given key or the array is empty. Returns {@code a.length} when
 *   all elements exceed the given key.
 */
public static <T> int upperBound(T[] a, T key, Comparator<T> comparator) {
 return upperBound(a, key, 0, a.length - 1,
   Functions.identitySelector(), comparator);
}
origin: org.apache.calcite/calcite-core

/**
 * Performs binary search of the lower bound in the given array.
 * It is assumed that the array is sorted.
 * The method is guaranteed to return the minimal index of the element that is
 * greater or equal to the given key.
 * @param a array that holds the values
 * @param key element to look for
 * @param comparator comparator that compares keys
 * @param <T> the type of elements in array
 * @return minimal index of the element that is
 *   greater or equal to the given key. Returns -1 when all elements exceed
 *   the given key or the array is empty. Returns {@code a.length} when all
 *   elements are less than the given key.
 */
public static <T> int lowerBound(T[] a, T key, Comparator<T> comparator) {
 return lowerBound(a, key, 0, a.length - 1,
   Functions.identitySelector(), comparator);
}
origin: Qihoo360/Quicksql

/**
 * Performs binary search of the upper bound in the given array.
 * It is assumed that the array is sorted.
 * The method is guaranteed to return the maximal index of the element that is
 * less or equal to the given key.
 * @param a array that holds the values
 * @param key element to look for
 * @param imin the minimal index (inclusive) to look for
 * @param imax the maximum index (inclusive) to look for
 * @param comparator comparator that compares keys
 * @param <T> the type of elements in array
 * @return maximal index of the element that is
 *   less or equal to the given key. Returns -1 when all elements are less
 *   than the given key or the array is empty. Returns {@code a.length} when
 *   all elements exceed the given key.
 */
public static <T> int upperBound(T[] a, T key, int imin, int imax,
  Comparator<T> comparator) {
 return upperBound(a, key, imin, imax,
   Functions.identitySelector(), comparator);
}
origin: Qihoo360/Quicksql

/**
 * Performs binary search of the lower bound in the given section of array.
 * It is assumed that the array is sorted.
 * The method is guaranteed to return the minimal index of the element that is
 * greater or equal to the given key.
 * @param a array that holds the values
 * @param key element to look for
 * @param imin the minimal index (inclusive) to look for
 * @param imax the maximum index (inclusive) to look for
 * @param comparator comparator that compares keys
 * @param <T> the type of elements in array
 * @return minimal index of the element that is
 *   greater or equal to the given key. Returns -1 when all elements exceed
 *   the given key or the array is empty. Returns {@code a.length} when all
 *   elements are less than the given key.
 */
public static <T> int lowerBound(T[] a, T key, int imin, int imax,
  Comparator<T> comparator) {
 return lowerBound(a, key, imin, imax,
   Functions.identitySelector(), comparator);
}
origin: org.apache.calcite/calcite-core

/**
 * Performs binary search of the upper bound in the given array.
 * It is assumed that the array is sorted.
 * The method is guaranteed to return the maximal index of the element that is
 * less or equal to the given key.
 * @param a array that holds the values
 * @param key element to look for
 * @param imin the minimal index (inclusive) to look for
 * @param imax the maximum index (inclusive) to look for
 * @param comparator comparator that compares keys
 * @param <T> the type of elements in array
 * @return maximal index of the element that is
 *   less or equal to the given key. Returns -1 when all elements are less
 *   than the given key or the array is empty. Returns {@code a.length} when
 *   all elements exceed the given key.
 */
public static <T> int upperBound(T[] a, T key, int imin, int imax,
  Comparator<T> comparator) {
 return upperBound(a, key, imin, imax,
   Functions.identitySelector(), comparator);
}
origin: org.apache.calcite/calcite-core

/**
 * Performs binary search of the lower bound in the given section of array.
 * It is assumed that the array is sorted.
 * The method is guaranteed to return the minimal index of the element that is
 * greater or equal to the given key.
 * @param a array that holds the values
 * @param key element to look for
 * @param imin the minimal index (inclusive) to look for
 * @param imax the maximum index (inclusive) to look for
 * @param comparator comparator that compares keys
 * @param <T> the type of elements in array
 * @return minimal index of the element that is
 *   greater or equal to the given key. Returns -1 when all elements exceed
 *   the given key or the array is empty. Returns {@code a.length} when all
 *   elements are less than the given key.
 */
public static <T> int lowerBound(T[] a, T key, int imin, int imax,
  Comparator<T> comparator) {
 return lowerBound(a, key, imin, imax,
   Functions.identitySelector(), comparator);
}
org.apache.calcite.runtimeBinarySearch

Javadoc

Binary search for the implementation of RANGE BETWEEN XXX PRECEDING/FOLLOWING clause.

Most used methods

  • lowerBound
    Performs binary search of the lower bound in the given array. The elements in the array are transfor
  • upperBound
    Performs binary search of the upper bound in the given array. The elements in the array are transfor

Popular in Java

  • Reading from database using SQL prepared statement
  • onRequestPermissionsResult (Fragment)
  • compareTo (BigDecimal)
  • getSharedPreferences (Context)
  • Color (java.awt)
    The Color class is used to encapsulate colors in the default sRGB color space or colors in arbitrary
  • Window (java.awt)
    A Window object is a top-level window with no borders and no menubar. The default layout for a windo
  • BufferedWriter (java.io)
    Wraps an existing Writer and buffers the output. Expensive interaction with the underlying reader is
  • String (java.lang)
  • BigDecimal (java.math)
    An immutable arbitrary-precision signed decimal.A value is represented by an arbitrary-precision "un
  • Connection (java.sql)
    A connection represents a link from a Java application to a database. All SQL statements and results
  • Top PhpStorm plugins
Tabnine Logo
  • Products

    Search for Java codeSearch for JavaScript code
  • IDE Plugins

    IntelliJ IDEAWebStormVisual StudioAndroid StudioEclipseVisual Studio CodePyCharmSublime TextPhpStormVimGoLandRubyMineEmacsJupyter NotebookJupyter LabRiderDataGripAppCode
  • Company

    About UsContact UsCareers
  • Resources

    FAQBlogTabnine AcademyTerms of usePrivacy policyJava Code IndexJavascript Code Index
Get Tabnine for your IDE now