Package org.geotools.process.vector
Class ProcessingCollection<T extends FeatureType,F extends Feature>
- Object
-
- BaseFeatureCollection<T,F>
-
- ProcessingCollection<T,F>
-
- Type Parameters:
T
-F
-
- All Implemented Interfaces:
FeatureCollection<T,F>
- Direct Known Subclasses:
SimpleProcessingCollection
public abstract class ProcessingCollection<T extends FeatureType,F extends Feature> extends BaseFeatureCollection<T,F>
Abstract base class to ease the implementation of a streaming processing collection, that is, one that tries to compute the results on the fly as the iterator is traversed.Besides the few methods that the implementor actually needs to override it suggested to consider overriding also the followings to get extra performance gains:
- Author:
- Andrea Aime - GeoSolutions
-
-
Field Summary
-
Fields inherited from class BaseFeatureCollection
id, schema
-
-
Constructor Summary
Constructors Constructor Description ProcessingCollection()
-
Method Summary
All Methods Instance Methods Abstract Methods Concrete Methods Modifier and Type Method Description protected abstract T
buildTargetFeatureType()
Builds once and for all the target feature type.abstract FeatureIterator<F>
features()
Streams out the output featuresabstract ReferencedEnvelope
getBounds()
The bounds of features in the output.T
getSchema()
The schema for the child feature members of this collection.abstract int
size()
The number of features in the output.-
Methods inherited from class BaseFeatureCollection
accepts, contains, containsAll, getID, isEmpty, sort, subCollection, toArray, toArray
-
-
-
-
Method Detail
-
features
public abstract FeatureIterator<F> features()
Streams out the output features- Specified by:
features
in interfaceFeatureCollection<T extends FeatureType,F extends Feature>
- Specified by:
features
in classBaseFeatureCollection<T extends FeatureType,F extends Feature>
- Returns:
- A FeatureIterator.
-
getBounds
public abstract ReferencedEnvelope getBounds()
The bounds of features in the output. If the bounds are not known in advance once can call the getFeatureBounds() which will build it from the features as they are returned from the feature iterator.- Specified by:
getBounds
in interfaceFeatureCollection<T extends FeatureType,F extends Feature>
- Overrides:
getBounds
in classBaseFeatureCollection<T extends FeatureType,F extends Feature>
- Returns:
- An Envelope containing the total bounds of this collection.
-
buildTargetFeatureType
protected abstract T buildTargetFeatureType()
Builds once and for all the target feature type. The results are available by calling getSchema()
-
size
public abstract int size()
The number of features in the output. If the size is not known in advance once can call the getFeatureCount() which will count the features as they are returned from the feature iterator.- Specified by:
size
in interfaceFeatureCollection<T extends FeatureType,F extends Feature>
- Overrides:
size
in classBaseFeatureCollection<T extends FeatureType,F extends Feature>
- Returns:
- Number of items, or Interger.MAX_VALUE
- See Also:
Collection.size()
-
getSchema
public T getSchema()
Description copied from interface:FeatureCollection
The schema for the child feature members of this collection.Represents the most general FeatureType in common to all the features in this collection.
- For a collection backed by a shapefiles (or database tables) the FeatureType returned by getSchema() will complete describe each and every child in the collection.
- For mixed content FeatureCollections you will need to check the FeatureType of each Feature as it is retrived from the collection
- The degenerate case returns the "_Feature" FeatureType, where the only thing known is that the contents are Features.
- Specified by:
getSchema
in interfaceFeatureCollection<T extends FeatureType,F extends Feature>
- Overrides:
getSchema
in classBaseFeatureCollection<T extends FeatureType,F extends Feature>
- Returns:
- FeatureType describing the "common" schema to all child features of this collection
-
-