|
|||||||||
| PREV CLASS NEXT CLASS | FRAMES NO FRAMES | ||||||||
| SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD | ||||||||
java.lang.Objectorg.helidb.lang.hasher.CharacterToCharacterHasher
public class CharacterToCharacterHasher
This is a value-preserving Character hasher. It does not support
null values.
Hashes have a length of two 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 CharacterToCharacterHasher |
INSTANCE
The singleton instance. |
| Constructor Summary | |
|---|---|
CharacterToCharacterHasher()
|
|
| Method Summary | |
|---|---|
Character |
fromBytes(byte[] barr)
Interpret the serialized hash value. |
int |
getHashLength()
Get the size of the hash in bytes. |
Character |
hash(Character c)
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(Character c)
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 CharacterToCharacterHasher INSTANCE
| Constructor Detail |
|---|
public CharacterToCharacterHasher()
| Method Detail |
|---|
public int getHashLength()
Hasherbyte
array created by Hasher.toBytes(Comparable) and accepted by
Hasher.fromBytes(byte[]).
getHashLength in interface Hasher<Character,Character>public byte[] toBytes(Character c)
Hasher
For a given Hasher object, the byte arrays returned by this
method must always be of the same size.
toBytes in interface Hasher<Character,Character>c - The hash to serialize.
public Character fromBytes(byte[] barr)
Hasher
fromBytes in interface Hasher<Character,Character>barr - The serialized hash value.
public Character hash(Character c)
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<Character,Character>c - 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<Character,Character>true, always.
|
|||||||||
| PREV CLASS NEXT CLASS | FRAMES NO FRAMES | ||||||||
| SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD | ||||||||