Start line:  
End line:  

Snippet Preview

Snippet HTML Code

Stack Overflow Questions
 package com.fasterxml.clustermate.api;
Simple value class that encapsulates a 32-bit int hash value in context of a specific KeySpace. Used to hide the details of modulo calculations and reduce likelihood of mismatch between full hash value and hash modulo; latter being used for all calculations within a KeySpace.
public class KeyHash
    private final int _fullHash;
    private final int _moduloHash;
    public KeyHash(int fullHashint modulo)
         = fullHash;
         = calcModulo(fullHashmodulo);
    public static int calcModulo(int fullHashint modulo)
        int h = (fullHash < 0) ? (fullHash & 0x7FFFFFFF) : fullHash;
        return h % modulo;
    public int getModuloHash() { return ; }
    public int getFullHash() { return ; }
    public String toString()
        return "[KeyHash, full=0x"+Integer.toHexString()+"; modulo=0x"+Integer.toHexString()+"]";
New to GrepCode? Check out our FAQ X