Class LongBigListSignedStringMap

java.lang.Object
it.unimi.dsi.fastutil.objects.AbstractObject2LongFunction<CharSequence>
it.unimi.dsi.big.util.LongBigListSignedStringMap
All Implemented Interfaces:
StringMap<CharSequence>, it.unimi.dsi.fastutil.Function<CharSequence,Long>, it.unimi.dsi.fastutil.objects.Object2LongFunction<CharSequence>, it.unimi.dsi.fastutil.Size64, Serializable, Function<CharSequence,Long>, ToLongFunction<CharSequence>

@Deprecated public class LongBigListSignedStringMap extends it.unimi.dsi.fastutil.objects.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 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:

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

    Fields
    Modifier and Type
    Field
    Description
    protected final it.unimi.dsi.fastutil.objects.Object2LongFunction<? extends CharSequence>
    Deprecated.
    The underlying map.
    protected final it.unimi.dsi.fastutil.longs.LongBigList
    Deprecated.
    Signatures.

    Fields inherited from class it.unimi.dsi.fastutil.objects.AbstractObject2LongFunction

    defRetValue
  • Constructor Summary

    Constructors
    Constructor
    Description
    LongBigListSignedStringMap(it.unimi.dsi.fastutil.objects.Object2LongFunction<? extends 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 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
    boolean
    Deprecated.
     
    Deprecated.
     
    long
    Deprecated.
     
    it.unimi.dsi.fastutil.objects.ObjectBigList<CharSequence>
    Deprecated.
    Returns a list view of the domain of this string map (optional operation).
    static void
    main(String[] arg)
    Deprecated.
     
    static long[][]
    sign(Iterator<? extends CharSequence> iterator, it.unimi.dsi.fastutil.objects.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, it.unimi.dsi.fastutil.objects.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
    Deprecated.
    long
    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.Function

    apply, clear

    Methods inherited from interface java.util.function.Function

    compose

    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

      protected final it.unimi.dsi.fastutil.objects.Object2LongFunction<? extends CharSequence> function
      Deprecated.
      The underlying map.
    • signatures

      protected final it.unimi.dsi.fastutil.longs.LongBigList signatures
      Deprecated.
      Signatures.
  • Constructor Details

    • LongBigListSignedStringMap

      public LongBigListSignedStringMap(it.unimi.dsi.fastutil.objects.Object2LongFunction<? extends 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 by iterator; it must support size(). and have default return value -1.
      signatures - a big list of 64-bit signatures generated by sign(Iterator, Object2LongFunction, ProgressLogger).
    • LongBigListSignedStringMap

      public LongBigListSignedStringMap(it.unimi.dsi.fastutil.objects.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 by iterator; it must support size(). and have default return value -1.
      signatures - a file containing a list of 64-bit signatures generated by sign(Iterator, Object2LongFunction, ProgressLogger) and stored in DataOutput format.
      Throws:
      FileNotFoundException
      IOException
  • Method Details

    • sign

      public static long[][] sign(Iterator<? extends CharSequence> iterator, it.unimi.dsi.fastutil.objects.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 similar BinIO 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, it.unimi.dsi.fastutil.objects.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 similar BinIO methods.

      Parameters:
      iterator - an iterator over a list of strings.
      function - the function to be signed.
      pl - a progress logger, or null.
      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, or null.
      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 - a DataOutput where the signatures will be written.
      pl - a progress logger, or null.
      Throws:
      IOException
    • getLong

      public long getLong(Object o)
      Deprecated.
      Specified by:
      getLong in interface it.unimi.dsi.fastutil.objects.Object2LongFunction<CharSequence>
    • get

      public Long get(Object o)
      Deprecated.
      Specified by:
      get in interface it.unimi.dsi.fastutil.Function<CharSequence,Long>
      Specified by:
      get in interface it.unimi.dsi.fastutil.objects.Object2LongFunction<CharSequence>
    • containsKey

      public boolean containsKey(Object o)
      Deprecated.
      Specified by:
      containsKey in interface it.unimi.dsi.fastutil.Function<CharSequence,Long>
    • size

      @Deprecated public int size()
      Deprecated.
      Description copied from interface: StringMap
      Specified by:
      size in interface it.unimi.dsi.fastutil.Function<CharSequence,Long>
      Specified by:
      size in interface it.unimi.dsi.fastutil.Size64
      Specified by:
      size in interface StringMap<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 interface it.unimi.dsi.fastutil.Size64
      Specified by:
      size64 in interface StringMap<CharSequence>
      Returns:
      the intended number of keys in this function, or -1 if that number is not available.
    • list

      public it.unimi.dsi.fastutil.objects.ObjectBigList<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.

      Specified by:
      list in interface StringMap<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, com.martiansoftware.jsap.JSAPException, ClassNotFoundException
      Deprecated.
      Throws:
      NoSuchMethodException
      IOException
      com.martiansoftware.jsap.JSAPException
      ClassNotFoundException