Returns a value with all iterated items. This method should always be called before single items have been requested. Otherwise, it might not return all items. @param qc query context @param expr original expression (can be null; if assigned, type of result sequence will be refined) @retur
(final QueryContext qc, final Expr expr)
| 61 | * @throws QueryException query exception |
| 62 | */ |
| 63 | public Value value(final QueryContext qc, final Expr expr) throws QueryException { |
| 64 | // empty sequence? |
| 65 | final Item item1 = next(); |
| 66 | if(item1 == null) return Empty.VALUE; |
| 67 | |
| 68 | // single item? |
| 69 | final Item item2 = next(); |
| 70 | if(item2 == null) return item1; |
| 71 | |
| 72 | // build sequence |
| 73 | final ValueBuilder vb = new ValueBuilder(qc, size()).add(item1).add(item2); |
| 74 | for(Item item; (item = next()) != null;) { |
| 75 | vb.add(item); |
| 76 | } |
| 77 | return vb.value(expr); |
| 78 | } |
| 79 | } |