Package gnu.kawa.util

Class HashUtils


  • public class HashUtils
    extends java.lang.Object
    Various static helper methods for calculating hash-codes. These are designed to tolerate cyclic data structrues, by using a recursive/iteration limit. The actual hash functions used (unless we fall back to Object#hashCode) is the MurmurHash3 algorithm: http://en.wikipedia.org/wiki/MurmurHash https://code.google.com/p/smhasher/wiki/MurmurHash3
    • Constructor Summary

      Constructors 
      Constructor Description
      HashUtils()  
    • Method Summary

      All Methods Static Methods Concrete Methods 
      Modifier and Type Method Description
      static int boundedHash​(Array arr, int seed, int limit)  
      static int boundedHash​(java.lang.Object object)  
      static int boundedHash​(java.lang.Object object, int seed, int limit)
      Generic hash method.
      static int boundedHash​(java.util.List object, int seed, int limit)  
      static int boundedHashArray​(java.lang.Object object, int seed, int limit)  
      static int hashInt​(int seed, int value)  
      static int murmur3finish​(int hash, int length)  
      static int murmur3step​(int h1, int k1)  
      • Methods inherited from class java.lang.Object

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

      • HashUtils

        public HashUtils()
    • Method Detail

      • boundedHash

        public static int boundedHash​(java.lang.Object object)
      • boundedHash

        public static int boundedHash​(java.lang.Object object,
                                      int seed,
                                      int limit)
        Generic hash method. See BoundedHashable for a discussion of the parameters.
      • hashInt

        public static int hashInt​(int seed,
                                  int value)
      • boundedHash

        public static int boundedHash​(java.util.List object,
                                      int seed,
                                      int limit)
      • boundedHashArray

        public static int boundedHashArray​(java.lang.Object object,
                                           int seed,
                                           int limit)
      • boundedHash

        public static int boundedHash​(Array arr,
                                      int seed,
                                      int limit)
      • murmur3step

        public static int murmur3step​(int h1,
                                      int k1)
      • murmur3finish

        public static int murmur3finish​(int hash,
                                        int length)