Class MurmurHash

java.lang.Object
org.antlr.v4.runtime.misc.MurmurHash

public final class MurmurHash extends Object
  • Field Summary

    Fields
    Modifier and Type
    Field
    Description
    private static final int
     
  • Constructor Summary

    Constructors
    Modifier
    Constructor
    Description
    private
     
  • Method Summary

    Modifier and Type
    Method
    Description
    static int
    finish(int hash, int numberOfWords)
    Apply the final computation steps to the intermediate value hash to form the final result of the MurmurHash 3 hash function.
    static <T> int
    hashCode(T[] data, int seed)
    Utility function to compute the hash code of an array using the MurmurHash algorithm.
    static int
    Initialize the hash using the default seed value.
    static int
    initialize(int seed)
    Initialize the hash using the specified seed.
    static int
    update(int hash, int value)
    Update the intermediate hash value for the next input value.
    static int
    update(int hash, Object value)
    Update the intermediate hash value for the next input value.

    Methods inherited from class java.lang.Object

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

  • Constructor Details

    • MurmurHash

      private MurmurHash()
  • Method Details

    • initialize

      public static int initialize()
      Initialize the hash using the default seed value.
      Returns:
      the intermediate hash value
    • initialize

      public static int initialize(int seed)
      Initialize the hash using the specified seed.
      Parameters:
      seed - the seed
      Returns:
      the intermediate hash value
    • update

      public static int update(int hash, int value)
      Update the intermediate hash value for the next input value.
      Parameters:
      hash - the intermediate hash value
      value - the value to add to the current hash
      Returns:
      the updated intermediate hash value
    • update

      public static int update(int hash, Object value)
      Update the intermediate hash value for the next input value.
      Parameters:
      hash - the intermediate hash value
      value - the value to add to the current hash
      Returns:
      the updated intermediate hash value
    • finish

      public static int finish(int hash, int numberOfWords)
      Apply the final computation steps to the intermediate value hash to form the final result of the MurmurHash 3 hash function.
      Parameters:
      hash - the intermediate hash value
      numberOfWords - the number of integer values added to the hash
      Returns:
      the final hash result
    • hashCode

      public static <T> int hashCode(T[] data, int seed)
      Utility function to compute the hash code of an array using the MurmurHash algorithm.
      Type Parameters:
      T - the array element type
      Parameters:
      data - the array data
      seed - the seed for the MurmurHash algorithm
      Returns:
      the hash code of the data