Class TextHashFunctions.Fold

  • Enclosing class:
    TextHashFunctions

    private abstract static class TextHashFunctions.Fold
    extends java.lang.Object
    Base class for any hashCode folding function to be tested.
    • Field Summary

      Fields 
      Modifier and Type Field Description
      (package private) java.lang.String name  
    • Constructor Summary

      Constructors 
      Modifier Constructor Description
      private Fold()  
    • Method Summary

      All Methods Instance Methods Abstract Methods 
      Modifier and Type Method Description
      (package private) abstract int fold​(int hash, int bits)
      Fold the given 32-bit hash code into only bits of space.
      • Methods inherited from class java.lang.Object

        clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
    • Field Detail

      • name

        java.lang.String name
    • Constructor Detail

      • Fold

        private Fold()
    • Method Detail

      • fold

        abstract int fold​(int hash,
                          int bits)
        Fold the given 32-bit hash code into only bits of space.
        Parameters:
        hash - the 32 bit hash code to be folded into a smaller value.
        bits - total number of bits that can appear in the output. The output value must be in the range [0, 1 << bits). When bits = 2, valid outputs are 0, 1, 2, 3.
        Returns:
        the folded hash, squeezed into only bits.