/** * Return the current location */ public int[] getCurrentLocation() { return iterator.getCurrentLocation(); }
/** * Return true if calls to next() will succeed */ public boolean hasNext() { return iterator.hasNext(); }
/** * Reset the underlying JoinIterator */ public void reset() { iterator.reset(); }
/** * 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; }
/** * Get the current location by appending all the current location arrays of * all child iterators */ public int[] getCurrentLocation() { ResumableIterator[] iterators = iterators(); ArrayList temp = new ArrayList(); for (int i = 0; i < iterators.length; i++) { temp.add(iterators[i].getCurrentLocation()); } return concatArrays(temp); }
/** * Return the size of the underlying JoinIterator */ public int size() { return iterator.size(); }
/** * Return a Map of named objects derived from any iterator nodes attached to * this one as children. The iteration strategy is derived from the * JoinIterator which performs a cross product or orthoganol join across all * the sub-iterators */ public Object next() { // Result will be an array of Map objects, convert to a Map i.e. // convert [{foo->bar}],[{urgle->wibble}] to {foo->bar,urgle->wibble} // and return Object[] o = (Object[]) iterator.next(); Map[] map = new Map[o.length]; for (int i = 0; i < o.length; i++) { map[i] = (Map) o[i]; } Map result = new HashMap(); for (int j = 0; j < map.length; j++) { for (Iterator i = map[j].keySet().iterator(); i.hasNext();) { String name = (String) i.next(); Object value = map[j].get(name); result.put(name, value); } } return result; }
String desiredType2 = "'text/plain'"; for (Iterator i = new JoinIterator( new BaclavaIterator[] { thing.iterator(desiredType), thing2.iterator(desiredType2) }); i.hasNext();) {
if (initialized == false) { currentState = new Object[iterators().length]; for (int i = 0; i < iterators().length; i++) { currentState[i] = iterators()[i].next(); int iteratorNumber = iterators().length - 1; boolean doneRolling = false; if (iterators()[iteratorNumber].hasNext()) { currentState[iteratorNumber] = iterators()[iteratorNumber] .next(); doneRolling = true; iterators()[iteratorNumber].reset(); currentState[iteratorNumber] = iterators()[iteratorNumber] .next(); iteratorNumber--;