public class MemoryFeatureCollection extends AbstractFeatureCollection implements RandomFeatureAccess, Collection<SimpleFeature>
Contents are maintained in a sorted TreeMap by FID, this serves as a reference implementation when exploring the SimpleFeatureCollection api.
This is similar to DefaultFeatureCollection, although additional methods are supported and test cases have been written. Unlike DefaultFeatureCollection the type information must be known at construction time.
id, schema| Constructor and Description |
|---|
MemoryFeatureCollection(SimpleFeatureType schema) |
| Modifier and Type | Method and Description |
|---|---|
boolean |
add(SimpleFeature o) |
boolean |
addAll(Collection<? extends SimpleFeature> c) |
void |
clear() |
ReferencedEnvelope |
getBounds()
Calculates the bounds of the features without caching.
|
SimpleFeature |
getFeatureMember(String id)
Access Feature content by feature id.
|
MemoryFeatureCollection.MemoryIterator |
openIterator()
Factory method used to open an iterator over collection contents for use by
AbstractFeatureCollection.iterator() and AbstractFeatureCollection.features(). |
boolean |
remove(Object o) |
boolean |
removeAll(Collection<?> c) |
SimpleFeature |
removeFeatureMember(String id)
Optional Method
|
boolean |
retainAll(Collection<?> c) |
int |
size()
Returns the number of elements in this collection.
|
accepts, contains, containsAll, features, getID, getSchema, isEmpty, iterator, sort, subCollection, toArray, toArrayclone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, waitfeatures, sort, subCollectionaccepts, contains, containsAll, getID, getSchema, isEmpty, toArray, toArraycontains, containsAll, equals, hashCode, isEmpty, iterator, parallelStream, removeIf, spliterator, stream, toArray, toArraypublic MemoryFeatureCollection(SimpleFeatureType schema)
public boolean add(SimpleFeature o)
add in interface Collection<SimpleFeature>public int size()
AbstractFeatureCollectionsize in interface Collection<SimpleFeature>size in interface FeatureCollection<SimpleFeatureType,SimpleFeature>size in class AbstractFeatureCollectionCollection.size()public MemoryFeatureCollection.MemoryIterator openIterator()
AbstractFeatureCollectionAbstractFeatureCollection.iterator() and AbstractFeatureCollection.features().
If you return an instance of FeatureIterator some effort is taken to call the FeatureIterator.close() internally, however we cannot offer any assurance that client code
using AbstractFeatureCollection.iterator() will perform the same check.
openIterator in class AbstractFeatureCollectionpublic SimpleFeature getFeatureMember(String id) throws NoSuchElementException
RandomFeatureAccessgetFeatureMember in interface RandomFeatureAccessNoSuchElementException - if a Feature with the indicated id is not presentpublic SimpleFeature removeFeatureMember(String id)
RandomFeatureAccessremoveFeatureMember in interface RandomFeatureAccesspublic ReferencedEnvelope getBounds()
getBounds in interface FeatureCollection<SimpleFeatureType,SimpleFeature>getBounds in class AbstractFeatureCollectionpublic boolean remove(Object o)
remove in interface Collection<SimpleFeature>public boolean addAll(Collection<? extends SimpleFeature> c)
addAll in interface Collection<SimpleFeature>public boolean removeAll(Collection<?> c)
removeAll in interface Collection<SimpleFeature>public boolean retainAll(Collection<?> c)
retainAll in interface Collection<SimpleFeature>public void clear()
clear in interface Collection<SimpleFeature>Copyright © 1996–2019 Geotools. All rights reserved.