Class LongBigListSignedStringMap
- All Implemented Interfaces:
StringMap<CharSequence>
,Function<CharSequence,
,Long> Object2LongFunction<CharSequence>
,Size64
,Serializable
,Function<CharSequence,
,Long> ToLongFunction<CharSequence>
The purpose of this map is identical to that of a ShiftAddXorSignedStringMap
, but
Shift-Add-Xor signatures are 64-bit and stored in a LongBigList
. This approach makes it
possible to store the signatures in a file and read them by memory mapping using a
LongMappedBigList
. 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:
-
Field Summary
Modifier and TypeFieldDescriptionprotected final Object2LongFunction<? extends CharSequence>
Deprecated.The underlying map.protected final LongBigList
Deprecated.Signatures.Fields inherited from class it.unimi.dsi.fastutil.objects.AbstractObject2LongFunction
defRetValue
-
Constructor Summary
ConstructorDescriptionLongBigListSignedStringMap
(Object2LongFunction<? extends CharSequence> function, LongBigList signatures) Deprecated.Creates a signed string map using a given hash map and a big list of 64-bit signatures.LongBigListSignedStringMap
(Object2LongFunction<? extends CharSequence> function, String signatures) Deprecated.Creates a signed string map using a given hash map and a big list of 64-bit signatures. -
Method Summary
Modifier and TypeMethodDescriptionboolean
Deprecated.Deprecated.long
Deprecated.list()
Deprecated.Returns a list view of the domain of this string map (optional operation).static void
Deprecated.static long[][]
sign
(Iterator<? extends CharSequence> iterator, Object2LongFunction<? extends CharSequence> function) Deprecated.Generates a 64-bit signatures big array using a given function and string sequence.static long[][]
sign
(Iterator<? extends CharSequence> iterator, Object2LongFunction<? extends CharSequence> function, ProgressLogger pl) Deprecated.Generates a 64-bit signatures big array using a given function and string sequence.static void
sign
(Iterator<? extends CharSequence> iterator, DataOutput signatures, ProgressLogger pl) Deprecated.Generates an on-disk list 64-bit signatures big array using a given string sequence.static void
sign
(Iterator<? extends CharSequence> iterator, String signatureFile) Deprecated.Generates an on-disk list 64-bit signatures big array using a given string sequence.static void
sign
(Iterator<? extends CharSequence> iterator, 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
-
Field Details
-
function
Deprecated.The underlying map. -
signatures
Deprecated.Signatures.
-
-
Constructor Details
-
LongBigListSignedStringMap
public LongBigListSignedStringMap(Object2LongFunction<? extends CharSequence> function, 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(Object2LongFunction<? extends CharSequence> function, String signatures) throws FileNotFoundException, 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:
FileNotFoundException
IOException
-
-
Method Details
-
sign
public static long[][] sign(Iterator<? extends CharSequence> iterator, Object2LongFunction<? extends 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(Iterator<? extends CharSequence> iterator, Object2LongFunction<? extends 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(Iterator<? extends CharSequence> iterator, String signatureFile) throws 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:
IOException
-
sign
public static void sign(Iterator<? extends CharSequence> iterator, String signatureFile, ProgressLogger pl) throws 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:
IOException
- See Also:
-
sign
public static void sign(Iterator<? extends CharSequence> iterator, DataOutput signatures, ProgressLogger pl) throws 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:
IOException
-
getLong
Deprecated.- Specified by:
getLong
in interfaceObject2LongFunction<CharSequence>
-
get
Deprecated.- Specified by:
get
in interfaceFunction<CharSequence,
Long> - Specified by:
get
in interfaceObject2LongFunction<CharSequence>
-
containsKey
Deprecated.- Specified by:
containsKey
in interfaceFunction<CharSequence,
Long>
-
size
Deprecated.Description copied from interface:StringMap
- Specified by:
size
in interfaceFunction<CharSequence,
Long> - Specified by:
size
in interfaceSize64
- Specified by:
size
in interfaceStringMap<CharSequence>
-
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.
- Specified by:
size64
in interfaceSize64
- Specified by:
size64
in interfaceStringMap<CharSequence>
- Returns:
- the intended number of keys in this function, or -1 if that number is not available.
-
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.
- Specified by:
list
in interfaceStringMap<CharSequence>
- Returns:
- a list view of the domain of this string map, or
null
if this map does not support this operation.
-
main
public static void main(String[] arg) throws NoSuchMethodException, IOException, JSAPException, ClassNotFoundException Deprecated.
-