| 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 { |