/** * The iterator is constructed with an array of BaclavaIterator instances * and creates an iterator that iterates over the orthogonal join of this * set, where the iterator at position 0 in the array is regarded as the * outermost one */ public JoinIterator(ResumableIterator[] b) { this.iteratorsArray = b; // Check that we haven't been passed a load // of empty iterators! if (b.length != 0) { // Check that all the iterators // have at least one element in for (int i = 0; i < b.length; i++) { if (b[i].hasNext() == false) { isEmptyIterator = true; } } } // If here and nextState == true then we have at least // one iterator in the array and every iterator present // has at least one item in. This is mandatory, if this // doesn't apply then we can't create the join. }
/** * If the iterator isn't empty then all the iterators contained within it * are the same length, can therefore just ask the first one */ public synchronized boolean hasNext() { return (emptyIterator()) ? false : iterators()[0].hasNext(); }
+ ((ResumableIterator) i).size() + " elements, " + ((TreeNode) i).getChildCount() + " children."); while (i.hasNext()) {
/** * The join has next if any iterator within it has a next value of true */ public synchronized boolean hasNext() { if (emptyIterator()) { return false; } for (int i = 0; i < iterators().length; i++) { if (iterators()[i].hasNext()) { return true; } } return false; }
InvokingWithIteration event; synchronized (jobQueue) { if (!jobQueue.hasNext()) { return false; } else {
if (iterators()[iteratorNumber].hasNext()) { currentState[iteratorNumber] = iterators()[iteratorNumber] .next();