org.geotools.feature.collection
Class SubFeatureList

Object
  extended by AbstractFeatureCollection
      extended by SubFeatureCollection
          extended by SubFeatureList
All Implemented Interfaces:
RandomFeatureAccess, FeatureCollection<SimpleFeatureType,SimpleFeature>

public class SubFeatureList
extends SubFeatureCollection
implements RandomFeatureAccess


Field Summary
 
Fields inherited from class SubFeatureCollection
collection, ff, filter
 
Fields inherited from class AbstractFeatureCollection
id, listeners, open, schema
 
Constructor Summary
SubFeatureList(FeatureCollection<SimpleFeatureType,SimpleFeature> list, Filter filter)
           
SubFeatureList(FeatureCollection<SimpleFeatureType,SimpleFeature> list, Filter filter, SortBy subSort)
          Create a simple SubFeatureList with the provided filter.
SubFeatureList(FeatureCollection<SimpleFeatureType,SimpleFeature> list, List order)
           
SubFeatureList(FeatureCollection<SimpleFeatureType,SimpleFeature> list, SortBy sort)
           
 
Method Summary
 boolean add(SimpleFeature feature)
          Appends element.
protected  Filter createFilter()
          Lazy create a filter based on index
protected  List<FeatureId> createIndex()
          Put this SubFeatureList in touch with its inner index
 SimpleFeature get(int position)
          item at the specified index.
 SimpleFeature getFeatureMember(String id)
          Access Feature content by feature id.
protected  List<FeatureId> index()
           
 int indexOf(SimpleFeature feature)
           
 int lastIndexOf(SimpleFeature feature)
           
 Iterator<SimpleFeature> openIterator()
          Returns a quick iterator that uses get and size methods.
 SimpleFeature remove(int position)
           
 SimpleFeature removeFeatureMember(String id)
          Optional Method
 FeatureCollection<SimpleFeatureType,SimpleFeature> subList(Filter subfilter)
          Sublist of this sublist!
 
Methods inherited from class SubFeatureCollection
accepts, clear, close, closeIterator, collection, features, filter, getBounds, getCount, getID, isEmpty, reader, remove, size, sort, subCollection
 
Methods inherited from class AbstractFeatureCollection
accepts, addAll, addAll, addListener, close, contains, containsAll, getOpenIterators, getSchema, iterator, purge, removeAll, removeListener, retainAll, toArray, toArray
 
Methods inherited from class Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
 
Methods inherited from interface FeatureCollection
accepts, addAll, addAll, addListener, clear, close, close, contains, containsAll, features, getBounds, getID, getSchema, isEmpty, iterator, purge, remove, removeAll, removeListener, retainAll, size, sort, subCollection, toArray, toArray
 

Constructor Detail

SubFeatureList

public SubFeatureList(FeatureCollection<SimpleFeatureType,SimpleFeature> list,
                      Filter filter)

SubFeatureList

public SubFeatureList(FeatureCollection<SimpleFeatureType,SimpleFeature> list,
                      SortBy sort)

SubFeatureList

public SubFeatureList(FeatureCollection<SimpleFeatureType,SimpleFeature> list,
                      Filter filter,
                      SortBy subSort)
Create a simple SubFeatureList with the provided filter.

Parameters:
filter -

SubFeatureList

public SubFeatureList(FeatureCollection<SimpleFeatureType,SimpleFeature> list,
                      List order)
Method Detail

get

public SimpleFeature get(int position)
item at the specified index.

Parameters:
index - index of item
Returns:
the item at the specified index.
Throws:
IndexOutOfBoundsException - if index is not between 0 and size

createFilter

protected Filter createFilter()
Lazy create a filter based on index

Overrides:
createFilter in class SubFeatureCollection

index

protected List<FeatureId> index()

createIndex

protected List<FeatureId> createIndex()
Put this SubFeatureList in touch with its inner index


add

public boolean add(SimpleFeature feature)
Appends element.

This implementation calls add(size(), o).

Note that this implementation throws an UnsupportedOperationException unless add(int, Object) is overridden.

Specified by:
add in interface FeatureCollection<SimpleFeatureType,SimpleFeature>
Overrides:
add in class SubFeatureCollection
Parameters:
item - the Object element to be appended to this list.
Returns:
true (as per the general contract of Collection.add).
Throws:
UnsupportedOperationException - if the add method is not supported by this Set.
ClassCastException - if the class of the specified element prevents it from being added to this set.
IllegalArgumentException - some aspect of this element prevents it from being added to this collection.
See Also:
Collection.add(Object)

indexOf

public int indexOf(SimpleFeature feature)

lastIndexOf

public int lastIndexOf(SimpleFeature feature)

subList

public FeatureCollection<SimpleFeatureType,SimpleFeature> subList(Filter subfilter)
Sublist of this sublist!

Implementation will ensure this does not get out of hand, order is maintained and only indexed once.

Overrides:
subList in class AbstractFeatureCollection

getFeatureMember

public SimpleFeature getFeatureMember(String id)
                               throws NoSuchElementException
Description copied from interface: RandomFeatureAccess
Access Feature content by feature id.

Specified by:
getFeatureMember in interface RandomFeatureAccess
Returns:
Feature with the indicated or id
Throws:
NoSuchElementException - if a Feature with the indicated id is not present

removeFeatureMember

public SimpleFeature removeFeatureMember(String id)
Description copied from interface: RandomFeatureAccess
Optional Method

Specified by:
removeFeatureMember in interface RandomFeatureAccess

remove

public SimpleFeature remove(int position)

openIterator

public Iterator<SimpleFeature> openIterator()
Returns a quick iterator that uses get and size methods.

As with all resource collections it is assumed that the iterator will be closed after use.

Overrides:
openIterator in class SubFeatureCollection
Returns:
an iterator over the elements in this list in proper sequence.
See Also:
#modCount


Copyright © 1996-2009 Geotools. All Rights Reserved.