|
|||||||||
PREV CLASS NEXT CLASS | FRAMES NO FRAMES | ||||||||
SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD |
java.lang.Objectit.unimi.dsi.fastutil.objects.AbstractObject2LongFunction<CharSequence>
it.unimi.dsi.big.util.LiterallySignedStringMap
public class LiterallySignedStringMap
A string map based on a function signed using the original list of strings.
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. We can check that
a string is part of the key set by hashing it to a value h, and checking that the h-th
string of the original list does coincide. Since, moreover, this class implements StringMap
,
and thus exposes the original list, we have a two-way
dictionary. In other words, this is a full StringMap
implementation.
Note that some care must be exercised: CharSequence
's contract does not
prescribe equality by content, so if your function behaves badly on some implementations of
CharSequence
you might make the checks fail. To avoid difficulties, the
constructor checks that every string in the list is hashed correctly.
For the same reason, this class implements StringMap<MutableString>
, and
requires that the list of strings provided at construction time is actually a list of
mutable strings.
Field Summary | |
---|---|
protected Object2LongFunction<? extends CharSequence> |
function
The underlying map. |
protected ObjectBigList<? extends MutableString> |
list
The underlying list. |
protected long |
size
The size of list . |
Fields inherited from class it.unimi.dsi.fastutil.objects.AbstractObject2LongFunction |
---|
defRetValue |
Constructor Summary | |
---|---|
LiterallySignedStringMap(Object2LongFunction<? extends CharSequence> function,
ObjectBigList<? extends MutableString> list)
Creates a new shift-add-xor signed string map using a given hash map. |
Method Summary | |
---|---|
boolean |
containsKey(Object o)
|
Long |
get(Object o)
|
long |
getLong(Object o)
|
ObjectBigList<? extends MutableString> |
list()
Returns a list view of the domain of this string map (optional operation). |
static void |
main(String[] arg)
|
int |
size()
|
long |
size64()
|
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 CharSequence> function
protected final ObjectBigList<? extends MutableString> list
protected final long size
list
.
Constructor Detail |
---|
public LiterallySignedStringMap(Object2LongFunction<? extends CharSequence> function, ObjectBigList<? extends MutableString> list)
function
- a function mapping each string in list
to its ordinal position.list
- a list of strings.Method Detail |
---|
public long getLong(Object o)
getLong
in interface Object2LongFunction<CharSequence>
public Long get(Object o)
get
in interface Function<CharSequence,Long>
get
in class AbstractObject2LongFunction<CharSequence>
public int size()
size
in interface Function<CharSequence,Long>
size
in interface Size64
public long size64()
size64
in interface Size64
public boolean containsKey(Object o)
containsKey
in interface Function<CharSequence,Long>
public ObjectBigList<? extends MutableString> list()
StringMap
Note that the list view acts as an inverse of the mapping implemented by this map.
list
in interface StringMap<MutableString>
null
if this map does
not support this operation.public static void main(String[] arg) throws IOException, JSAPException, ClassNotFoundException, SecurityException, NoSuchMethodException
IOException
JSAPException
ClassNotFoundException
SecurityException
NoSuchMethodException
|
|||||||||
PREV CLASS NEXT CLASS | FRAMES NO FRAMES | ||||||||
SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD |