org.geotools.feature.collection
Class FilteredIterator<F extends Feature>

Object
  extended by FilteredIterator<F>
All Implemented Interfaces:
Closeable, Iterator<F>, FeatureIterator<F>

public class FilteredIterator<F extends Feature>
extends Object
implements Iterator<F>, FeatureIterator<F>

Provides an implementation of Iterator that will filter contents using the provided filter.

This is a *Generic* iterator not limited to Feature, this will become more interesting as Filter is able to evaulate itself with more things then just Features.

This also explains the use of Collection (where you may have expected a FeatureCollection). However FeatureCollectoin.close( iterator ) will be called on the internal delgate.

Author:
Jody Garnett, Refractions Research, Inc.

Constructor Summary
FilteredIterator(Collection<F> collection, Filter filter)
           
FilteredIterator(Iterator<F> iterator, Filter filter)
           
 
Method Summary
 void close()
          Package protected, please use SubFeatureCollection.close( iterator )
 boolean hasNext()
          Does another Feature exist in this Iteration.
 F next()
          Get the next Feature in this iteration.
 void remove()
           
 
Methods inherited from class Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
 

Constructor Detail

FilteredIterator

public FilteredIterator(Iterator<F> iterator,
                        Filter filter)

FilteredIterator

public FilteredIterator(Collection<F> collection,
                        Filter filter)
Method Detail

close

public void close()
Package protected, please use SubFeatureCollection.close( iterator )

Specified by:
close in interface Closeable
Specified by:
close in interface FeatureIterator<F extends Feature>

hasNext

public boolean hasNext()
Description copied from interface: FeatureIterator
Does another Feature exist in this Iteration.

Iterator defin: Returns true if the iteration has more elements. (In other words, returns true if next would return an element rather than throwing an exception.)

Specified by:
hasNext in interface Iterator<F extends Feature>
Specified by:
hasNext in interface FeatureIterator<F extends Feature>
Returns:
true if more Features exist, false otherwise.

next

public F next()
Description copied from interface: FeatureIterator
Get the next Feature in this iteration.

Specified by:
next in interface Iterator<F extends Feature>
Specified by:
next in interface FeatureIterator<F extends Feature>
Returns:
The next Feature

remove

public void remove()
Specified by:
remove in interface Iterator<F extends Feature>


Copyright © 1996-2014 Geotools. All Rights Reserved.