org.geotools.feature.collection
Class SortedSimpleFeatureCollection

Object
  extended by DecoratingSimpleFeatureCollection
      extended by SortedSimpleFeatureCollection
All Implemented Interfaces:
SimpleFeatureCollection, FeatureCollection<SimpleFeatureType,SimpleFeature>

public class SortedSimpleFeatureCollection
extends DecoratingSimpleFeatureCollection

A wrapper that will sort a feature collection using a size sensitive algorithm, in main memory for small collections, using secondary memory otherwise. The threshold is defined by the Hints.MAX_MEMORY_SORT feature count

Author:
Andrea Aime - GeoSolutions

Field Summary
 
Fields inherited from class DecoratingSimpleFeatureCollection
delegate
 
Constructor Summary
SortedSimpleFeatureCollection(SimpleFeatureCollection delegate, SortBy[] sort)
           
 
Method Summary
 SimpleFeatureIterator features()
          Obtain a SimpleFeatureIterator of the Features within this SimpleFeatureCollection.
 
Methods inherited from class DecoratingSimpleFeatureCollection
accepts, canDelegate, contains, containsAll, equals, getBounds, getID, getSchema, hashCode, isEmpty, size, sort, subCollection, toArray, toArray
 
Methods inherited from class Object
clone, finalize, getClass, notify, notifyAll, toString, wait, wait, wait
 

Constructor Detail

SortedSimpleFeatureCollection

public SortedSimpleFeatureCollection(SimpleFeatureCollection delegate,
                                     SortBy[] sort)
Method Detail

features

public SimpleFeatureIterator features()
Description copied from interface: SimpleFeatureCollection
Obtain a SimpleFeatureIterator of the Features within this SimpleFeatureCollection.

The implementation of FeatureIterator must adhere to the rules of fail-fast concurrent modification. In addition (to allow for resource backed collections) the SimpleFeatureIterator.close() method must be called.

Example use:


 SimpleFeatureIterator iterator=collection.features();
 try {
     while( iterator.hasNext()  ){
          SimpleFeature feature = iterator.next();
          System.out.println( feature.getID() );
     }
 }
 finally {
     iterator.close();
 }
 

Specified by:
features in interface SimpleFeatureCollection
Specified by:
features in interface FeatureCollection<SimpleFeatureType,SimpleFeature>
Overrides:
features in class DecoratingSimpleFeatureCollection
Returns:
A FeatureIterator.


Copyright © 1996-2014 Geotools. All Rights Reserved.