jdsl.core.ref
Class IntegerHashComparator

java.lang.Object
  |
  +--jdsl.core.ref.IntegerHashComparator
All Implemented Interfaces:
EqualityComparator, HashComparator

public class IntegerHashComparator
extends java.lang.Object
implements HashComparator

An implementation of a HashComparator for java.lang.Integers

Version:
$Id: IntegerHashComparator.java,v 1.3 1999/08/12 16:40:09 kas Exp $
Author:
Keith Schmidt (kas)

Constructor Summary
IntegerHashComparator()
           
 
Method Summary
 int hashValue(java.lang.Object toHash)
          defines a mapping f: Integer -> \mathbb{Z} \cap [0, 2^{31} -1]
 boolean isComparable(java.lang.Object toCompare)
          determines if the Comparator can use this Object
 boolean isEqualTo(java.lang.Object first, java.lang.Object second)
          tests equality on two Integers
 
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
 

Constructor Detail

IntegerHashComparator

public IntegerHashComparator()
Method Detail

isComparable

public boolean isComparable(java.lang.Object toCompare)
determines if the Comparator can use this Object
Specified by:
isComparable in interface EqualityComparator
Following copied from interface: jdsl.core.api.EqualityComparator
Parameters:
o - Any java.lang.Object
Returns:
True if and only if this comparator may compare this object.

isEqualTo

public boolean isEqualTo(java.lang.Object first,
                         java.lang.Object second)
                  throws java.lang.ClassCastException
tests equality on two Integers
Specified by:
isEqualTo in interface EqualityComparator
Throws:
java.lang.ClassCastException -  

hashValue

public int hashValue(java.lang.Object toHash)
              throws java.lang.ClassCastException
defines a mapping f: Integer -> \mathbb{Z} \cap [0, 2^{31} -1]
Specified by:
hashValue in interface HashComparator
Throws:
java.lang.ClassCastException -