public interface ISearchIndex extends Serializable
Interfaces for optimized indices search algorithm.
Each class that implements this interface will have at least two constructors : - one with a double[] as a parameter and an enumerate SearchIndexIntervalConvention - one with a double[] as a parameter. In that case, the enumerate SearchIndexIntervalConvention is set to CLOSED_OPEN by default.
IMPORTANT: the input double[] should already be sorted by increasing order. If this input tab is not sorted, no exception will be thrown, but the results can be totally wrong. Duplicates are allowed.
The input double[] should not be modified by the interface implementations.
The enumerate ISearchIndex.SearchIndexIntervalConvention
defines the implementing of the method getIndex that should
respect the following convention :
Modifier and Type | Interface and Description |
---|---|
static class |
ISearchIndex.SearchIndexIntervalConvention
Describes the shape of an interval.
|
Modifier and Type | Method and Description |
---|---|
ISearchIndex.SearchIndexIntervalConvention |
getConvention()
Returns the convention that can be applied to the interval during the search index algorithm.
|
int |
getIndex(double x)
Returns the index of x in a tab depending on the convention used.
|
int |
getIndex(double x,
int iMin,
int iMax)
Returns the index of x in the extracted tab [tab[iMin], tab[iMax]]
depending on the convention used.
|
double[] |
getTab()
Returns the array of values.
|
int getIndex(double x)
x
- : the value to search.int getIndex(double x, int iMin, int iMax)
x
- : the value to search.iMin
- : defines the lower bound of the tab for the search.iMax
- : defines the upper bound of the tab for the search.ISearchIndex.SearchIndexIntervalConvention getConvention()
double[] getTab()
Copyright © 2020 CNES. All rights reserved.