|
|||||||||
| PREV CLASS NEXT CLASS | FRAMES NO FRAMES | ||||||||
| SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD | ||||||||
java.lang.Objectorg.helidb.lang.hasher.IntegerToIntegerHasher
public class IntegerToIntegerHasher
This is a value-preserving Integer hasher. It does not support
null values.
Hashes have a length of four bytes.
Since this object does not contain any internal state, the singleton instance
INSTANCE may be used instead of instantiating the class.
| Field Summary | |
|---|---|
static IntegerToIntegerHasher |
INSTANCE
The singleton instance. |
| Constructor Summary | |
|---|---|
IntegerToIntegerHasher()
|
|
| Method Summary | |
|---|---|
Integer |
fromBytes(byte[] barr)
Interpret the serialized hash value. |
int |
getHashLength()
Get the size of the hash in bytes. |
Integer |
hash(Integer i)
Hash the supplied value. |
boolean |
isPreservingValues()
Does the hashing operation not modify the hashed value at all? This is true if v.equals(hasher.hash(v)) for all values v
accepted by the hasher. |
byte[] |
toBytes(Integer i)
Serialize the hash to a byte array. |
| Methods inherited from class java.lang.Object |
|---|
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait |
| Field Detail |
|---|
public static final IntegerToIntegerHasher INSTANCE
| Constructor Detail |
|---|
public IntegerToIntegerHasher()
| Method Detail |
|---|
public int getHashLength()
Hasherbyte
array created by Hasher.toBytes(Comparable) and accepted by
Hasher.fromBytes(byte[]).
getHashLength in interface Hasher<Integer,Integer>public byte[] toBytes(Integer i)
Hasher
For a given Hasher object, the byte arrays returned by this
method must always be of the same size.
toBytes in interface Hasher<Integer,Integer>i - The hash to serialize.
public Integer fromBytes(byte[] barr)
Hasher
fromBytes in interface Hasher<Integer,Integer>barr - The serialized hash value.
public Integer hash(Integer i)
HasherHashing may be a fairly expensive operation, depending on the implementation. Clients should try to reuse the result from this method as much as possible.
hash in interface Hasher<Integer,Integer>i - The value to hash.
public boolean isPreservingValues()
Hashertrue if v.equals(hasher.hash(v)) for all values v
accepted by the hasher.
isPreservingValues in interface Hasher<Integer,Integer>true, always.
|
|||||||||
| PREV CLASS NEXT CLASS | FRAMES NO FRAMES | ||||||||
| SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD | ||||||||