public abstract class AbstractSearchIndex extends Object implements ISearchIndex
Abstract class for index search algorithm with a coupled dichotomy-BinarySearch algorithms.
IMPORTANT: the tab passed in the constructor has to be sorted by increasing order. Duplicates are allowed. If this tab is not sorting, no exception will be thrown, but the results can be totally wrong.
Each implementation of this class defines a convention of SearchIndexIntervalConvention.ISearchIndex.SearchIndexIntervalConvention
Modifier and Type | Field and Description |
---|---|
protected ISearchIndex.SearchIndexIntervalConvention |
convention
The convention for the definition of intervals.
|
protected int |
iMax
The upper bound of tab to consider for the search index algorithm.
|
protected int |
iMin
The lower bound of tab to consider for the search index algorithm.
|
protected double[] |
tab
The values in with the search algorithm will be executed.
|
Constructor and Description |
---|
AbstractSearchIndex(double[] tab2)
Default constructor with default CLOSED_OPEN convention.
|
AbstractSearchIndex(double[] tab2,
ISearchIndex.SearchIndexIntervalConvention searchIndexConvention)
Constructor with defined interval convention.
|
Modifier and Type | Method and Description |
---|---|
ISearchIndex.SearchIndexIntervalConvention |
getConvention()
Returns the convention that can be applied to the interval during the search index algorithm.
|
double[] |
getTab()
Returns the array of values.
|
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
getIndex, getIndex
protected double[] tab
protected int iMin
protected int iMax
protected ISearchIndex.SearchIndexIntervalConvention convention
public AbstractSearchIndex(double[] tab2)
tab2
- : a double[] array sorted by increasing order. Duplicates are allowed.public AbstractSearchIndex(double[] tab2, ISearchIndex.SearchIndexIntervalConvention searchIndexConvention)
tab2
- : a sorted double[]searchIndexConvention
- interval conventionpublic double[] getTab()
getTab
in interface ISearchIndex
public ISearchIndex.SearchIndexIntervalConvention getConvention()
getConvention
in interface ISearchIndex
Copyright © 2019 CNES. All rights reserved.