public class TwoStepsMWHCFunction<T> extends AbstractHashFunction<T> implements Serializable, Size64
TwoStepsLcpMonotoneMinimalPerfectHashFunction).
The constructor of this class performs a pre-scan of the values to be assigned. If possible, it finds the best possible
r such that the 2r − 1 most frequent values can be stored in a MWHCFunction
and suitably remapped when read. The function uses 2r − 1 as an escape symbol for all other
values, which are stored in a separate function.
| Modifier and Type | Field and Description |
|---|---|
protected int |
escape
The escape value returned by
firstFunction to suggest that secondFunction should be queried instead, provided that there is a first function. |
protected MWHCFunction<T> |
firstFunction
The first function, or
null. |
protected long |
n
The number of elements.
|
double |
rankMean
The mean of the rank distribution.
|
protected long[] |
remap
A mapping from values of the first function to actual values, provided that there is a first function.
|
protected MWHCFunction<T> |
secondFunction
The second function.
|
static long |
serialVersionUID |
protected TransformationStrategy<? super T> |
transform
The transformation strategy to turn objects of type
T into bit vectors. |
int |
width
The width of the output of this function, in bits.
|
defRetValue| Modifier | Constructor and Description |
|---|---|
|
TwoStepsMWHCFunction(Iterable<? extends T> elements,
TransformationStrategy<? super T> transform,
LongBigList values)
Creates a new two-step function for the given elements and values.
|
|
TwoStepsMWHCFunction(Iterable<? extends T> elements,
TransformationStrategy<? super T> transform,
LongBigList values,
ChunkedHashStore<T> chunkedHashStore)
Creates a new two-step function for the given elements and values.
|
protected |
TwoStepsMWHCFunction(TwoStepsMWHCFunction<T> function)
Creates a new function by copying a given one; non-transient fields are (shallow) copied.
|
| Modifier and Type | Method and Description |
|---|---|
long |
getLong(Object o) |
long |
getLongByTriple(long[] triple) |
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 TransformationStrategy<? super T> transform
T into bit vectors.protected final MWHCFunction<T> firstFunction
null. The special output value escape denotes that secondFunction
should be queried instead.protected final MWHCFunction<T> secondFunction
firstFunction returns
escape (or simply all queries, if firstFunction is null) will be rerouted here.protected final long[] remap
protected final int escape
firstFunction to suggest that secondFunction should be queried instead, provided that there is a first function.public final double rankMean
public final int width
public TwoStepsMWHCFunction(Iterable<? extends T> elements, TransformationStrategy<? super T> transform, LongBigList values) throws IOException
elements - the elements in the domain of the function.transform - a transformation strategy for the elements.values - values to be assigned to each element, in the same order of the iterator returned by elements; if null, the
assigned value will the the ordinal number of each element.IOExceptionpublic TwoStepsMWHCFunction(Iterable<? extends T> elements, TransformationStrategy<? super T> transform, LongBigList values, ChunkedHashStore<T> chunkedHashStore) throws IOException
elements - the elements in the domain of the function.transform - a transformation strategy for the elements.values - values to be assigned to each element, in the same order of the iterator returned by elements; if null, the
assigned value will the the ordinal number of each element.IOExceptionprotected TwoStepsMWHCFunction(TwoStepsMWHCFunction<T> function)
function - the function to be copied.public long getLong(Object o)
getLong in interface Object2LongFunction<T>public long getLongByTriple(long[] triple)
public long size64()
size64 in interface Size64size64 in class AbstractHashFunction<T>public long numBits()