/** * Locates the index of <tt>val</tt>. * * @param val an <code>short</code> value * @return the index of <tt>val</tt> or -1 if it isn't in the set. */ protected int index(short val) { int hash, probe, index, length; final byte[] states = _states; final short[] set = _set; length = states.length; hash = _hashingStrategy.computeHashCode(val) & 0x7fffffff; index = hash % length; if (states[index] != FREE && (states[index] == REMOVED || set[index] != val)) { // see Knuth, p. 529 probe = 1 + (hash % (length - 2)); do { index -= probe; if (index < 0) { index += length; } } while (states[index] != FREE && (states[index] == REMOVED || set[index] != val)); } return states[index] == FREE ? -1 : index; }
final short[] set = _set; length = states.length; hash = _hashingStrategy.computeHashCode(val) & 0x7fffffff; index = hash % length;
public final boolean execute(short key, long value) { h += (_hashingStrategy.computeHashCode(key) ^ HashFunctions.hash(value)); return true; } }