org.inria.ns.reflex.util
Class FilteredIterator

java.lang.Object
  extended by org.inria.ns.reflex.util.FilteredIterator
All Implemented Interfaces:
Iterator

public class FilteredIterator
extends Object
implements Iterator

Instances of classes that implement this interface are used to filter items of an iterator.

Author:
Philippe Poulard
See Also:
Acceptor

Constructor Summary
FilteredIterator(Iterator iterator, Acceptor acceptor)
          Create an iterator based on another iterator to filter.
 
Method Summary
 boolean hasNext()
          Indicates whether there is a next item not filtered.
 Object next()
          Return the next item accepted by the filter.
 void remove()
          Not supported.
 
Methods inherited from class java.lang.Object
equals, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
 

Constructor Detail

FilteredIterator

public FilteredIterator(Iterator iterator,
                        Acceptor acceptor)
Create an iterator based on another iterator to filter.

Parameters:
iterator - The iterator to filter.
acceptor - The filter to apply on the items of the iterator.
Method Detail

hasNext

public boolean hasNext()
Indicates whether there is a next item not filtered.

Specified by:
hasNext in interface Iterator
Returns:
true if there is a next item accepted by the filter, false otherwise.

next

public Object next()
Return the next item accepted by the filter.

Specified by:
next in interface Iterator
Returns:
The next item not filtered.
Throws:
NoSuchElementException - When there is no more accepted item.

remove

public void remove()
Not supported.

Specified by:
remove in interface Iterator
Throws:
UnsupportedOperationException - Always.