Bali Share 1.1.18

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.


Field Summary
static int ITEM_NOT_FOUND
           
 
Constructor Summary
Search()
           
 
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
 

Field Detail

ITEM_NOT_FOUND

public static final int ITEM_NOT_FOUND
Constructor Detail

Search

public Search()
Method Detail

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 locate
items - The sorted array to look in
nitems - 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 locate
items - The sorted array to look in
nitems - 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

Bali Share 1.1.18