Class ShiftAddXorSignedStringMap

  • All Implemented Interfaces:
    it.unimi.dsi.fastutil.Function<java.lang.CharSequence,​java.lang.Long>, it.unimi.dsi.fastutil.objects.Object2LongFunction<java.lang.CharSequence>, StringMap<java.lang.CharSequence>, java.io.Serializable, java.util.function.Function<java.lang.CharSequence,​java.lang.Long>, java.util.function.ToLongFunction<java.lang.CharSequence>

    @Deprecated
    public class ShiftAddXorSignedStringMap
    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 Shift-Add-Xor hashes.

    A minimal perfect hash function maps a set of string to an initial segment of the natural numbers, but will actually map any string to that segment. By signing each output value with a hash of the string, we get a dictionary-like functionality with a rate error that can be balanced with space occupancy (signatures can go from 1 to Long.SIZE bits).

    For the kind of hash we use, see “Performance in practice of string hashing functions”, by M.V. Ramakrishna and Justin Zobel, Proc. of the Fifth International Conference on Database Systems for Advanced Applications, 1997, pages 215−223.

    Since:
    1.1.2
    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 long mask
      Deprecated.
      The mask to get only width nonzero bits.
      protected int shift
      Deprecated.
      The left shift to get only width nonzero bits.
      protected it.unimi.dsi.fastutil.longs.LongBigList signatures
      Deprecated.
      Signatures.
      protected int width
      Deprecated.
      The width in bits of each signature.
      • Fields inherited from class it.unimi.dsi.fastutil.objects.AbstractObject2LongFunction

        defRetValue
    • Constructor Summary

      Constructors 
      Constructor Description
      ShiftAddXorSignedStringMap​(java.util.Iterator<? extends java.lang.CharSequence> iterator, it.unimi.dsi.fastutil.objects.Object2LongFunction<? extends java.lang.CharSequence> map)
      Deprecated.
      Creates a new shift-add-xor signed string map using a given hash map and 32-bit signatures.
      ShiftAddXorSignedStringMap​(java.util.Iterator<? extends java.lang.CharSequence> iterator, it.unimi.dsi.fastutil.objects.Object2LongFunction<? extends java.lang.CharSequence> map, int signatureWidth)
      Deprecated.
      Creates a new shift-add-xor signed string map using a given hash map.
    • 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.ObjectList<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.
       
      int size()
      Deprecated.
       
      • 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.
      • width

        protected final int width
        Deprecated.
        The width in bits of each signature.
      • shift

        protected final int shift
        Deprecated.
        The left shift to get only width nonzero bits.
      • mask

        protected final long mask
        Deprecated.
        The mask to get only width nonzero bits.
    • Constructor Detail

      • ShiftAddXorSignedStringMap

        public ShiftAddXorSignedStringMap​(java.util.Iterator<? extends java.lang.CharSequence> iterator,
                                          it.unimi.dsi.fastutil.objects.Object2LongFunction<? extends java.lang.CharSequence> map)
        Deprecated.
        Creates a new shift-add-xor signed string map using a given hash map and 32-bit signatures.
        Parameters:
        iterator - an iterator enumerating a set of strings.
        map - a minimal perfect hash for the strings enumerated by iterator; it must support size() and have default return value -1.
      • ShiftAddXorSignedStringMap

        public ShiftAddXorSignedStringMap​(java.util.Iterator<? extends java.lang.CharSequence> iterator,
                                          it.unimi.dsi.fastutil.objects.Object2LongFunction<? extends java.lang.CharSequence> map,
                                          int signatureWidth)
        Deprecated.
        Creates a new shift-add-xor signed string map using a given hash map.
        Parameters:
        iterator - an iterator enumerating a set of strings.
        map - a minimal perfect hash for the strings enumerated by iterator; it must support size() and have default return value -1.
        signatureWidth - the width, in bits, of the signature of each string.
    • Method Detail

      • 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

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

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