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

Method unwrappedIter

basex-core/src/main/java/org/basex/query/expr/Expr.java:138–163  ·  view source on GitHub ↗

Evaluates the expression and returns an iterator on the resulting, unwrapped items. @param qc query context @return iterator @throws QueryException query exception

(final QueryContext qc)

Source from the content-addressed store, hash-verified

136 * @throws QueryException query exception
137 */
138 public Iter unwrappedIter(final QueryContext qc) throws QueryException {
139 final Iter iter = iter(qc);
140 if(!seqType().mayBeWrapped()) return iter;
141
142 return new Iter() {
143 private Iter unwrapped;
144
145 @Override
146 public Item next() throws QueryException {
147 while(true) {
148 if(unwrapped == null) {
149 final Item item = iter.next();
150 if(item == null) return null;
151 if(item instanceof final JNode jnode) {
152 unwrapped = jnode.value.unwrappedIter(qc);
153 } else {
154 return item;
155 }
156 }
157 final Item item = unwrapped.next();
158 if(item != null) return item;
159 unwrapped = null;
160 }
161 }
162 };
163 }
164
165 /**
166 * Evaluates the expression and returns the unwrapped items.

Callers 15

itemMethod · 0.95
nextMethod · 0.45
iterateMethod · 0.45
itemMethod · 0.45
nextMethod · 0.45
itemMethod · 0.45
itemMethod · 0.45
toFilesMethod · 0.45
toEntriesMethod · 0.45
itemMethod · 0.45
iterMethod · 0.45
itemMethod · 0.45

Calls 3

iterMethod · 0.95
seqTypeMethod · 0.95
mayBeWrappedMethod · 0.80

Tested by

no test coverage detected