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, toArray
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
features, sort, subCollection
accepts, contains, containsAll, getID, getSchema, isEmpty, toArray, toArray
contains, containsAll, equals, hashCode, isEmpty, iterator, parallelStream, removeIf, spliterator, stream, toArray, toArray
public MemoryFeatureCollection(SimpleFeatureType schema)
public boolean add(SimpleFeature o)
add
in interface Collection<SimpleFeature>
public int size()
AbstractFeatureCollection
size
in interface Collection<SimpleFeature>
size
in interface FeatureCollection<SimpleFeatureType,SimpleFeature>
size
in class AbstractFeatureCollection
Collection.size()
public MemoryFeatureCollection.MemoryIterator openIterator()
AbstractFeatureCollection
AbstractFeatureCollection.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 AbstractFeatureCollection
public SimpleFeature getFeatureMember(String id) throws NoSuchElementException
RandomFeatureAccess
getFeatureMember
in interface RandomFeatureAccess
NoSuchElementException
- if a Feature with the indicated id is not presentpublic SimpleFeature removeFeatureMember(String id)
RandomFeatureAccess
removeFeatureMember
in interface RandomFeatureAccess
public ReferencedEnvelope getBounds()
getBounds
in interface FeatureCollection<SimpleFeatureType,SimpleFeature>
getBounds
in class AbstractFeatureCollection
public 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.