Interface FeatureCollection
-
@XmlElement(value="FeatureCollection") public interface FeatureCollection extends java.util.Collection<Feature>, Feature
Represents a collection of features. Implementations and client code should adhere to the rules set forth byCollection. That is, some methods are optional to implement, and may throw anUnsupportedOperationException.- Since:
- GeoAPI 2.0
- See Also:
Collection
-
-
Method Summary
All Methods Instance Methods Abstract Methods Modifier and Type Method and Description booleanaddAlls(java.util.Collection<Feature> c)Adds all of the features contained in the given collection to this collection.voidaddFeatureListener(FeatureListener fl)Adds a listener whose methods will be called whenever a new feature is added or removed from this collection.booleanadds(java.lang.Object o)Adds the given feature to this collection.voidclear()Removes all of the features contained in this collection.voidclose()If some sort of connection was opened to a backing store to support this collection, then closes this connection.booleancontains(java.lang.Object o)Checks if the given feature is a member of this collection.booleancontainsAlls(java.util.Collection<Feature> c)Checks if every feature in the given collection is also a member of this feature collection.LockRequestgetLockRequest()Returns the request indicating the duration for thelockAll(java.util.Collection<org.opengis.feature.Feature>)method.TransactiongetTransaction()Retrieves the current transaction on this feature collection or null if there is no current transaction.booleanisEmpty()Returnstrueif this collection contains noFeatures.java.util.Iterator<Feature>iterator()Returns an iterator that enumerates all of the features in this collection.LockResponselock()Lock this collection of features.LockResponselockAll(java.util.Collection<Feature> c)Lock indicated features.booleanremove(java.lang.Object o)Removes the given feature from this collection.booleanremoveAlls(java.util.Collection<Feature> c)Removes the given features from this collection.voidremoveFeatureListener(FeatureListener fl)Removes a listener that was previously added withaddFeatureListener(org.opengis.feature.FeatureListener).booleanretainAlls(java.util.Collection<Feature> c)Removes any features from this collection that are not present in the given collection.voidsetLockRequest(LockRequest lock)Indicates the duration, and any additional information for any subsequent lock operations.voidsetTransaction(Transaction t)Begins a new transaction on this collection.intsize()Returns the size of the collection, if known.FeatureCollectionsubCollection(Filter filter)Returns a collection whose contents are the subset of features in this collection that pass the given filter.java.lang.Object[]toArray()Creates aFeaturearray and populates it.java.lang.Object[]toArray(java.lang.Object[] buffer)Populates the given array with the features in this collection.-
Methods inherited from interface java.util.Collection
add, addAll, containsAll, equals, hashCode, parallelStream, removeAll, removeIf, retainAll, spliterator, stream
-
Methods inherited from interface org.opengis.feature.Feature
getAttribute, getAttribute, getBounds, getFeatureType, getID, getParent, setAttribute, setAttribute
-
-
-
-
Method Detail
-
iterator
java.util.Iterator<Feature> iterator() throws BackingStoreException
Returns an iterator that enumerates all of the features in this collection. The object returned from this method is always of typeFeatureIterator.- Specified by:
iteratorin interfacejava.util.Collection<Feature>- Specified by:
iteratorin interfacejava.lang.Iterable<Feature>- Throws:
BackingStoreException- If an error occurs while fetching the features.
-
toArray
java.lang.Object[] toArray() throws BackingStoreException, java.lang.OutOfMemoryErrorCreates aFeaturearray and populates it.- Specified by:
toArrayin interfacejava.util.Collection<Feature>- Throws:
BackingStoreException- If an error occurs while fetching the features.java.lang.OutOfMemoryError- if the feature collection is too large to fit into memory.
-
toArray
java.lang.Object[] toArray(java.lang.Object[] buffer) throws BackingStoreException, java.lang.OutOfMemoryErrorPopulates the given array with the features in this collection. If the passed array is null or is not sufficiently large to contain all of the features in this collection, a new Feature array will be created and returned.- Specified by:
toArrayin interfacejava.util.Collection<Feature>- Throws:
BackingStoreException- If an error occurs while fetching the features.java.lang.OutOfMemoryError- if the feature collection is too large to fit into memory.
-
isEmpty
boolean isEmpty() throws BackingStoreExceptionReturnstrueif this collection contains noFeatures.- Specified by:
isEmptyin interfacejava.util.Collection<Feature>- Throws:
BackingStoreException- If an error occurs while checking for features.
-
size
@XmlElement(value="numberOfFeatures") int size() throws BackingStoreException
Returns the size of the collection, if known. It may return -1 if the size is not known or would be too costly to compute (such as when the features are streaming from a remote source).- Specified by:
sizein interfacejava.util.Collection<Feature>- Throws:
BackingStoreException- If an error occurs while checking for features.
-
contains
boolean contains(java.lang.Object o) throws BackingStoreExceptionChecks if the given feature is a member of this collection.- Specified by:
containsin interfacejava.util.Collection<Feature>- Throws:
BackingStoreException- If an error occurs while searching the feature.
-
containsAlls
boolean containsAlls(java.util.Collection<Feature> c) throws BackingStoreException
Checks if every feature in the given collection is also a member of this feature collection.- Throws:
BackingStoreException- If an error occurs while searching the features.
-
adds
boolean adds(java.lang.Object o) throws java.lang.UnsupportedOperationException, BackingStoreExceptionAdds the given feature to this collection. If this collection is backed by a persistent store of some kind, then the given feature should immediately be written to that persistent store. If you want to add multiple features to this collection, note that it may be considerably more efficient to call theCollection.addAll(java.util.Collection<? extends E>)method. The addition of features takes place within the context of the current transaction on this feature collection.- Throws:
java.lang.UnsupportedOperationException- if the addition of new features is not supported.BackingStoreException- If an error occurs while adding the feature.
-
addAlls
boolean addAlls(java.util.Collection<Feature> c) throws java.lang.UnsupportedOperationException, BackingStoreException
Adds all of the features contained in the given collection to this collection. If this collection is backed by a persistent store of some kind, then the added features should immediately be written to that persistent store. The addition of features takes place within the context of the current transaction on this feature collection.- Throws:
java.lang.UnsupportedOperationException- if the addition of new features is not supported.BackingStoreException- If an error occurs while adding the features.
-
clear
void clear() throws java.lang.UnsupportedOperationException, BackingStoreExceptionRemoves all of the features contained in this collection. If this collection is backed by a persistent store of some kind, then this method should cause all of the features from this collection to be removed from that persistent store. This operation takes place within the context of the current transaction on this feature collection.- Specified by:
clearin interfacejava.util.Collection<Feature>- Throws:
java.lang.UnsupportedOperationException- if the removal of features is not supported.BackingStoreException- If an error occurs while removing the features.
-
remove
boolean remove(java.lang.Object o) throws java.lang.UnsupportedOperationException, BackingStoreExceptionRemoves the given feature from this collection. If this collection is backed by a persistent store of some kind, then this method should cause the given feature to be removed from the persistent store. This operation takes place within the context of the current transaction on this feature collection.- Specified by:
removein interfacejava.util.Collection<Feature>- Throws:
java.lang.UnsupportedOperationException- if the removal of features is not supported.BackingStoreException- If an error occurs while removing the feature.
-
removeAlls
boolean removeAlls(java.util.Collection<Feature> c) throws java.lang.UnsupportedOperationException, BackingStoreException
Removes the given features from this collection. If this collection is backed by a persistent store of some kind, then this method should cause all of the given features to be removed from the persistent store. This operation takes place within the context of the current transaction on this feature collection.- Throws:
java.lang.UnsupportedOperationException- if the removal of features is not supported.BackingStoreException- If an error occurs while removing the features.
-
retainAlls
boolean retainAlls(java.util.Collection<Feature> c) throws java.lang.UnsupportedOperationException, BackingStoreException
Removes any features from this collection that are not present in the given collection. If this collection is backed by a persistent store of some kind, then this method should cause the removed features to be removed from the persistent store as well. This operation takes place within the context of the current transaction on this feature collection.- Throws:
java.lang.UnsupportedOperationException- if the removal of features is not supported.BackingStoreException- If an error occurs while removing the features.
-
subCollection
FeatureCollection subCollection(Filter filter) throws BackingStoreException
Returns a collection whose contents are the subset of features in this collection that pass the given filter. This is semantically equivalent to going back to theFeatureStorethat created this collection and AND-ing the filter that produced this collection with the given filter.Compare this method to
List.subList(int,int)from the Java Collections framework.- Throws:
BackingStoreException- If an error occurs while fetching the features.
-
close
void close() throws java.io.IOExceptionIf some sort of connection was opened to a backing store to support this collection, then closes this connection. Users of this API should always call this method before releasing the references to this object so that resources get cleaned up in a timely fashion. Those who implement this interface are also encouraged to implement thefinalize()method just in case the user forgets to call close so that perhaps things might get cleaned up.After invoking this method, all references to the feature listener objects will be cleared and no further events will be fired.
- Throws:
java.io.IOException
-
setTransaction
void setTransaction(Transaction t)
Begins a new transaction on this collection. Any calls that may modify this collection or any features within it are done within the context of the given transaction.Implementors of this method should attach some state to the given transaction by calling
Transaction.putState(java.lang.Object, org.opengis.feature.Transaction.State), passing in a key that identifies this type of collection and a value that is a data store-specific implementation of theTransaction.Stateinterface. When the transaction is complete, eithercommit()orrollback()will be called on the state object that was attached.
-
getTransaction
Transaction getTransaction()
Retrieves the current transaction on this feature collection or null if there is no current transaction.
-
setLockRequest
void setLockRequest(LockRequest lock)
Indicates the duration, and any additional information for any subsequent lock operations.Implementations may provide some
TRANSACTION_LOCKconstant to request that the lock only endure for the duration of the current transaction.
-
lockAll
LockResponse lockAll(java.util.Collection<Feature> c)
Lock indicated features. To unlock, or operate on these features, one needs to perform a transaction with the authorization token provided byLockResponse.Workflows:
LockRequest+AUTO_COMMITreturns aLockResponseindicating the success of the operation and authorization tokens aquired.TRANSACTION_LOCK+TransactionreturnsTRANSACTION_LOCKRESPONSEindicating a short term lock is held that will expire at the next commit or rollback. Use this workflow to reserve content before starting edits.LockRequest+TransactionreturnsPENDING. Check the result of commit to discover the success of any lock methods made during the transaction.
- Returns:
- Lock response for
AUTO_COMMIT,TRANSACTION_LOCKfor a short term lock, orPENDINGwhen used in a transaction.
-
lock
LockResponse lock()
Lock this collection of features. To unlock, or operate on these features, one needs to perform a transaction with the authorization token provided byLockResponse.Workflows:
LockRequest+AUTO_COMMITreturns aLockResponseindicating the success of the operation and authorization tokens aquired.TRANSACTION_LOCK+TransactionreturnsTRANSACTION_LOCKRESPONSEindicating a short term lock is held that will expire at the next commit or rollback. Use this workflow to reserve content before starting edits.LockRequest+TransactionreturnsPENDING. Check the result of commit to discover the success of any lock methods made during the transaction.
- Returns:
- Lock response for
AUTO_COMMIT,TRANSACTION_LOCKfor a short term lock, orPENDINGwhen used in a transaction.
-
getLockRequest
LockRequest getLockRequest()
Returns the request indicating the duration for thelockAll(java.util.Collection<org.opengis.feature.Feature>)method.
-
addFeatureListener
void addFeatureListener(FeatureListener fl)
Adds a listener whose methods will be called whenever a new feature is added or removed from this collection. SinceFeatureCollectionobjects may be the result of a query, the methods of theFeatureListenermay be invoked when a feature's attributes have been updated in such a way that its values now pass the filter (or no longer pass the filter).
-
removeFeatureListener
void removeFeatureListener(FeatureListener fl)
Removes a listener that was previously added withaddFeatureListener(org.opengis.feature.FeatureListener).
-
-
DataMelt 3.0 © DataMelt by jWork.ORG