|
|||||||||
PREV CLASS NEXT CLASS | FRAMES NO FRAMES | ||||||||
SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD |
java.lang.Objectit.unimi.dsi.fastutil.objects.AbstractObject2LongFunction<java.lang.CharSequence>
it.unimi.dsi.util.ShiftAddXorSignedStringMap
public class ShiftAddXorSignedStringMap
A string map based on a minimal perfect hash signed using Shift-Add-Xor hashes.
A minimal perfect hash 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 set-like functionality with a rate
error that can be balanced with space occupancy (signatures can go from 1 to Long.SIZE
bits).
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.
Field Summary | |
---|---|
protected Object2LongFunction<? extends java.lang.CharSequence> |
function
The underlying map. |
protected long |
mask
The mask to get only width nonzero bits. |
protected int |
shift
The left shift to get only width nonzero bits. |
protected LongBigList |
signatures
Signatures. |
protected int |
width
The width in bits of each signature. |
Fields inherited from class it.unimi.dsi.fastutil.objects.AbstractObject2LongFunction |
---|
defRetValue |
Constructor Summary | |
---|---|
ShiftAddXorSignedStringMap(java.util.Iterator<? extends java.lang.CharSequence> iterator,
Object2LongFunction<? extends java.lang.CharSequence> map)
Creates a new shift-add-xor signed string map using a given hash map and 32-bit signatures. |
|
ShiftAddXorSignedStringMap(java.util.Iterator<? extends java.lang.CharSequence> iterator,
Object2LongFunction<? extends java.lang.CharSequence> map,
int signatureWidth)
Creates a new shift-add-xor signed string map using a given hash map. |
Method Summary | |
---|---|
boolean |
containsKey(java.lang.Object o)
|
java.lang.Long |
get(java.lang.Object o)
|
long |
getLong(java.lang.Object o)
|
ObjectList<java.lang.CharSequence> |
list()
Returns a list view of the domain of this string map (optional operation). |
static void |
main(java.lang.String[] arg)
|
int |
size()
|
Methods inherited from class it.unimi.dsi.fastutil.objects.AbstractObject2LongFunction |
---|
clear, defaultReturnValue, defaultReturnValue, put, put, remove, removeLong |
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 |
---|
defaultReturnValue, defaultReturnValue, put, removeLong |
Methods inherited from interface it.unimi.dsi.fastutil.Function |
---|
clear, put, remove |
Field Detail |
---|
protected final Object2LongFunction<? extends java.lang.CharSequence> function
protected final LongBigList signatures
protected final int width
protected final int shift
width
nonzero bits.
protected final long mask
width
nonzero bits.
Constructor Detail |
---|
public ShiftAddXorSignedStringMap(java.util.Iterator<? extends java.lang.CharSequence> iterator, Object2LongFunction<? extends java.lang.CharSequence> map)
iterator
- an iterator enumerating a set of strings.map
- a minimal perfect hash for the strings enumerated by iterator
; it must support size()
and have default return value -1.public ShiftAddXorSignedStringMap(java.util.Iterator<? extends java.lang.CharSequence> iterator, Object2LongFunction<? extends java.lang.CharSequence> map, int signatureWidth)
iterator
- an iterator enumerating a set of strings.map
- a minimal perfect hash for the strings enumerated by iterator
; it must support size()
and have default return value -1.signatureWidth
- the width, in bits, of the signature of each string.Method Detail |
---|
public long getLong(java.lang.Object o)
getLong
in interface Object2LongFunction<java.lang.CharSequence>
public java.lang.Long get(java.lang.Object o)
get
in interface Function<java.lang.CharSequence,java.lang.Long>
get
in class AbstractObject2LongFunction<java.lang.CharSequence>
public boolean containsKey(java.lang.Object o)
containsKey
in interface Function<java.lang.CharSequence,java.lang.Long>
public int size()
size
in interface Function<java.lang.CharSequence,java.lang.Long>
public ObjectList<java.lang.CharSequence> list()
StringMap
Note that the list view acts as an inverse of the mapping implemented by this map.
list
in interface StringMap<java.lang.CharSequence>
null
if this map does
not support this operation.public static void main(java.lang.String[] arg) throws java.lang.NoSuchMethodException, java.io.IOException, JSAPException, java.lang.ClassNotFoundException
java.lang.NoSuchMethodException
java.io.IOException
JSAPException
java.lang.ClassNotFoundException
|
|||||||||
PREV CLASS NEXT CLASS | FRAMES NO FRAMES | ||||||||
SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD |