goldman.collection
Interface Bucketizer<E>

All Superinterfaces:
Comparator<E>
All Known Implementing Classes:
DefaultBucketizer

public interface Bucketizer<E>
extends Comparator<E>

The Bucketizer interface provides an application with a mechanism to specify a way to partition all possible elements in a collection into a set of groups (or buckets). A combination of the ordering implicitly defined between buckets and the comparator used within the buckets defines a total order over the elements.


Method Summary
 int getBucket(E x)
          Returns the bucket to which element x belongs.
 int getNumBuckets()
          Returns the number of buckets used.
 
Methods inherited from interface java.util.Comparator
compare, equals
 

Method Detail

getNumBuckets

int getNumBuckets()
Returns the number of buckets used.


getBucket

int getBucket(E x)
Returns the bucket to which element x belongs. The value returned must be an integer in the range 0 to getNumBuckets() - 1.