|
|||||||||
| PREV CLASS NEXT CLASS | FRAMES NO FRAMES | ||||||||
| SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD | ||||||||
java.lang.Objectit.unimi.dsi.fastutil.objects.AbstractObject2LongFunction<K>
it.unimi.dsi.sux4j.mph.AbstractHashFunction<T>
it.unimi.dsi.sux4j.mph.TwoStepsMWHCFunction<T>
public class TwoStepsMWHCFunction<T>
A read-only function stored using two Majewski-Wormald-Havas-Czech functions—one for frequent values, and one for infrequent values.
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.
| Field Summary | |
|---|---|
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 int |
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. |
| Fields inherited from class it.unimi.dsi.fastutil.objects.AbstractObject2LongFunction |
|---|
defRetValue |
| Constructor Summary | |
|---|---|
|
TwoStepsMWHCFunction(Iterable<? extends T> elements,
TransformationStrategy<? super T> transform,
LongList values)
Creates a new two-step function for the given elements and values. |
|
TwoStepsMWHCFunction(Iterable<? extends T> elements,
TransformationStrategy<? super T> transform,
LongList 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. |
| Method Summary | |
|---|---|
long |
getLong(Object o)
|
long |
getLongByTriple(long[] triple)
|
long |
numBits()
Returns the number of bits used by this structure. |
int |
size()
Returns the number of elements in the function domain. |
| Methods inherited from class it.unimi.dsi.sux4j.mph.AbstractHashFunction |
|---|
containsKey |
| Methods inherited from class it.unimi.dsi.fastutil.objects.AbstractObject2LongFunction |
|---|
clear, defaultReturnValue, defaultReturnValue, get, put, put, remove, removeLong |
| Methods inherited from class java.lang.Object |
|---|
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait |
| Field Detail |
|---|
public static final long serialVersionUID
protected final int 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
| Constructor Detail |
|---|
public TwoStepsMWHCFunction(Iterable<? extends T> elements,
TransformationStrategy<? super T> transform,
LongList 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.
IOException
public TwoStepsMWHCFunction(Iterable<? extends T> elements,
TransformationStrategy<? super T> transform,
LongList 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.| Method Detail |
|---|
public long getLong(Object o)
getLong in interface Object2LongFunction<T>public long getLongByTriple(long[] triple)
public int size()
size in interface Function<T,Long>size in class AbstractHashFunction<T>public long numBits()
|
|||||||||
| PREV CLASS NEXT CLASS | FRAMES NO FRAMES | ||||||||
| SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD | ||||||||