T - type of items held in the listK - type of the keys used to search the listL - type of the list containing the itemspublic abstract class SearchBase<T,K,L> extends Object
| Constructor and Description |
|---|
SearchBase() |
| Modifier and Type | Method and Description |
|---|---|
SearchResult |
binarySearch(L list,
K key)
Core implementation of the binary search.
|
protected abstract int |
compareTo(T item,
K key)
Compares the key to the item.
|
protected abstract int |
getCount(L list)
Gets the count of items in the list.
|
protected abstract T |
getValue(L list,
int index)
Used to access list values by index in the list.
|
protected abstract int getCount(L list)
list - whose is to be returnedprotected abstract T getValue(L list, int index) throws IOException
list - whose value is to be returnedindex - of the value to returnIOException - if there was a problem accessing data file.protected abstract int compareTo(T item, K key) throws IOException
item - to be compared against the key.key - to compare to the item.IOException - if there was a problem accessing data file.public SearchResult binarySearch(L list, K key) throws IOException
list - list ordered in ascending key valuekey - to be found in the listIOException - if there was a problem accessing data file.Copyright © 2015 51Degrees. All rights reserved.