Class StripedHashFunction<T>


  • public class StripedHashFunction<T>
    extends java.lang.Object
    An hash function for stripping.

    It calculates the number of segments based on the concurrency level desired and hashes the object to the corresponding segments.

    Since:
    8.0
    Author:
    Pedro Ruivo
    • Constructor Summary

      Constructors 
      Constructor Description
      StripedHashFunction​(int concurrencyLevel)  
    • Method Summary

      All Methods Instance Methods Concrete Methods 
      Modifier and Type Method Description
      int getNumSegments()  
      int hashToSegment​(T object)
      It calculates the segment in which the object belongs.
      • Methods inherited from class java.lang.Object

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

      • StripedHashFunction

        public StripedHashFunction​(int concurrencyLevel)
    • Method Detail

      • getNumSegments

        public final int getNumSegments()
        Returns:
        the number of segments.
      • hashToSegment

        public final int hashToSegment​(T object)
        It calculates the segment in which the object belongs.
        Parameters:
        object - the object to hash.
        Returns:
        the segment index, between 0 and getNumSegments()-1.