Package it.unimi.dsi.sux4j.util
Class SignedFunctionStringMap
- java.lang.Object
-
- it.unimi.dsi.fastutil.objects.AbstractObject2LongFunction<java.lang.CharSequence>
-
- it.unimi.dsi.sux4j.util.SignedFunctionStringMap
-
- All Implemented Interfaces:
it.unimi.dsi.big.util.StringMap<java.lang.CharSequence>
,it.unimi.dsi.fastutil.Function<java.lang.CharSequence,java.lang.Long>
,it.unimi.dsi.fastutil.objects.Object2LongFunction<java.lang.CharSequence>
,it.unimi.dsi.fastutil.Size64
,java.io.Serializable
,java.util.function.Function<java.lang.CharSequence,java.lang.Long>
,java.util.function.ToLongFunction<java.lang.CharSequence>
public class SignedFunctionStringMap extends it.unimi.dsi.fastutil.objects.AbstractObject2LongFunction<java.lang.CharSequence> implements it.unimi.dsi.big.util.StringMap<java.lang.CharSequence>, java.io.Serializable
A string map based on a signed function.This class is a very thin wrapper around a signed function on character sequences. Starting with version 3.1, most succinct function implementations can be signed directly, without the help of a wrapper class. The new signature system is much faster and uses a higher-quality hash.
Nonetheless, since all functions in Sux4J are generic (they can map any object) we need a thin adapter (this class) that exposes a generic function as a string map (e.g., for usage in MG4J).
This adapter does not (of course) implement
list()
.- Since:
- 3.1.1
- Author:
- Sebastiano Vigna
- See Also:
- Serialized Form
-
-
Field Summary
Fields Modifier and Type Field Description protected it.unimi.dsi.fastutil.objects.Object2LongFunction<? extends java.lang.CharSequence>
function
The underlying function.
-
Constructor Summary
Constructors Constructor Description SignedFunctionStringMap(it.unimi.dsi.fastutil.objects.Object2LongFunction<? extends java.lang.CharSequence> function)
Creates a new string map by wrapping a specified signed function.SignedFunctionStringMap(java.lang.Iterable<? extends java.lang.CharSequence> keys)
Creates a new string map by creating and wrapping aZFastTrieDistributorMonotoneMinimalPerfectHashFunction
.
-
Method Summary
All Methods Static Methods Instance Methods Concrete Methods Deprecated Methods Modifier and Type Method Description boolean
containsKey(java.lang.Object o)
java.lang.Long
get(java.lang.Object o)
Deprecated.long
getLong(java.lang.Object o)
it.unimi.dsi.fastutil.objects.ObjectBigList<java.lang.CharSequence>
list()
static void
main(java.lang.String[] arg)
int
size()
Deprecated.long
size64()
java.lang.String
toString()
-
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, 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
-
-
-
-
Constructor Detail
-
SignedFunctionStringMap
public SignedFunctionStringMap(it.unimi.dsi.fastutil.objects.Object2LongFunction<? extends java.lang.CharSequence> function)
Creates a new string map by wrapping a specified signed function.- Parameters:
function
- a signed function.
-
SignedFunctionStringMap
public SignedFunctionStringMap(java.lang.Iterable<? extends java.lang.CharSequence> keys) throws java.io.IOException
Creates a new string map by creating and wrapping aZFastTrieDistributorMonotoneMinimalPerfectHashFunction
.- Parameters:
keys
- the keys used to populate the string map.- Throws:
java.io.IOException
-
-
Method Detail
-
getLong
public long getLong(java.lang.Object o)
- Specified by:
getLong
in interfaceit.unimi.dsi.fastutil.objects.Object2LongFunction<java.lang.CharSequence>
-
get
@Deprecated public java.lang.Long get(java.lang.Object o)
Deprecated.- Specified by:
get
in interfaceit.unimi.dsi.fastutil.Function<java.lang.CharSequence,java.lang.Long>
- Specified by:
get
in interfaceit.unimi.dsi.fastutil.objects.Object2LongFunction<java.lang.CharSequence>
-
containsKey
public boolean containsKey(java.lang.Object o)
- Specified by:
containsKey
in interfaceit.unimi.dsi.fastutil.Function<java.lang.CharSequence,java.lang.Long>
-
size
@Deprecated public int size()
Deprecated.- Specified by:
size
in interfaceit.unimi.dsi.fastutil.Function<java.lang.CharSequence,java.lang.Long>
- Specified by:
size
in interfaceit.unimi.dsi.fastutil.Size64
- Specified by:
size
in interfaceit.unimi.dsi.big.util.StringMap<java.lang.CharSequence>
-
size64
public long size64()
- Specified by:
size64
in interfaceit.unimi.dsi.fastutil.Size64
- Specified by:
size64
in interfaceit.unimi.dsi.big.util.StringMap<java.lang.CharSequence>
-
list
public it.unimi.dsi.fastutil.objects.ObjectBigList<java.lang.CharSequence> list()
- Specified by:
list
in interfaceit.unimi.dsi.big.util.StringMap<java.lang.CharSequence>
-
toString
public java.lang.String toString()
- Overrides:
toString
in classjava.lang.Object
-
main
public static void main(java.lang.String[] arg) throws java.io.IOException, com.martiansoftware.jsap.JSAPException, java.lang.ClassNotFoundException
- Throws:
java.io.IOException
com.martiansoftware.jsap.JSAPException
java.lang.ClassNotFoundException
-
-