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

Method test

basex-core/src/main/java/org/basex/query/func/fn/FnEvery.java:25–40  ·  view source on GitHub ↗
(final QueryContext qc, final InputInfo ii, final long pos)

Source from the content-addressed store, hash-verified

23 }
24
25 @Override
26 public final boolean test(final QueryContext qc, final InputInfo ii, final long pos)
27 throws QueryException {
28 // implementation for dynamic function lookup
29 final Iter input = arg(0).iter(qc);
30 final FItem predicate = toFunctionOrNull(arg(1), 2, qc);
31
32 final HofArgs args = predicate != null ? new HofArgs(2, predicate) : null;
33 final boolean some = some();
34 for(Item item; (item = qc.next(input)) != null;) {
35 final boolean test = predicate == null ? item.test(qc, info, 0) :
36 invoke(predicate, args.set(0, item).inc(), qc).test(qc, info, 0);
37 if(test == some) return some;
38 }
39 return !some;
40 }
41
42 @Override
43 protected final Expr opt(final CompileContext cc) throws QueryException {

Callers 1

itemMethod · 0.95

Calls 10

someMethod · 0.95
testMethod · 0.95
setMethod · 0.95
toFunctionOrNullMethod · 0.80
incMethod · 0.80
iterMethod · 0.65
nextMethod · 0.65
testMethod · 0.65
invokeMethod · 0.65
argMethod · 0.45

Tested by

no test coverage detected