visad.data.in
Class MD5Key

java.lang.Object
  extended by visad.data.in.MD5Key

public class MD5Key
extends Object

Provides support for computing an MD5 key for an object. Such a key may be used to obtain a hash code for an object and also supports implementation of a fast equals(Object) method for objects whose natural method might be computationally expensive.

Instances are immutable.

Author:
Steven R. Emmerson

Constructor Summary
MD5Key(Object obj)
          Constructs from an object.
MD5Key(Object[] objs)
          Constructs from an array of objects.
 
Method Summary
 boolean equals(Object obj)
          Indicates if this instance is semantically identical to another object.
 int hashCode()
          Returns the hash code of this instance.
 
Methods inherited from class java.lang.Object
clone, finalize, getClass, notify, notifyAll, toString, wait, wait, wait
 

Constructor Detail

MD5Key

public MD5Key(Object obj)
       throws IOException
Constructs from an object.

Parameters:
obj - The object to have an MD5 checksum computed for it.
Throws:
IOException - Couldn't compute MD5 checksum.

MD5Key

public MD5Key(Object[] objs)
       throws IOException
Constructs from an array of objects.

Parameters:
objs - The objects to have an MD5 checksum computed for them.
Throws:
IOException - Couldn't compute MD5 checksum.
Method Detail

equals

public boolean equals(Object obj)
Indicates if this instance is semantically identical to another object. This will be the case if the other object is also of this class and its MD5 checksum is identical to this instances MD5 checksum.

Overrides:
equals in class Object
Parameters:
obj - The other object.
Returns:
true if and only if this instance is semantically identical to the other object.

hashCode

public int hashCode()
Returns the hash code of this instance. The hash code is the hash code of the MD5 checksum.

Overrides:
hashCode in class Object
Returns:
The hash code of this instance.