Package io.deephaven.function
Class BinSearch
java.lang.Object
io.deephaven.function.BinSearch
Functions for performing binary searches.
-
Constructor Summary
Constructors -
Method Summary
Modifier and TypeMethodDescriptionstatic intbinSearchIndex(byte[] values, byte key, BinSearchAlgo choiceWhenEquals) Performs a binary search to find a key.static intbinSearchIndex(char[] values, char key, BinSearchAlgo choiceWhenEquals) Performs a binary search to find a key.static intbinSearchIndex(double[] values, double key, BinSearchAlgo choiceWhenEquals) Performs a binary search to find a key.static intbinSearchIndex(float[] values, float key, BinSearchAlgo choiceWhenEquals) Performs a binary search to find a key.static intbinSearchIndex(int[] values, int key, BinSearchAlgo choiceWhenEquals) Performs a binary search to find a key.static intbinSearchIndex(long[] values, long key, BinSearchAlgo choiceWhenEquals) Performs a binary search to find a key.static intbinSearchIndex(short[] values, short key, BinSearchAlgo choiceWhenEquals) Performs a binary search to find a key.static intbinSearchIndex(ByteVector values, byte key, BinSearchAlgo choiceWhenEquals) Performs a binary search to find a key.static intbinSearchIndex(CharVector values, char key, BinSearchAlgo choiceWhenEquals) Performs a binary search to find a key.static intbinSearchIndex(DoubleVector values, double key, BinSearchAlgo choiceWhenEquals) Performs a binary search to find a key.static intbinSearchIndex(FloatVector values, float key, BinSearchAlgo choiceWhenEquals) Performs a binary search to find a key.static intbinSearchIndex(IntVector values, int key, BinSearchAlgo choiceWhenEquals) Performs a binary search to find a key.static intbinSearchIndex(LongVector values, long key, BinSearchAlgo choiceWhenEquals) Performs a binary search to find a key.static <T extends Comparable<? super T>>
intbinSearchIndex(ObjectVector<T> values, T key, BinSearchAlgo choiceWhenEquals) Performs a binary search to find a key.static intbinSearchIndex(ShortVector values, short key, BinSearchAlgo choiceWhenEquals) Performs a binary search to find a key.static <T extends Comparable<? super T>>
intbinSearchIndex(T[] values, T key, BinSearchAlgo choiceWhenEquals) Performs a binary search to find a key.static intrawBinSearchIndex(byte[] values, byte key, BinSearchAlgo choiceWhenEquals) Performs a binary search to find a key.static intrawBinSearchIndex(char[] values, char key, BinSearchAlgo choiceWhenEquals) Performs a binary search to find a key.static intrawBinSearchIndex(double[] values, double key, BinSearchAlgo choiceWhenEquals) Performs a binary search to find a key.static intrawBinSearchIndex(float[] values, float key, BinSearchAlgo choiceWhenEquals) Performs a binary search to find a key.static intrawBinSearchIndex(int[] values, int key, BinSearchAlgo choiceWhenEquals) Performs a binary search to find a key.static intrawBinSearchIndex(long[] values, long key, BinSearchAlgo choiceWhenEquals) Performs a binary search to find a key.static intrawBinSearchIndex(short[] values, short key, BinSearchAlgo choiceWhenEquals) Performs a binary search to find a key.static intrawBinSearchIndex(ByteVector values, byte key, BinSearchAlgo choiceWhenEquals) Performs a binary search to find a key.static intrawBinSearchIndex(CharVector values, char key, BinSearchAlgo choiceWhenEquals) Performs a binary search to find a key.static intrawBinSearchIndex(DoubleVector values, double key, BinSearchAlgo choiceWhenEquals) Performs a binary search to find a key.static intrawBinSearchIndex(FloatVector values, float key, BinSearchAlgo choiceWhenEquals) Performs a binary search to find a key.static intrawBinSearchIndex(IntVector values, int key, BinSearchAlgo choiceWhenEquals) Performs a binary search to find a key.static intrawBinSearchIndex(LongVector values, long key, BinSearchAlgo choiceWhenEquals) Performs a binary search to find a key.static <T extends Comparable<? super T>>
intrawBinSearchIndex(ObjectVector<T> values, T key, BinSearchAlgo choiceWhenEquals) Performs a binary search to find a key.static intrawBinSearchIndex(ShortVector values, short key, BinSearchAlgo choiceWhenEquals) Performs a binary search to find a key.static <T extends Comparable<? super T>>
intrawBinSearchIndex(T[] values, T key, BinSearchAlgo choiceWhenEquals) Performs a binary search to find a key.
-
Constructor Details
-
BinSearch
public BinSearch()
-
-
Method Details
-
binSearchIndex
public static <T extends Comparable<? super T>> int binSearchIndex(T[] values, T key, BinSearchAlgo choiceWhenEquals) Performs a binary search to find a key.- Parameters:
values- sorted values to search. Null values are not supported.key- key to search for. Null keys are not supported.choiceWhenEquals- algorithm used to resolve ties when performing a binary search.- Returns:
- index of the search key, if it is contained in the array; otherwise, the index of where the key would be inserted.
-
binSearchIndex
public static <T extends Comparable<? super T>> int binSearchIndex(ObjectVector<T> values, T key, BinSearchAlgo choiceWhenEquals) Performs a binary search to find a key.- Parameters:
values- sorted values to search. Null values are not supported.key- key to search for. Null keys are not supported.choiceWhenEquals- algorithm used to resolve ties when performing a binary search.- Returns:
- index of the search key, if it is contained in the array; otherwise, the index of where the key would be inserted.
-
rawBinSearchIndex
public static <T extends Comparable<? super T>> int rawBinSearchIndex(T[] values, T key, BinSearchAlgo choiceWhenEquals) Performs a binary search to find a key.- Parameters:
values- sorted values to search. Null values are not supported.key- key to search for. Null keys are not supported.choiceWhenEquals- algorithm used to resolve ties when performing a binary search.- Returns:
- index of the search key, if it is contained in the array; otherwise,
(-(insertion point) - 1).
-
rawBinSearchIndex
public static <T extends Comparable<? super T>> int rawBinSearchIndex(ObjectVector<T> values, T key, BinSearchAlgo choiceWhenEquals) Performs a binary search to find a key.- Parameters:
values- sorted values to search. Null values are not supported.key- key to search for. Null keys are not supported.choiceWhenEquals- algorithm used to resolve ties when performing a binary search.- Returns:
- index of the search key, if it is contained in the array; otherwise,
(-(insertion point) - 1).
-
binSearchIndex
Performs a binary search to find a key.- Parameters:
values- sorted values to search. Null values are not supported.key- key to search for. Null keys are not supported.choiceWhenEquals- algorithm used to resolve ties when performing a binary search.- Returns:
- index of the search key, if it is contained in the array; otherwise, the index immediately before where the key would be inserted.
-
binSearchIndex
Performs a binary search to find a key.- Parameters:
values- sorted values to search. Null values are not supported.key- key to search for. Null keys are not supported.choiceWhenEquals- algorithm used to resolve ties when performing a binary search.- Returns:
- index of the search key, if it is contained in the array; otherwise, the index of where the key would be inserted.
-
rawBinSearchIndex
Performs a binary search to find a key.- Parameters:
values- sorted values to search. Null values are not supported.key- key to search for. Null keys are not supported.choiceWhenEquals- algorithm used to resolve ties when performing a binary search.- Returns:
- index of the search key, if it is contained in the array; otherwise,
(-(insertion point) - 1).
-
rawBinSearchIndex
Performs a binary search to find a key.- Parameters:
values- sorted values to search. Null values are not supported.key- key to search for. Null keys are not supported.choiceWhenEquals- algorithm used to resolve ties when performing a binary search.- Returns:
- index of the search key, if it is contained in the array; otherwise,
(-(insertion point) - 1).
-
binSearchIndex
Performs a binary search to find a key.- Parameters:
values- sorted values to search. Null values are not supported.key- key to search for. Null keys are not supported.choiceWhenEquals- algorithm used to resolve ties when performing a binary search.- Returns:
- index of the search key, if it is contained in the array; otherwise, the index immediately before where the key would be inserted.
-
binSearchIndex
Performs a binary search to find a key.- Parameters:
values- sorted values to search. Null values are not supported.key- key to search for. Null keys are not supported.choiceWhenEquals- algorithm used to resolve ties when performing a binary search.- Returns:
- index of the search key, if it is contained in the array; otherwise, the index of where the key would be inserted.
-
rawBinSearchIndex
Performs a binary search to find a key.- Parameters:
values- sorted values to search. Null values are not supported.key- key to search for. Null keys are not supported.choiceWhenEquals- algorithm used to resolve ties when performing a binary search.- Returns:
- index of the search key, if it is contained in the array; otherwise,
(-(insertion point) - 1).
-
rawBinSearchIndex
Performs a binary search to find a key.- Parameters:
values- sorted values to search. Null values are not supported.key- key to search for. Null keys are not supported.choiceWhenEquals- algorithm used to resolve ties when performing a binary search.- Returns:
- index of the search key, if it is contained in the array; otherwise,
(-(insertion point) - 1).
-
binSearchIndex
Performs a binary search to find a key.- Parameters:
values- sorted values to search. Null values are not supported.key- key to search for. Null keys are not supported.choiceWhenEquals- algorithm used to resolve ties when performing a binary search.- Returns:
- index of the search key, if it is contained in the array; otherwise, the index immediately before where the key would be inserted.
-
binSearchIndex
Performs a binary search to find a key.- Parameters:
values- sorted values to search. Null values are not supported.key- key to search for. Null keys are not supported.choiceWhenEquals- algorithm used to resolve ties when performing a binary search.- Returns:
- index of the search key, if it is contained in the array; otherwise, the index of where the key would be inserted.
-
rawBinSearchIndex
Performs a binary search to find a key.- Parameters:
values- sorted values to search. Null values are not supported.key- key to search for. Null keys are not supported.choiceWhenEquals- algorithm used to resolve ties when performing a binary search.- Returns:
- index of the search key, if it is contained in the array; otherwise,
(-(insertion point) - 1).
-
rawBinSearchIndex
Performs a binary search to find a key.- Parameters:
values- sorted values to search. Null values are not supported.key- key to search for. Null keys are not supported.choiceWhenEquals- algorithm used to resolve ties when performing a binary search.- Returns:
- index of the search key, if it is contained in the array; otherwise,
(-(insertion point) - 1).
-
binSearchIndex
Performs a binary search to find a key.- Parameters:
values- sorted values to search. Null values are not supported.key- key to search for. Null keys are not supported.choiceWhenEquals- algorithm used to resolve ties when performing a binary search.- Returns:
- index of the search key, if it is contained in the array; otherwise, the index immediately before where the key would be inserted.
-
binSearchIndex
Performs a binary search to find a key.- Parameters:
values- sorted values to search. Null values are not supported.key- key to search for. Null keys are not supported.choiceWhenEquals- algorithm used to resolve ties when performing a binary search.- Returns:
- index of the search key, if it is contained in the array; otherwise, the index of where the key would be inserted.
-
rawBinSearchIndex
Performs a binary search to find a key.- Parameters:
values- sorted values to search. Null values are not supported.key- key to search for. Null keys are not supported.choiceWhenEquals- algorithm used to resolve ties when performing a binary search.- Returns:
- index of the search key, if it is contained in the array; otherwise,
(-(insertion point) - 1).
-
rawBinSearchIndex
Performs a binary search to find a key.- Parameters:
values- sorted values to search. Null values are not supported.key- key to search for. Null keys are not supported.choiceWhenEquals- algorithm used to resolve ties when performing a binary search.- Returns:
- index of the search key, if it is contained in the array; otherwise,
(-(insertion point) - 1).
-
binSearchIndex
Performs a binary search to find a key.- Parameters:
values- sorted values to search. Null values are not supported.key- key to search for. Null keys are not supported.choiceWhenEquals- algorithm used to resolve ties when performing a binary search.- Returns:
- index of the search key, if it is contained in the array; otherwise, the index immediately before where the key would be inserted.
-
binSearchIndex
Performs a binary search to find a key.- Parameters:
values- sorted values to search. Null values are not supported.key- key to search for. Null keys are not supported.choiceWhenEquals- algorithm used to resolve ties when performing a binary search.- Returns:
- index of the search key, if it is contained in the array; otherwise, the index of where the key would be inserted.
-
rawBinSearchIndex
Performs a binary search to find a key.- Parameters:
values- sorted values to search. Null values are not supported.key- key to search for. Null keys are not supported.choiceWhenEquals- algorithm used to resolve ties when performing a binary search.- Returns:
- index of the search key, if it is contained in the array; otherwise,
(-(insertion point) - 1).
-
rawBinSearchIndex
Performs a binary search to find a key.- Parameters:
values- sorted values to search. Null values are not supported.key- key to search for. Null keys are not supported.choiceWhenEquals- algorithm used to resolve ties when performing a binary search.- Returns:
- index of the search key, if it is contained in the array; otherwise,
(-(insertion point) - 1).
-
binSearchIndex
Performs a binary search to find a key.- Parameters:
values- sorted values to search. Null values are not supported.key- key to search for. Null keys are not supported.choiceWhenEquals- algorithm used to resolve ties when performing a binary search.- Returns:
- index of the search key, if it is contained in the array; otherwise, the index immediately before where the key would be inserted.
-
binSearchIndex
Performs a binary search to find a key.- Parameters:
values- sorted values to search. Null values are not supported.key- key to search for. Null keys are not supported.choiceWhenEquals- algorithm used to resolve ties when performing a binary search.- Returns:
- index of the search key, if it is contained in the array; otherwise, the index of where the key would be inserted.
-
rawBinSearchIndex
Performs a binary search to find a key.- Parameters:
values- sorted values to search. Null values are not supported.key- key to search for. Null keys are not supported.choiceWhenEquals- algorithm used to resolve ties when performing a binary search.- Returns:
- index of the search key, if it is contained in the array; otherwise,
(-(insertion point) - 1).
-
rawBinSearchIndex
Performs a binary search to find a key.- Parameters:
values- sorted values to search. Null values are not supported.key- key to search for. Null keys are not supported.choiceWhenEquals- algorithm used to resolve ties when performing a binary search.- Returns:
- index of the search key, if it is contained in the array; otherwise,
(-(insertion point) - 1).
-
binSearchIndex
Performs a binary search to find a key.- Parameters:
values- sorted values to search. Null values are not supported.key- key to search for. Null keys are not supported.choiceWhenEquals- algorithm used to resolve ties when performing a binary search.- Returns:
- index of the search key, if it is contained in the array; otherwise, the index immediately before where the key would be inserted.
-
binSearchIndex
Performs a binary search to find a key.- Parameters:
values- sorted values to search. Null values are not supported.key- key to search for. Null keys are not supported.choiceWhenEquals- algorithm used to resolve ties when performing a binary search.- Returns:
- index of the search key, if it is contained in the array; otherwise, the index of where the key would be inserted.
-
rawBinSearchIndex
Performs a binary search to find a key.- Parameters:
values- sorted values to search. Null values are not supported.key- key to search for. Null keys are not supported.choiceWhenEquals- algorithm used to resolve ties when performing a binary search.- Returns:
- index of the search key, if it is contained in the array; otherwise,
(-(insertion point) - 1).
-
rawBinSearchIndex
public static int rawBinSearchIndex(DoubleVector values, double key, BinSearchAlgo choiceWhenEquals) Performs a binary search to find a key.- Parameters:
values- sorted values to search. Null values are not supported.key- key to search for. Null keys are not supported.choiceWhenEquals- algorithm used to resolve ties when performing a binary search.- Returns:
- index of the search key, if it is contained in the array; otherwise,
(-(insertion point) - 1).
-