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

Method store

basex-core/src/main/java/org/basex/util/hash/TokenSet.java:171–183  ·  view source on GitHub ↗

Stores the specified key and returns its index, or returns the negative index if the key has already been stored. @param key key to be indexed @return index, or negative index if the key already exists

(final byte[] key)

Source from the content-addressed store, hash-verified

169 * @return index, or negative index if the key already exists
170 */
171 private int store(final byte[] key) {
172 final int h = Token.hashCode(key);
173 int b = h & capacity() - 1;
174 for(int i = buckets[b]; i != 0; i = next[i]) {
175 if(Token.eq(key, keys[i])) return -i;
176 }
177 final int s = size++;
178 if(checkCapacity()) b = h & capacity() - 1;
179 next[s] = buckets[b];
180 keys[s] = key;
181 buckets[b] = s;
182 return s;
183 }
184
185 @Override
186 protected final int hashCode(final int index) {

Callers 2

addMethod · 0.95
putMethod · 0.95

Calls 4

hashCodeMethod · 0.95
eqMethod · 0.95
capacityMethod · 0.80
checkCapacityMethod · 0.45

Tested by

no test coverage detected