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

Method iterator

basex-core/src/main/java/org/basex/query/expr/path/Step.java:132–154  ·  view source on GitHub ↗

Returns an axis iterator. @param qc query context @return iterator @throws QueryException query exception

(final QueryContext qc)

Source from the content-addressed store, hash-verified

130 * @throws QueryException query exception
131 */
132 final BasicNodeIter iterator(final QueryContext qc) throws QueryException {
133 final Value value = qc.focus.value;
134 GNode gnode;
135 if(value instanceof final GNode node) {
136 gnode = node;
137 } else if(value instanceof final XQStruct struct) {
138 gnode = new JNode(struct);
139 } else {
140 throw value == null ? QueryError.NOCTX_X.get(info, this) :
141 QueryError.PATHNODE_X_X_X.get(info, this, value.type, value);
142 }
143 final BasicNodeIter iter = axis.iter(gnode, test);
144 return new BasicNodeIter() {
145 @Override
146 public GNode next() {
147 for(GNode node; (node = iter.next()) != null;) {
148 qc.checkStop();
149 if(test.matches(node)) return node;
150 }
151 return null;
152 }
153 };
154 }
155
156 @Override
157 public final Expr optimize(final CompileContext cc) throws QueryException {

Callers 8

simplifyMethod · 0.45
filterMethod · 0.45
nextMethod · 0.45
iterMethod · 0.45
testMethod · 0.45
nextMethod · 0.45
iterMethod · 0.45
nextMethod · 0.45

Calls 2

getMethod · 0.65
iterMethod · 0.65

Tested by

no test coverage detected