jdsl.core.api
Interface  HashComparator
- All Superinterfaces: 
 - EqualityComparator
 
- All Known Implementing Classes: 
 - IntegerHashComparator, ObjectHashComparator
 
- public interface HashComparator
- extends EqualityComparator
  
This interface provides a way of mapping any object in a set
 to an integer, for purposes of implementing hash tables.   It is up
 to individual implementations to define the set over which they are
 valid and to reject those objects which they cannot convert by
 throwing ClassCastExceptions.  This interface can be trivially
 implemented with a call to Object.hashCode(), but it also allows
 separation of the hashing criterion from the object itself,
 when that is necessary.
- Version: 
 - $Id: HashComparator.java,v 1.3 2000/01/12 03:21:29 mdh Exp $
 
- Author: 
 - Luca Vismara
 
| 
Method Summary | 
 int | 
hashValue(java.lang.Object obj)
 
          Returns the hash code value to be used for the object in this
 comparator. | 
 
 
hashValue
public int hashValue(java.lang.Object obj)
              throws java.lang.ClassCastException
- Returns the hash code value to be used for the object in this
 comparator.
 
 It is expected that hashValue will return a non-negative integer
 as the hashcode of the Object, as is the custom for hashcodes.
 However, there are no unsigned types to force this.
 
- Parameters:
 obj - an object acting as a key in a hash table- Returns:
 - the hash code value of obj
 - Throws:
 java.lang.ClassCastException - if the obj is not a member of the
 set over which the comparator is defined.