Class ShiftAddXorSignedStringMap

All Implemented Interfaces:
StringMap<CharSequence>, Function<CharSequence,Long>, Object2LongFunction<CharSequence>, Size64, Serializable, Function<CharSequence,Long>, ToLongFunction<CharSequence>

@Deprecated public class ShiftAddXorSignedStringMap 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 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:
2.0
Author:
Sebastiano Vigna
See Also:
  • Field Details

    • function

      protected final Object2LongFunction<? extends CharSequence> function
      Deprecated.
      The underlying map.
    • signatures

      protected final 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 Details

    • ShiftAddXorSignedStringMap

      public ShiftAddXorSignedStringMap(Iterator<? extends CharSequence> iterator, Object2LongFunction<? extends 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(Iterator<? extends CharSequence> iterator, Object2LongFunction<? extends 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 Details