Class ShiftAddXorSignedStringMap
- All Implemented Interfaces:
StringMap<CharSequence>
,Function<CharSequence,
,Long> Object2LongFunction<CharSequence>
,Size64
,Serializable
,Function<CharSequence,
,Long> ToLongFunction<CharSequence>
A minimal perfect hash function maps a set of string to an initial segment of the natural
numbers, but will actually map any string to that segment. By signing
each output value with a hash of the string, we get a dictionary-like functionality with a rate
error that can be balanced with space occupancy (signatures can go from 1 to Long.SIZE
bits).
For the kind of hash we use, see “Performance in practice of string hashing functions”, by M.V. Ramakrishna and Justin Zobel, Proc. of the Fifth International Conference on Database Systems for Advanced Applications, 1997, pages 215−223.
- Since:
- 2.0
- Author:
- Sebastiano Vigna
- See Also:
-
Field Summary
Modifier and TypeFieldDescriptionprotected final Object2LongFunction<? extends CharSequence>
Deprecated.The underlying map.protected final long
Deprecated.The mask to get onlywidth
nonzero bits.protected final int
Deprecated.The left shift to get onlywidth
nonzero bits.protected final LongBigList
Deprecated.Signatures.protected final int
Deprecated.The width in bits of each signature.Fields inherited from class it.unimi.dsi.fastutil.objects.AbstractObject2LongFunction
defRetValue
-
Constructor Summary
ConstructorDescriptionShiftAddXorSignedStringMap
(Iterator<? extends CharSequence> iterator, Object2LongFunction<? extends CharSequence> map) Deprecated.Creates a new shift-add-xor signed string map using a given hash map and 32-bit signatures.ShiftAddXorSignedStringMap
(Iterator<? extends CharSequence> iterator, Object2LongFunction<? extends CharSequence> map, int signatureWidth) Deprecated.Creates a new shift-add-xor signed string map using a given hash map. -
Method Summary
Modifier and TypeMethodDescriptionboolean
Deprecated.Deprecated.long
Deprecated.list()
Deprecated.Returns a list view of the domain of this string map (optional operation).static void
Deprecated.int
size()
Deprecated.long
size64()
Deprecated.Returns the intended number of keys in this function, or -1 if no such number exists.Methods inherited from class it.unimi.dsi.fastutil.objects.AbstractObject2LongFunction
defaultReturnValue, defaultReturnValue
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
Methods inherited from interface it.unimi.dsi.fastutil.objects.Object2LongFunction
andThen, andThenByte, andThenChar, andThenDouble, andThenFloat, andThenInt, andThenLong, andThenObject, andThenReference, andThenShort, applyAsLong, composeByte, composeChar, composeDouble, composeFloat, composeInt, composeLong, composeObject, composeReference, composeShort, defaultReturnValue, defaultReturnValue, getOrDefault, getOrDefault, put, put, remove, removeLong
-
Field Details
-
function
Deprecated.The underlying map. -
signatures
Deprecated.Signatures. -
width
protected final int widthDeprecated.The width in bits of each signature. -
shift
protected final int shiftDeprecated.The left shift to get onlywidth
nonzero bits. -
mask
protected final long maskDeprecated.The mask to get onlywidth
nonzero bits.
-
-
Constructor Details
-
ShiftAddXorSignedStringMap
public ShiftAddXorSignedStringMap(Iterator<? extends CharSequence> iterator, Object2LongFunction<? extends CharSequence> map) Deprecated.Creates a new shift-add-xor signed string map using a given hash map and 32-bit signatures.- Parameters:
iterator
- an iterator enumerating a set of strings.map
- a minimal perfect hash for the strings enumerated byiterator
; it must supportsize()
and have default return value -1.
-
ShiftAddXorSignedStringMap
public ShiftAddXorSignedStringMap(Iterator<? extends CharSequence> iterator, Object2LongFunction<? extends CharSequence> map, int signatureWidth) Deprecated.Creates a new shift-add-xor signed string map using a given hash map.- Parameters:
iterator
- an iterator enumerating a set of strings.map
- a minimal perfect hash for the strings enumerated byiterator
; it must supportsize()
and have default return value -1.signatureWidth
- the width, in bits, of the signature of each string.
-
-
Method Details
-
getLong
Deprecated.- Specified by:
getLong
in interfaceObject2LongFunction<CharSequence>
-
get
Deprecated.- Specified by:
get
in interfaceFunction<CharSequence,
Long> - Specified by:
get
in interfaceObject2LongFunction<CharSequence>
-
containsKey
Deprecated.- Specified by:
containsKey
in interfaceFunction<CharSequence,
Long>
-
size
Deprecated.Description copied from interface:StringMap
- Specified by:
size
in interfaceFunction<CharSequence,
Long> - Specified by:
size
in interfaceSize64
- Specified by:
size
in interfaceStringMap<CharSequence>
-
size64
public long size64()Deprecated.Description copied from interface:StringMap
Returns the intended number of keys in this function, or -1 if no such number exists.Most function implementations will have some knowledge of the intended number of keys in their domain. In some cases, however, this might not be possible. This default implementation, in particular, returns -1.
- Specified by:
size64
in interfaceSize64
- Specified by:
size64
in interfaceStringMap<CharSequence>
- Returns:
- the intended number of keys in this function, or -1 if that number is not available.
-
list
Deprecated.Description copied from interface:StringMap
Returns a list view of the domain of this string map (optional operation).Note that the list view acts as an inverse of the mapping implemented by this map.
- Specified by:
list
in interfaceStringMap<CharSequence>
- Returns:
- a list view of the domain of this string map, or
null
if this map does not support this operation.
-
main
public static void main(String[] arg) throws NoSuchMethodException, IOException, JSAPException, ClassNotFoundException Deprecated.
-