public class ShiftAddXorSignedStringMap extends it.unimi.dsi.fastutil.objects.AbstractObject2LongFunction<CharSequence> implements StringMap<CharSequence>, Serializable
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.
Modifier and Type | Field and Description |
---|---|
protected it.unimi.dsi.fastutil.objects.Object2LongFunction<? extends 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.
|
Constructor and Description |
---|
ShiftAddXorSignedStringMap(Iterator<? extends CharSequence> iterator,
it.unimi.dsi.fastutil.objects.Object2LongFunction<? extends CharSequence> map)
Creates a new shift-add-xor signed string map using a given hash map and 32-bit signatures.
|
ShiftAddXorSignedStringMap(Iterator<? extends CharSequence> iterator,
it.unimi.dsi.fastutil.objects.Object2LongFunction<? extends CharSequence> map,
int signatureWidth)
Creates a new shift-add-xor signed string map using a given hash map.
|
Modifier and Type | Method and Description |
---|---|
boolean |
containsKey(Object o) |
Long |
get(Object o) |
long |
getLong(Object o) |
it.unimi.dsi.fastutil.objects.ObjectList<CharSequence> |
list()
Returns a list view of the domain of this string map (optional operation).
|
static void |
main(String[] arg) |
int |
size() |
clear, defaultReturnValue, defaultReturnValue, put, put, remove, removeLong
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
protected final it.unimi.dsi.fastutil.objects.Object2LongFunction<? extends CharSequence> function
protected final LongBigList signatures
protected final int width
protected final int shift
width
nonzero bits.protected final long mask
width
nonzero bits.public ShiftAddXorSignedStringMap(Iterator<? extends CharSequence> iterator, it.unimi.dsi.fastutil.objects.Object2LongFunction<? extends 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(Iterator<? extends CharSequence> iterator, it.unimi.dsi.fastutil.objects.Object2LongFunction<? extends 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.public long getLong(Object o)
getLong
in interface it.unimi.dsi.fastutil.objects.Object2LongFunction<CharSequence>
public Long get(Object o)
get
in interface it.unimi.dsi.fastutil.Function<CharSequence,Long>
get
in class it.unimi.dsi.fastutil.objects.AbstractObject2LongFunction<CharSequence>
public boolean containsKey(Object o)
containsKey
in interface it.unimi.dsi.fastutil.Function<CharSequence,Long>
public int size()
size
in interface it.unimi.dsi.fastutil.Function<CharSequence,Long>
public it.unimi.dsi.fastutil.objects.ObjectList<CharSequence> list()
StringMap
Note that the list view acts as an inverse of the mapping implemented by this map.
list
in interface StringMap<CharSequence>
null
if this map does
not support this operation.public static void main(String[] arg) throws NoSuchMethodException, IOException, com.martiansoftware.jsap.JSAPException, ClassNotFoundException
NoSuchMethodException
IOException
com.martiansoftware.jsap.JSAPException
ClassNotFoundException
Copyright © 2006–2019 SYSTAP, LLC DBA Blazegraph. All rights reserved.