org.geotools.data.sort
Class SortedFeatureIterator

Object
  extended by SortedFeatureIterator
All Implemented Interfaces:
Closeable, SimpleFeatureIterator, FeatureIterator<SimpleFeature>

public class SortedFeatureIterator
extends Object
implements SimpleFeatureIterator


Constructor Summary
SortedFeatureIterator(SimpleFeatureIterator iterator, SimpleFeatureType schema, SortBy[] sortBy, int maxFeatures)
          Builds a new sorting feature iterator
 
Method Summary
static boolean canSort(SimpleFeatureType schema, SortBy[] sortBy)
          Checks if the schema and the sortBy are suitable for merge/sort.
 void close()
          Closes this iterator and releases any system resources associated with it.
 boolean hasNext()
          Does another Feature exist in this Iteration.
 SimpleFeature next()
          Get the next Feature in this iteration.
 
Methods inherited from class Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
 

Constructor Detail

SortedFeatureIterator

public SortedFeatureIterator(SimpleFeatureIterator iterator,
                             SimpleFeatureType schema,
                             SortBy[] sortBy,
                             int maxFeatures)
                      throws IOException
Builds a new sorting feature iterator

Parameters:
iterator - The iterator to be sorted
schema - The iterator schema
sortBy - The sorting directives
maxFeatures - The maximum number of features to keep in memory
Throws:
IOException
Method Detail

canSort

public static final boolean canSort(SimpleFeatureType schema,
                                    SortBy[] sortBy)
Checks if the schema and the sortBy are suitable for merge/sort. All attributes need to be Serializable, all sorting attributes need to be Comparable

Parameters:
schema -
sortBy -
Returns:

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 FeatureIterator<SimpleFeature>
Returns:
true if more Features exist, false otherwise.

next

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

Specified by:
next in interface FeatureIterator<SimpleFeature>
Returns:
The next Feature
Throws:
NoSuchElementException - If no more Features exist.

close

public void close()
Description copied from interface: FeatureIterator
Closes this iterator and releases any system resources associated with it.

Specified by:
close in interface Closeable
Specified by:
close in interface FeatureIterator<SimpleFeature>


Copyright © 1996-2014 Geotools. All Rights Reserved.