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

Method pre

basex-core/src/main/java/org/basex/data/Data.java:280–294  ·  view source on GitHub ↗

Returns a PRE value for the specified ID. @param id unique node ID @return PRE value or -1 if ID was not found

(final int id)

Source from the content-addressed store, hash-verified

278 * @return PRE value or {@code -1} if ID was not found
279 */
280 public final int pre(final int id) {
281 if(meta.updindex) return idmap.pre(id);
282
283 // find PRE value in the table; start with specified ID
284 final int size = meta.size;
285 for(int p = Math.max(0, id); p < meta.size; ++p) {
286 if(id == id(p)) return p;
287 }
288 final int ps = Math.min(size, id);
289 for(int p = 0; p < ps; ++p) {
290 if(id == id(p)) return p;
291 }
292 // ID not found
293 return -1;
294 }
295
296 /**
297 * Returns a unique node ID.

Callers

nothing calls this directly

Calls 4

idMethod · 0.95
preMethod · 0.65
maxMethod · 0.45
minMethod · 0.45

Tested by

no test coverage detected