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

Method store

basex-core/src/main/java/org/basex/util/hash/IntSet.java:88–99  ·  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 int key)

Source from the content-addressed store, hash-verified

86 * @return index, or negative index if the key already exists
87 */
88 private int store(final int key) {
89 int b = key & capacity() - 1;
90 for(int i = buckets[b]; i != 0; i = next[i]) {
91 if(key == keys[i]) return -i;
92 }
93 final int s = size++;
94 if(checkCapacity()) b = key & capacity() - 1;
95 next[s] = buckets[b];
96 keys[s] = key;
97 buckets[b] = s;
98 return s;
99 }
100
101 @Override
102 protected final int hashCode(final int index) {

Callers 2

addMethod · 0.95
putMethod · 0.95

Calls 2

capacityMethod · 0.80
checkCapacityMethod · 0.45

Tested by

no test coverage detected