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

Method findPre

basex-core/src/main/java/org/basex/index/IdPreMap.java:292–304  ·  view source on GitHub ↗

Searches for a given PRE value. @param pre PRE value @return index of the record where the PRE is found, or the insertion point if not found

(final int pre)

Source from the content-addressed store, hash-verified

290 * @return index of the record where the PRE is found, or the insertion point if not found
291 */
292 private int findPre(final int pre) {
293 int low = 0;
294 int high = rows - 1;
295 while(low <= high) {
296 final int mid = low + high >>> 1;
297 final int midValMin = pres[mid];
298 final int midValMax = midValMin + nids[mid] - fids[mid];
299 if(midValMax < pre) low = mid + 1;
300 else if(midValMin > pre) high = mid - 1;
301 else return mid; // key found
302 }
303 return low; // key not found.
304 }
305
306 /**
307 * Binary search of a key in a list. If there are several hits the last one is returned.

Callers 1

deleteMethod · 0.95

Calls

no outgoing calls

Tested by

no test coverage detected