|
||||||||||
| PREV CLASS NEXT CLASS | FRAMES NO FRAMES | |||||||||
| SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD | |||||||||
ObjectAbstractFeatureCollection
ListFeatureCollection
public class ListFeatureCollection
FeatureCollection implementation wrapping around a java.util.List.
This implementation wraps around a java.util.List and is suitable for quickly getting something on screen.
Usage notes:
This implementation is intended to quickly wrap up a list of features and get them on screen; as such it respects various hints about the copying of internal content as provided by the renderer.
Hints#FEATURE_DETACHED| Field Summary |
|---|
| Fields inherited from class AbstractFeatureCollection |
|---|
id, schema |
| Constructor Summary | |
|---|---|
ListFeatureCollection(SimpleFeatureCollection copy)
Create a ListFeatureCollection around the provided list. |
|
ListFeatureCollection(SimpleFeatureType schema)
Create a ListFeatureCollection for the provided schema An ArrayList is used internally. |
|
ListFeatureCollection(SimpleFeatureType schema,
List<SimpleFeature> list)
Create a ListFeatureCollection around the provided list. |
|
| Method Summary | |
|---|---|
boolean |
add(SimpleFeature f)
|
boolean |
addAll(Collection<? extends SimpleFeature> c)
|
void |
clear()
|
SimpleFeatureIterator |
features()
Obtain a SimpleFeatureIterator of the Features within this SimpleFeatureCollection. |
ReferencedEnvelope |
getBounds()
Subclasses need to override this. |
boolean |
isEmpty()
Returns true if this feature collection contains no features. |
protected Iterator<SimpleFeature> |
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)
|
boolean |
retainAll(Collection<?> c)
|
int |
size()
Returns the number of elements in this collection. |
SimpleFeatureCollection |
sort(SortBy order)
Obtained sorted contents. |
SimpleFeatureCollection |
subCollection(Filter filter)
SimpleFeatureCollection "view" indicated by provided filter. |
| Methods inherited from class AbstractFeatureCollection |
|---|
accepts, contains, containsAll, getID, getSchema, iterator, toArray, toArray |
| Methods inherited from class Object |
|---|
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait |
| Methods inherited from interface Collection |
|---|
contains, containsAll, equals, hashCode, iterator, toArray, toArray |
| Constructor Detail |
|---|
public ListFeatureCollection(SimpleFeatureType schema)
schema -
public ListFeatureCollection(SimpleFeatureType schema,
List<SimpleFeature> list)
The provided list is directly used for storage, most feature collection operations just use a simple iterator so there is no performance advantaged to be gained over using an ArrayList vs a LinkedList (other then for the size() method of course).
schema - list -
public ListFeatureCollection(SimpleFeatureCollection copy)
throws IOException
The provided list is directly used for storage, most feature collection operations just use a simple iterator so there is no performance advantaged to be gained over using an ArrayList vs a LinkedList (other then for the size() method of course).
schema - list -
IOException| Method Detail |
|---|
public int size()
AbstractFeatureCollection
size in interface Collection<SimpleFeature>size in interface FeatureCollection<SimpleFeatureType,SimpleFeature>size in class AbstractFeatureCollectionCollection.size()protected Iterator<SimpleFeature> 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 boolean add(SimpleFeature f)
add in interface Collection<SimpleFeature>public void clear()
clear in interface Collection<SimpleFeature>public SimpleFeatureIterator features()
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();
}
features in interface SimpleFeatureCollectionfeatures in interface FeatureCollection<SimpleFeatureType,SimpleFeature>features in class AbstractFeatureCollectionpublic ReferencedEnvelope getBounds()
AbstractFeatureCollection
getBounds in interface FeatureCollection<SimpleFeatureType,SimpleFeature>getBounds in class AbstractFeatureCollectionpublic boolean isEmpty()
FeatureCollection
isEmpty in interface Collection<SimpleFeature>isEmpty in interface FeatureCollection<SimpleFeatureType,SimpleFeature>isEmpty in class AbstractFeatureCollectionpublic SimpleFeatureCollection subCollection(Filter filter)
FeatureCollectionThe contents of the returned SimpleFeatureCollection are determined by applying the provider Filter to the entire contents of this FeatureCollection. The result is "live" and modifications will be shared.
This method is used cut down on the number of filter based methods required for a useful SimpleFeatureCollection construct. The FeatureCollections returned really should be considered as a temporary "view" used to control the range of a removeAll, or modify operation.
Example Use:
collection.subCollection( filter ).clear();
The above recommended use is agreement with the Collections API precident of
List.subList( start, end ).
The results of subCollection:
subCollection in interface SimpleFeatureCollectionsubCollection in interface FeatureCollection<SimpleFeatureType,SimpleFeature>subCollection in class AbstractFeatureCollectionFeatureListpublic SimpleFeatureCollection sort(SortBy order)
FeatureCollectionThis method may not be supported by all implementations, consider the use of FeatureSource.features( Query ).
sort in interface SimpleFeatureCollectionsort in interface FeatureCollection<SimpleFeatureType,SimpleFeature>sort in class AbstractFeatureCollectionorder - Sort order
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>
|
||||||||||
| PREV CLASS NEXT CLASS | FRAMES NO FRAMES | |||||||||
| SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD | |||||||||