oracle.bali.share.sort
Class Search
java.lang.Object
|
+--oracle.bali.share.sort.Search
- public abstract class Search
- extends java.lang.Object
Oracle Bali searching utility class.
Method Summary |
static int |
bSearch(java.lang.Object key,
java.lang.Object[] items,
int nitems,
Comparator comparator)
Performs a binary search lookup for an item in a sorted array. |
static int |
bSearchAndInsert(java.lang.Object key,
java.lang.Object[] items,
int nitems,
Comparator comparator)
Performs a binary search lookup, inserting the specified item if it is
not already present. |
Methods inherited from class java.lang.Object |
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait |
ITEM_NOT_FOUND
public static final int ITEM_NOT_FOUND
Search
public Search()
bSearch
public static int bSearch(java.lang.Object key,
java.lang.Object[] items,
int nitems,
Comparator comparator)
- Performs a binary search lookup for an item in a sorted array.
- Parameters:
key
- The object to locateitems
- The sorted array to look innitems
- The number of items in the array. This may not be larger
than item.length.comparator
- The comparator to use to determine the relative
ordering of two items.
- See Also:
Comparator
bSearchAndInsert
public static int bSearchAndInsert(java.lang.Object key,
java.lang.Object[] items,
int nitems,
Comparator comparator)
- Performs a binary search lookup, inserting the specified item if it is
not already present.
- Parameters:
key
- The object to locateitems
- The sorted array to look innitems
- The number of items in the array. This must be less than
than item.length. The caller is responsible for ensuring that there
is enough space in the array to insert a new item.comparator
- The comparator to use to determine the relative
ordering of two items.
- See Also:
Comparator