Class LongBigListSignedStringMap
- java.lang.Object
-
- it.unimi.dsi.fastutil.objects.AbstractObject2LongFunction<java.lang.CharSequence>
-
- it.unimi.dsi.big.util.LongBigListSignedStringMap
-
- All Implemented Interfaces:
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>
@Deprecated public class LongBigListSignedStringMap extends it.unimi.dsi.fastutil.objects.AbstractObject2LongFunction<java.lang.CharSequence> implements StringMap<java.lang.CharSequence>, java.io.Serializable
Deprecated.There are much better and faster hash functions.A string map based on a function signed using a big list of longs.The purpose of this map is identical to that of a
ShiftAddXorSignedStringMap
, but Shift-Add-Xor signatures are 64-bit and stored in aLongBigList
. This approach makes it possible to store the signatures in a file and read them by memory mapping using aLongMappedBigList
. If the map has a very large number of keys but the access pattern is strongly skewed towards a relatively small number of entries, using memory mapping might be advantageous.The intended usage pattern is as follows:
- first, you generate a file of signatures
(note that for this phase it might be necessary to keep the signatures in main memory; see
sign(Iterator, String)
for some elaboration); - then, when you want to use the signed map you map the file using
LongMappedBigList.map(java.nio.channels.FileChannel)
and create on the fly a signed map.
To simplify the process, there is a constructor that will do the mapping for you.
- Since:
- 2.0.13
- 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
Deprecated.The underlying map.protected it.unimi.dsi.fastutil.longs.LongBigList
signatures
Deprecated.Signatures.
-
Constructor Summary
Constructors Constructor Description LongBigListSignedStringMap(it.unimi.dsi.fastutil.objects.Object2LongFunction<? extends java.lang.CharSequence> function, it.unimi.dsi.fastutil.longs.LongBigList signatures)
Deprecated.Creates a signed string map using a given hash map and a big list of 64-bit signatures.LongBigListSignedStringMap(it.unimi.dsi.fastutil.objects.Object2LongFunction<? extends java.lang.CharSequence> function, java.lang.String signatures)
Deprecated.Creates a signed string map using a given hash map and a big list of 64-bit signatures.
-
Method Summary
All Methods Static Methods Instance Methods Concrete Methods Deprecated Methods Modifier and Type Method Description boolean
containsKey(java.lang.Object o)
Deprecated.java.lang.Long
get(java.lang.Object o)
Deprecated.long
getLong(java.lang.Object o)
Deprecated.it.unimi.dsi.fastutil.objects.ObjectBigList<java.lang.CharSequence>
list()
Deprecated.Returns a list view of the domain of this string map (optional operation).static void
main(java.lang.String[] arg)
Deprecated.static long[][]
sign(java.util.Iterator<? extends java.lang.CharSequence> iterator, it.unimi.dsi.fastutil.objects.Object2LongFunction<? extends java.lang.CharSequence> function)
Deprecated.Generates a 64-bit signatures big array using a given function and string sequence.static long[][]
sign(java.util.Iterator<? extends java.lang.CharSequence> iterator, it.unimi.dsi.fastutil.objects.Object2LongFunction<? extends java.lang.CharSequence> function, ProgressLogger pl)
Deprecated.Generates a 64-bit signatures big array using a given function and string sequence.static void
sign(java.util.Iterator<? extends java.lang.CharSequence> iterator, java.io.DataOutput signatures, ProgressLogger pl)
Deprecated.Generates an on-disk list 64-bit signatures big array using a given string sequence.static void
sign(java.util.Iterator<? extends java.lang.CharSequence> iterator, java.lang.String signatureFile)
Deprecated.Generates an on-disk list 64-bit signatures big array using a given string sequence.static void
sign(java.util.Iterator<? extends java.lang.CharSequence> iterator, java.lang.String signatureFile, ProgressLogger pl)
Deprecated.Generates an on-disk list 64-bit signatures big array using a given string sequence.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
-
-
-
-
Constructor Detail
-
LongBigListSignedStringMap
public LongBigListSignedStringMap(it.unimi.dsi.fastutil.objects.Object2LongFunction<? extends java.lang.CharSequence> function, it.unimi.dsi.fastutil.longs.LongBigList signatures)
Deprecated.Creates a signed string map using a given hash map and a big list of 64-bit signatures.- Parameters:
function
- a minimal perfect hash for the strings enumerated byiterator
; it must supportsize()
. and have default return value -1.signatures
- a big list of 64-bit signatures generated bysign(Iterator, Object2LongFunction, ProgressLogger)
.
-
LongBigListSignedStringMap
public LongBigListSignedStringMap(it.unimi.dsi.fastutil.objects.Object2LongFunction<? extends java.lang.CharSequence> function, java.lang.String signatures) throws java.io.FileNotFoundException, java.io.IOException
Deprecated.Creates a signed string map using a given hash map and a big list of 64-bit signatures.- Parameters:
function
- a minimal perfect hash for the strings enumerated byiterator
; it must supportsize()
. and have default return value -1.signatures
- a file containing a list of 64-bit signatures generated bysign(Iterator, Object2LongFunction, ProgressLogger)
and stored inDataOutput
format.- Throws:
java.io.FileNotFoundException
java.io.IOException
-
-
Method Detail
-
sign
public static long[][] sign(java.util.Iterator<? extends java.lang.CharSequence> iterator, it.unimi.dsi.fastutil.objects.Object2LongFunction<? extends java.lang.CharSequence> function)
Deprecated.Generates a 64-bit signatures big array using a given function and string sequence.The resulting big array can be saved using
BinIO.storeLongs(long[][], CharSequence)
or similarBinIO
methods.- Parameters:
iterator
- an iterator over a list of strings.function
- the function to be signed.- Returns:
- a big array of 64-bit signatures.
-
sign
public static long[][] sign(java.util.Iterator<? extends java.lang.CharSequence> iterator, it.unimi.dsi.fastutil.objects.Object2LongFunction<? extends java.lang.CharSequence> function, ProgressLogger pl)
Deprecated.Generates a 64-bit signatures big array using a given function and string sequence.The resulting big array can be saved using
BinIO.storeLongs(long[][], CharSequence)
or similarBinIO
methods.- Parameters:
iterator
- an iterator over a list of strings.function
- the function to be signed.pl
- a progress logger, ornull
.- Returns:
- a big array of 64-bit signatures.
-
sign
public static void sign(java.util.Iterator<? extends java.lang.CharSequence> iterator, java.lang.String signatureFile) throws java.io.IOException
Deprecated.Generates an on-disk list 64-bit signatures big array using a given string sequence.This methods generates on-disk signatures in the same order of the strings returned by the provided iterator. Thus, the signature file can be only used with a function that maps each string returned by the iterator in its ordinal position. This happens, for instance, if you have a sorted set of string and you use a monotone minimal perfect hash function.
- Parameters:
iterator
- an iterator over a list of strings.signatureFile
- the file name of the resulting signature file.- Throws:
java.io.IOException
-
sign
public static void sign(java.util.Iterator<? extends java.lang.CharSequence> iterator, java.lang.String signatureFile, ProgressLogger pl) throws java.io.IOException
Deprecated.Generates an on-disk list 64-bit signatures big array using a given string sequence.- Parameters:
iterator
- an iterator over a list of strings.signatureFile
- the file name of the resulting signature file.pl
- a progress logger, ornull
.- Throws:
java.io.IOException
- See Also:
sign(Iterator, DataOutput, ProgressLogger)
-
sign
public static void sign(java.util.Iterator<? extends java.lang.CharSequence> iterator, java.io.DataOutput signatures, ProgressLogger pl) throws java.io.IOException
Deprecated.Generates an on-disk list 64-bit signatures big array using a given string sequence.This methods generates on-disk signatures in the same order of the strings returned by the provided iterator. Thus, the generated signatures can be only used with a function that maps each string returned by the iterator in its ordinal position. This happens, for instance, if you have a sorted set of string and you use a monotone minimal perfect hash function.
- Parameters:
iterator
- an iterator over a list of strings.signatures
- aDataOutput
where the signatures will be written.pl
- a progress logger, ornull
.- Throws:
java.io.IOException
-
getLong
public long getLong(java.lang.Object o)
Deprecated.- Specified by:
getLong
in interfaceit.unimi.dsi.fastutil.objects.Object2LongFunction<java.lang.CharSequence>
-
get
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)
Deprecated.- Specified by:
containsKey
in interfaceit.unimi.dsi.fastutil.Function<java.lang.CharSequence,java.lang.Long>
-
size
@Deprecated public int size()
Deprecated.Description copied from interface:StringMap
-
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.
-
list
public it.unimi.dsi.fastutil.objects.ObjectBigList<java.lang.CharSequence> 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.
-
main
public static void main(java.lang.String[] arg) throws java.lang.NoSuchMethodException, java.io.IOException, com.martiansoftware.jsap.JSAPException, java.lang.ClassNotFoundException
Deprecated.- Throws:
java.lang.NoSuchMethodException
java.io.IOException
com.martiansoftware.jsap.JSAPException
java.lang.ClassNotFoundException
-
-