(final QueryContext qc, final InputInfo ii)
| 20 | */ |
| 21 | public final class FnCount extends StandardFunc { |
| 22 | @Override |
| 23 | public Itr item(final QueryContext qc, final InputInfo ii) throws QueryException { |
| 24 | // iterative access: if the iterator size is unknown, iterate through all results |
| 25 | final Iter input = arg(0).iter(qc); |
| 26 | long size = input.size(); |
| 27 | if(size == -1) { |
| 28 | do ++size; while(qc.next(input) != null); |
| 29 | } |
| 30 | return Itr.get(size); |
| 31 | } |
| 32 | |
| 33 | @Override |
| 34 | protected void simplifyArgs(final CompileContext cc) throws QueryException { |