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

Method item

basex-core/src/main/java/org/basex/query/func/bin/BinFind.java:17–28  ·  view source on GitHub ↗
(final QueryContext qc, final InputInfo ii)

Source from the content-addressed store, hash-verified

15 */
16public final class BinFind extends BinFn {
17 @Override
18 public Item item(final QueryContext qc, final InputInfo ii) throws QueryException {
19 final Bin value = toBinOrNull(arg(0), qc);
20 final Long offset = toLongOrNull(arg(1), qc);
21 final Bin search = toBin(arg(2), qc);
22 if(value == null) return Empty.VALUE;
23
24 final byte[] bytes = value.binary(info);
25 final int bl = bytes.length;
26 final int pos = indexOf(bytes, search.binary(info), bounds(offset, null, bl)[0]);
27 return pos == -1 ? Empty.VALUE : Itr.get(pos);
28 }
29}

Callers

nothing calls this directly

Calls 8

binaryMethod · 0.95
getMethod · 0.95
toBinOrNullMethod · 0.80
toLongOrNullMethod · 0.80
toBinMethod · 0.80
boundsMethod · 0.80
argMethod · 0.45
indexOfMethod · 0.45

Tested by

no test coverage detected