com.hp.hpl.jena.util.iterator
Class FilterIterator

java.lang.Object
  extended by com.hp.hpl.jena.util.iterator.NiceIterator
      extended by com.hp.hpl.jena.util.iterator.WrappedIterator
          extended by com.hp.hpl.jena.util.iterator.FilterIterator
All Implemented Interfaces:
ClosableIterator, ExtendedIterator, java.util.Iterator
Direct Known Subclasses:
FilterDropIterator, FilterKeepIterator

public class FilterIterator
extends WrappedIterator

Creates a sub-Iterator by filtering. This class should not be used directly any more; the subclasses FilterKeepIterator and FilterDropIterator should be used instead.

Author:
jjc, mods [clarity & speedup] by kers

Constructor Summary
FilterIterator(Filter fl, java.util.Iterator e)
          Initialises a FilterIterator with its filter and base.
 
Method Summary
 boolean hasNext()
          Answer true iff there is at least one more acceptable object.
 java.lang.Object next()
          Answer the next acceptable object from the base iterator.
 void remove()
          Remove the current member from the underlying iterator.
 
Methods inherited from class com.hp.hpl.jena.util.iterator.WrappedIterator
close, close, create, createNoRemove, forTestingOnly_getBase
 
Methods inherited from class com.hp.hpl.jena.util.iterator.NiceIterator
andThen, andThen, emptyIterator, filterDrop, filterKeep, mapWith, removeNext
 
Methods inherited from class java.lang.Object
equals, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
 

Constructor Detail

FilterIterator

public FilterIterator(Filter fl,
                      java.util.Iterator e)
Initialises a FilterIterator with its filter and base.

Parameters:
fl - An object is included if it is accepted by this Filter.
e - The base Iterator.
Method Detail

hasNext

public boolean hasNext()
Answer true iff there is at least one more acceptable object. [Stores reference into current, sets canRemove false; answer preserved in `hasCurrent`]

Specified by:
hasNext in interface java.util.Iterator
Overrides:
hasNext in class WrappedIterator

remove

public void remove()
Remove the current member from the underlying iterator. Legal only after a .next() but before any subsequent .hasNext(), because that may advance the underlying iterator.

Specified by:
remove in interface java.util.Iterator
Overrides:
remove in class WrappedIterator

next

public java.lang.Object next()
Answer the next acceptable object from the base iterator. The redundant test of `hasCurrent` appears to make a detectable speed difference. Crazy.

Specified by:
next in interface java.util.Iterator
Overrides:
next in class WrappedIterator


Copyright © 2000, 2001, 2002, 2003, 2004, 2005 Hewlett-Packard Development Company, LP