com.partnersoft.data
Interface ArraySearchingAlgorithm

All Known Implementing Classes:
ArrayBinarySearch, ArrayLinearSearch

public interface ArraySearchingAlgorithm

An interface for generic array (indexed item, not necessarily an actual Java array object) searching algorithms. A programmer selects an implementation of this, and an instance of ArraySearchingGopher, and it does its thing.


Method Summary
 int findClosest(ArraySearchingGopher gopher, java.lang.Object key)
          Finds the slot where the given key _would_ go if it were in there.
 int findClosest(ArraySearchingGopher gopher, java.lang.Object key, int start, int end)
          Finds the slot where the given key _would_ go if it were in there.
 int search(ArraySearchingGopher gopher, java.lang.Object key)
          Does the job using the given gopher.
 int search(ArraySearchingGopher gopher, java.lang.Object key, int start, int end)
          Does the job using the given gopher over the given range.
 

Method Detail

search

int search(ArraySearchingGopher gopher,
           java.lang.Object key)
Does the job using the given gopher. Returns -1 if key not found.


search

int search(ArraySearchingGopher gopher,
           java.lang.Object key,
           int start,
           int end)
Does the job using the given gopher over the given range. Returns -1 if key not found.


findClosest

int findClosest(ArraySearchingGopher gopher,
                java.lang.Object key)
Finds the slot where the given key _would_ go if it were in there. Always returns something.


findClosest

int findClosest(ArraySearchingGopher gopher,
                java.lang.Object key,
                int start,
                int end)
Finds the slot where the given key _would_ go if it were in there. Always returns something.