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

Method rehash

basex-core/src/main/java/org/basex/index/IndexCache.java:172–191  ·  view source on GitHub ↗

Resizes the hash table.

()

Source from the content-addressed store, hash-verified

170 * Resizes the hash table.
171 */
172 private void rehash() {
173 purge();
174
175 final int newSize = size << 1;
176 final BucketEntry[] tmp = new BucketEntry[newSize];
177
178 final int l = buckets.length;
179 for(int i = 0; i < l; ++i) {
180 BucketEntry e = buckets[i];
181 buckets[i] = null;
182 while(e != null) {
183 final BucketEntry next = e.next;
184 final int p = indexFor(e.hash, tmp.length);
185 e.next = tmp[p];
186 tmp[p] = e;
187 e = next;
188 }
189 }
190 buckets = tmp;
191 }
192
193 /**
194 * Returns buckets index for a hash code.

Callers 1

addMethod · 0.95

Calls 2

purgeMethod · 0.95
indexForMethod · 0.95

Tested by

no test coverage detected