Package org.geotools.feature
Class FeatureCollectionIteration
- Object
-
- FeatureCollectionIteration
-
public class FeatureCollectionIteration extends Object
The FeatureCollectionIteration provides a depth first traversal of a SimpleFeatureCollection which will call the provided call-back Handler. Because of the complex nature of Features, which may have other Features (or even a collection of Features) as attributes, the handler is repsonsible for maintaining its own state as to where in the traversal it is recieving events from. Many handlers will not need to worry about state.Implementation Notes: The depth first visitation is implemented through recursion. The limits to recursion depending on the settings in the JVM, but some tests show a 2 argument recursive having a limit of ~50000 method calls with a stack size of 512k (the standard setting).
- Author:
- Ian Schneider, USDA-ARS, Chris Holmes, TOPP
-
-
Nested Class Summary
Nested Classes Modifier and Type Class Description static interface
FeatureCollectionIteration.Handler
A callback handler for the iteration of the contents of a FeatureCollection.
-
Field Summary
Fields Modifier and Type Field Description protected FeatureCollectionIteration.Handler
handler
A callback handler for the iteration of the contents of a FeatureCollection.
-
Constructor Summary
Constructors Constructor Description FeatureCollectionIteration(FeatureCollectionIteration.Handler handler, FeatureCollection<?,?> collection)
Create a new FeatureCollectionIteration with the given handler and collection.
-
Method Summary
All Methods Static Methods Instance Methods Concrete Methods Modifier and Type Method Description void
iterate()
Start the iteration.protected void
iterate(FeatureIterator<?> iterator)
Perform the actual iteration on the Iterator which is provided.static void
iteration(FeatureCollectionIteration.Handler handler, FeatureCollection<?,?> collection)
A convienience method for obtaining a new iteration and calling iterate.protected void
walker(Feature feature)
Perform the visitation of an individual Feature.protected void
walker(FeatureCollection<?,?> collection)
Perform the iterative behavior on the given collection.
-
-
-
Field Detail
-
handler
protected final FeatureCollectionIteration.Handler handler
A callback handler for the iteration of the contents of a FeatureCollection.
-
-
Constructor Detail
-
FeatureCollectionIteration
public FeatureCollectionIteration(FeatureCollectionIteration.Handler handler, FeatureCollection<?,?> collection) throws NullPointerException
Create a new FeatureCollectionIteration with the given handler and collection.- Parameters:
handler
- The handler to perform operations on this iteration.collection
- The collection to iterate over.- Throws:
NullPointerException
- If handler or collection are null.
-
-
Method Detail
-
iteration
public static void iteration(FeatureCollectionIteration.Handler handler, FeatureCollection<?,?> collection)
A convienience method for obtaining a new iteration and calling iterate.- Parameters:
handler
- The handler to perform operations on this iteration.collection
- The collection to iterate over.
-
iterate
public void iterate()
Start the iteration.
-
walker
protected void walker(FeatureCollection<?,?> collection)
Perform the iterative behavior on the given collection. This will alert the handler with ahandleFeatureCollection
call, followed by aniterate()
, followed by ahandler.endFeatureCollection()
call.- Parameters:
collection
- The collection to iterate upon.
-
iterate
protected void iterate(FeatureIterator<?> iterator)
Perform the actual iteration on the Iterator which is provided.- Parameters:
iterator
- The Iterator to iterate upon.
-
walker
protected void walker(Feature feature)
Perform the visitation of an individual Feature.- Parameters:
feature
- The Feature to explore.
-
-