public class TwoStepsLcpMonotoneMinimalPerfectHashFunction<T> extends AbstractHashFunction<T> implements Size64, Serializable
TwoStepsGOV3Function.
This implementation should use a few less bits per elements than LcpMonotoneMinimalPerfectHashFunction,
but it is a bit slower as one or two additional functions must be queried.
See the package overview for a comparison with other implementations.
Similarly to a GOV3Function, an instance of this class may be signed.
| Modifier and Type | Class and Description |
|---|---|
static class |
TwoStepsLcpMonotoneMinimalPerfectHashFunction.Builder<T>
A builder class for
TwoStepsLcpMonotoneMinimalPerfectHashFunction. |
| Modifier and Type | Field and Description |
|---|---|
protected int |
bucketSize
The size of a bucket.
|
protected int |
bucketSizeMask
The mask for
log2BucketSize bits. |
protected GOV3Function<BitVector> |
lcp2Bucket
A function mapping each longest common prefix to its bucket.
|
protected TwoStepsGOV3Function<BitVector> |
lcpLengths
A function mapping each element to the length of the longest common prefix of its bucket.
|
protected int |
log2BucketSize
|
protected long |
n
The number of elements.
|
protected GOV3Function<BitVector> |
offsets
A function mapping each element to the offset inside its bucket.
|
protected long |
seed
The seed returned by the
ChunkedHashStore. |
static long |
serialVersionUID |
protected long |
signatureMask
The mask to compare signatures, or zero for no signatures.
|
protected LongBigList |
signatures
The signatures.
|
protected TransformationStrategy<? super T> |
transform
The transformation strategy.
|
defRetValue| Modifier | Constructor and Description |
|---|---|
protected |
TwoStepsLcpMonotoneMinimalPerfectHashFunction(Iterable<? extends T> keys,
long numKeys,
TransformationStrategy<? super T> transform,
int signatureWidth,
File tempDir)
Creates a new two-steps LCP monotone minimal perfect hash function for the given keys.
|
| Modifier and Type | Method and Description |
|---|---|
long |
getLong(Object o) |
long |
getLongByBitVectorAndTriple(BitVector bitVector,
long[] triple) |
static void |
main(String[] arg) |
long |
numBits()
Returns the number of bits used by this structure.
|
long |
size64() |
containsKey, sizeclear, defaultReturnValue, defaultReturnValue, get, put, put, remove, removeLongpublic static final long serialVersionUID
protected final long n
protected final int bucketSize
protected final int log2BucketSize
protected final int bucketSizeMask
log2BucketSize bits.protected final GOV3Function<BitVector> offsets
protected final TwoStepsGOV3Function<BitVector> lcpLengths
protected final GOV3Function<BitVector> lcp2Bucket
protected final TransformationStrategy<? super T> transform
protected final long seed
ChunkedHashStore.protected final long signatureMask
protected final LongBigList signatures
protected TwoStepsLcpMonotoneMinimalPerfectHashFunction(Iterable<? extends T> keys, long numKeys, TransformationStrategy<? super T> transform, int signatureWidth, File tempDir) throws IOException
keys - the keys to hash.numKeys - the number of keys, or -1 if the number of keys is not known (will be computed).transform - a transformation strategy for the keys.signatureWidth - a signature width, or 0 for no signature.tempDir - a temporary directory for the store files, or null for the standard temporary directory.IOExceptionpublic long size64()
size64 in interface Size64size64 in class AbstractHashFunction<T>public long numBits()
public long getLong(Object o)
getLong in interface Object2LongFunction<T>public long getLongByBitVectorAndTriple(BitVector bitVector, long[] triple)
public static void main(String[] arg) throws NoSuchMethodException, IOException, JSAPException