public final class SearchIndexLibrary extends Object
ISearchIndex.SearchIndexIntervalConvention
.Modifier and Type | Method and Description |
---|---|
static int |
binarySearchClosedOpen(double[] tab,
double key,
int iMin,
int iMax)
Searches the index corresponding to the parameter key inside [tab[iMin], tab[iMax]]
with the default convention CLOSED_OPEN, meaning that interval considered are
[ tab[i], tab[i+1] [ and therefore, if x = tab[i], the integer returned is i.
|
static int |
binarySearchOpenClosed(double[] tab,
double key,
int iMin,
int iMax)
Searches the index corresponding to the parameter key inside [tab[iMin], tab[iMax]]
with the convention OPEN_CLOSED, meaning that interval considered are
] tab[i], tab[i+1] ] and therefore, if x = tab[i], the integer returned is i-1.
|
static int |
midPoint(int iMin,
int iMax)
Returns the index of a middle point of segment [iMin, iMax]
|
public static int midPoint(int iMin, int iMax)
iMin
- : the lower bound of the intervaliMax
- : the upper bound of the intervalpublic static int binarySearchClosedOpen(double[] tab, double key, int iMin, int iMax)
tab
- : the double[] already sorted.key
- : the double searched inside [tab[iMin], tab[iMax]]iMin
- : the lower bound of tab considered. If key < tab[iMin], the integer returned is iMin - 1iMax
- : the lower bound of tab considered. If key >=tab[iMax], the integer returned is iMax.
As a consequence, a method using an index returned by binarySearchClosedOpen should consider two
behavior
if index = iMax. It can be either key = tab[iMax] or key > tab[iMax].public static int binarySearchOpenClosed(double[] tab, double key, int iMin, int iMax)
tab
- : the double[] already sorted.key
- : the double searched inside [tab[iMin], tab[iMax]]iMin
- : the lower bound of tab considered. If key <= tab[iMin], the integer returned is iMin - 1iMax
- : the lower bound of tab considered. If key > tab[iMax], the integer returned is iMax.
As a consequence, a method using an index returned by binarySearchClosedOpen should consider two
behavior
if index = iMin - 1. It can be either key = tab[iMin] or key < tab[iMin]Copyright © 2021 CNES. All rights reserved.