|
||||||||||
PREV CLASS NEXT CLASS | FRAMES NO FRAMES | |||||||||
SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD |
java.lang.Objectorg.egothor.duplicity.util.Hasher
public class Hasher
Simple implementation of interface UIDProducer
.
The UIDs are produced by hash function. The implementation is not perfect,
in the sense that the provided mapping from tokens to UIDs is not surjective
nor it does avoid collisions.
For the collisions let's say that as we do not know the whole set of possible tokens,
construction of perfect hash function is not possible.
For the non-surjectivity of the mapping, I believe it is not a problem.
Currently there are implementations of DJB and SDBM algorithms. The type of algorithm
to be used must be declared on creating of the object of this class.
Field Summary | |
---|---|
static int |
DEFAULT
Constant for default hash algorith. |
static int |
DJB
Constant for DJB hash algorith. |
static int |
SDBM
Constant for SDBM hash algorith. |
Constructor Summary | |
---|---|
Hasher(int type)
Constructor sets the type of hash function to be used. |
Method Summary | |
---|---|
int |
getType()
|
long |
getUID(java.lang.String str)
Get the UID for given String value. |
Methods inherited from class java.lang.Object |
---|
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait |
Field Detail |
---|
public static final int DJB
public static final int SDBM
public static final int DEFAULT
Constructor Detail |
---|
public Hasher(int type)
type
- constant of the class HasherMethod Detail |
---|
public int getType()
public long getUID(java.lang.String str)
getUID
in interface UIDProducer
str
-
|
||||||||||
PREV CLASS NEXT CLASS | FRAMES NO FRAMES | |||||||||
SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD |