|
||||||||||
PREV CLASS NEXT CLASS | FRAMES NO FRAMES | |||||||||
SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD |
java.lang.Object nz.ac.waikato.jdsl.core.ref.ObjectHashComparator
public class ObjectHashComparator
Implements the JDSL HashComparator interface in terms of Java's native Object methods equals(.) and hashCode().
Constructor Summary | |
---|---|
ObjectHashComparator()
|
Method Summary | |
---|---|
int |
hashValue(java.lang.Object o)
Returns the hash code value to be used for the object in this comparator. |
boolean |
isComparable(java.lang.Object o)
Allows a container (or any client) to find out whether an object is a member of the ordered set over which this comparator is defined. |
boolean |
isEqualTo(java.lang.Object x1,
java.lang.Object x2)
returns x1.equals(x2) |
Methods inherited from class java.lang.Object |
---|
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait |
Constructor Detail |
---|
public ObjectHashComparator()
Method Detail |
---|
public boolean isComparable(java.lang.Object o)
EqualityComparator
isComparable
in interface EqualityComparator
o
- Object you propose to compare with this comparator
public boolean isEqualTo(java.lang.Object x1, java.lang.Object x2) throws java.lang.ClassCastException
isEqualTo
in interface EqualityComparator
x1
- the reference object in the comparison.x2
- the object tested against the reference object.
java.lang.ClassCastException
- If either object passed in as a parameter
is not a member of the set over which the comparator is defined.public int hashValue(java.lang.Object o)
HashComparator
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.
hashValue
in interface HashComparator
o
- Object for which you desire a hash value
|
||||||||||
PREV CLASS NEXT CLASS | FRAMES NO FRAMES | |||||||||
SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD |