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)
| 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. |