MCPcopy Create free account
hub / github.com/BaseXdb/basex / hashCode

Method hashCode

basex-core/src/main/java/org/basex/util/Token.java:682–690  ·  view source on GitHub ↗

Calculates a hash code for the specified token. @param token specified token @return hash code

(final byte[] token)

Source from the content-addressed store, hash-verified

680 * @return hash code
681 */
682 public static int hashCode(final byte[] token) {
683 // warning: a change in the hash computation affects existing databases
684 final int tl = token.length, s = Math.max(1, tl / MAX_HASH_OPS);
685 int h = 0;
686 for(int t = 0; t < tl; t += s) {
687 h = h * 31 + token[t];
688 }
689 return h;
690 }
691
692 /**
693 * Compares two tokens for equality.

Callers 15

hashCodeMethod · 0.95
hashCodeMethod · 0.95
hashCodeMethod · 0.95
hashCodeMethod · 0.95
hashCodeMethod · 0.95
hashCodeMethod · 0.95
hashCodeMethod · 0.95
hashCodeMethod · 0.95
getMethod · 0.95
addMethod · 0.95
deleteMethod · 0.95
putMethod · 0.95

Calls 1

maxMethod · 0.45

Tested by 1

gh1779Method · 0.36