Class 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 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:
    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.
      • Fields inherited from class it.unimi.dsi.fastutil.objects.AbstractObject2LongFunction

        defRetValue
    • 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.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 Detail

      • function

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

        protected final it.unimi.dsi.fastutil.longs.LongBigList signatures
        Deprecated.
        Signatures.
    • 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 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 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 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:
        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 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​(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 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​(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, or null.
        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 - a DataOutput where the signatures will be written.
        pl - a progress logger, or null.
        Throws:
        java.io.IOException
      • getLong

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

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

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

        @Deprecated
        public int size()
        Deprecated.
        Description copied from interface: StringMap
        Specified by:
        size in interface it.unimi.dsi.fastutil.Function<java.lang.CharSequence,​java.lang.Long>
        Specified by:
        size in interface it.unimi.dsi.fastutil.Size64
        Specified by:
        size in interface StringMap<java.lang.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<java.lang.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<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.

        Specified by:
        list in interface StringMap<java.lang.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​(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