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

Method next

basex-core/src/main/java/org/basex/query/expr/gflwor/Window.java:109–140  ·  view source on GitHub ↗
(final QueryContext qc)

Source from the content-addressed store, hash-verified

107 private long spos;
108
109 @Override
110 public boolean next(final QueryContext qc) throws QueryException {
111 while(true) {
112 // find first item
113 final Item fst = vals != null ? vals[0] : findStart(qc) ? curr : null;
114
115 // find end item
116 if(fst != null) {
117 final ValueBuilder vb = new ValueBuilder(qc).add(fst);
118 final Item[] st = vals == null ? new Item[] { curr, prev, next } : vals;
119 final long ps = vals == null ? pos : spos;
120 vals = null;
121
122 while(readNext()) {
123 if(start.matches(qc, curr, pos, prev, next)) {
124 vals = new Item[] { curr, prev, next };
125 spos = pos;
126 break;
127 }
128 vb.add(curr);
129 }
130
131 start.bind(qc, st[0], ps, st[1], st[2]);
132 qc.set(var, vb.value(Window.this));
133 return true;
134 }
135
136 // no more iterations from above, we're done here
137 if(!prepareNext(qc, sub)) return false;
138 vals = null;
139 }
140 }
141 };
142 }
143

Callers 1

advanceMethod · 0.95

Calls 14

addMethod · 0.95
valueMethod · 0.95
advanceMethod · 0.95
findStartMethod · 0.80
readNextMethod · 0.80
addMethod · 0.65
setMethod · 0.65
nextMethod · 0.65
matchesMethod · 0.45
bindMethod · 0.45
prepareNextMethod · 0.45
iteratorMethod · 0.45

Tested by

no test coverage detected