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