| 106 | NodeIter iterate(final QueryContext qc) throws QueryException { |
| 107 | return new SetIter(qc, iters(qc)) { |
| 108 | @Override |
| 109 | public GNode next() throws QueryException { |
| 110 | if(nodes == null) { |
| 111 | final int il = iter.length; |
| 112 | nodes = new GNode[il]; |
| 113 | for(int i = 0; i < il; i++) next(i); |
| 114 | } |
| 115 | |
| 116 | final int il = nodes.length; |
| 117 | for(int i = 1; i < il; i++) { |
| 118 | if(nodes[0] == null) return null; |
| 119 | if(nodes[i] == null) continue; |
| 120 | final int d = nodes[0].compare(nodes[i]); |
| 121 | |
| 122 | if(d < 0 && i + 1 == il) break; |
| 123 | if(d == 0) { |
| 124 | next(0); |
| 125 | i = 0; |
| 126 | } |
| 127 | if(d > 0) next(i--); |
| 128 | } |
| 129 | final GNode temp = nodes[0]; |
| 130 | next(0); |
| 131 | return temp; |
| 132 | } |
| 133 | }; |
| 134 | } |
| 135 | |