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

Method iter

basex-core/src/main/java/org/basex/query/func/db/DbNodeId.java:24–50  ·  view source on GitHub ↗
(final QueryContext qc)

Source from the content-addressed store, hash-verified

22 */
23public class DbNodeId extends StandardFunc {
24 @Override
25 public final Iter iter(final QueryContext qc) throws QueryException {
26 final Iter nodes = arg(0).unwrappedIter(qc);
27 final long size = nodes.size();
28
29 return new Iter() {
30 @Override
31 public Itr next() throws QueryException {
32 final Item item = qc.next(nodes);
33 return item != null ? Itr.get(id(item)) : null;
34 }
35 @Override
36 public Itr get(final long i) throws QueryException {
37 return Itr.get(id(nodes.get(i)));
38 }
39 @Override
40 public long size() throws QueryException {
41 return size;
42 }
43 @Override
44 public Value value(final QueryContext q, final Expr expr) throws QueryException {
45 final IntList ids = new IntList(size);
46 addIds(nodes.value(qc, expr), ids);
47 return IntSeq.get(ids.finish());
48 }
49 };
50 }
51
52 /**
53 * Returns a node ID.

Callers

nothing calls this directly

Calls 3

sizeMethod · 0.95
unwrappedIterMethod · 0.45
argMethod · 0.45

Tested by

no test coverage detected