public BranchingInstanceIterator (PeekingInstanceIterator source) { this.source = new PeekingInstanceIterator (source); this.iterators = new ArrayList<Iterator<Instance>>(pipes.size()); for (Pipe p : pipes) iterators.add (new GateKeepingInstanceIterator (source, p)); } public boolean hasNext () { return source.hasNext(); }
public Instance next() { Instance input = source.peekNext(); for (int i = 0; i < pipes.size(); i++) { if (pipes.get(i).precondition(input)) { return iterators.get(i).next(); } } throw new IllegalStateException ("Next Instance satisfied none of the branches' preconditions."); } /** Return the @link{Pipe} that processes @link{Instance}s going through this iterator. */
public boolean hasNext () { return source.hasNext(); } public Instance next() {
public boolean hasNext () { return source.hasNext(); } public Instance next() {
public boolean hasNext () { return source.hasNext(); } public Instance next() {
public Instance next() { Instance input = source.peekNext(); for (int i = 0; i < pipes.size(); i++) { if (pipes.get(i).precondition(input)) { return iterators.get(i).next(); } } throw new IllegalStateException ("Next Instance satisfied none of the branches' preconditions."); } /** Return the @link{Pipe} that processes @link{Instance}s going through this iterator. */
public BranchingInstanceIterator (PeekingInstanceIterator source) { this.source = new PeekingInstanceIterator (source); this.iterators = new ArrayList<Iterator<Instance>>(pipes.size()); for (Pipe p : pipes) iterators.add (new GateKeepingInstanceIterator (source, p)); } public boolean hasNext () { return source.hasNext(); }
public Instance next() { Instance input = source.peekNext(); for (int i = 0; i < pipes.size(); i++) { if (pipes.get(i).precondition(input)) { return iterators.get(i).next(); } } throw new IllegalStateException ("Next Instance satisfied none of the branches' preconditions."); } /** Return the @link{Pipe} that processes @link{Instance}s going through this iterator. */
public BranchingInstanceIterator (PeekingInstanceIterator source) { this.source = new PeekingInstanceIterator (source); this.iterators = new ArrayList<Iterator<Instance>>(pipes.size()); for (Pipe p : pipes) iterators.add (new GateKeepingInstanceIterator (source, p)); } public boolean hasNext () { return source.hasNext(); }