Class LongBigListSignedStringMap
- java.lang.Object
-
- it.unimi.dsi.fastutil.objects.AbstractObject2LongFunction<CharSequence>
-
- it.unimi.dsi.big.util.LongBigListSignedStringMap
-
- All Implemented Interfaces:
StringMap<CharSequence>,Function<CharSequence,Long>,Object2LongFunction<CharSequence>,Size64,Serializable,Function<CharSequence,Long>,ToLongFunction<CharSequence>
@Deprecated public class LongBigListSignedStringMap extends AbstractObject2LongFunction<CharSequence> implements StringMap<CharSequence>, 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 aByteBufferLongBigList. 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
ByteBufferLongBigList.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 Object2LongFunction<? extends CharSequence>functionDeprecated.The underlying map.protected LongBigListsignaturesDeprecated.Signatures.-
Fields inherited from class it.unimi.dsi.fastutil.objects.AbstractObject2LongFunction
defRetValue
-
-
Constructor Summary
Constructors Constructor Description 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.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 Type Method Description booleancontainsKey(Object o)Deprecated.Longget(Object o)Deprecated.longgetLong(Object o)Deprecated.ObjectBigList<CharSequence>list()Deprecated.Returns a list view of the domain of this string map (optional operation).static voidmain(String[] arg)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 voidsign(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 voidsign(Iterator<? extends CharSequence> iterator, String signatureFile)Deprecated.Generates an on-disk list 64-bit signatures big array using a given string sequence.static voidsign(Iterator<? extends CharSequence> iterator, String signatureFile, ProgressLogger pl)Deprecated.Generates an on-disk list 64-bit signatures big array using a given string sequence.intsize()Deprecated.longsize64()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
applyAsLong, defaultReturnValue, defaultReturnValue, put, put, remove, removeLong
-
-
-
-
Field Detail
-
function
protected final Object2LongFunction<? extends CharSequence> function
Deprecated.The underlying map.
-
signatures
protected final LongBigList signatures
Deprecated.Signatures.
-
-
Constructor Detail
-
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 inDataOutputformat.- Throws:
FileNotFoundExceptionIOException
-
-
Method Detail
-
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 similarBinIOmethods.- 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 similarBinIOmethods.- 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(Iterator, DataOutput, ProgressLogger)
-
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- aDataOutputwhere the signatures will be written.pl- a progress logger, ornull.- Throws:
IOException
-
getLong
public long getLong(Object o)
Deprecated.- Specified by:
getLongin interfaceObject2LongFunction<CharSequence>
-
get
public Long get(Object o)
Deprecated.- Specified by:
getin interfaceFunction<CharSequence,Long>- Specified by:
getin interfaceObject2LongFunction<CharSequence>
-
containsKey
public boolean containsKey(Object o)
Deprecated.- Specified by:
containsKeyin interfaceFunction<CharSequence,Long>
-
size
@Deprecated public int size()
Deprecated.Description copied from interface:StringMap- Specified by:
sizein interfaceFunction<CharSequence,Long>- Specified by:
sizein interfaceSize64- Specified by:
sizein interfaceStringMap<CharSequence>
-
size64
public long size64()
Deprecated.Description copied from interface:StringMapReturns 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:
size64in interfaceSize64- Specified by:
size64in interfaceStringMap<CharSequence>- Returns:
- the intended number of keys in this function, or -1 if that number is not available.
-
list
public ObjectBigList<CharSequence> list()
Deprecated.Description copied from interface:StringMapReturns 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:
listin interfaceStringMap<CharSequence>- Returns:
- a list view of the domain of this string map, or
nullif this map does not support this operation.
-
main
public static void main(String[] arg) throws NoSuchMethodException, IOException, JSAPException, ClassNotFoundException
Deprecated.
-
-