Interface FeatureSet
- All Superinterfaces:
DataSet,org.gvsig.tools.dispose.Disposable,org.gvsig.tools.visitor.IndexedVisitable,org.gvsig.tools.util.IsEmpty,Iterable<Feature>,org.gvsig.tools.util.Size,org.gvsig.tools.util.Size64,org.gvsig.tools.visitor.Visitable
- All Known Subinterfaces:
FeatureSelection
Feature(s). These sets of features
are typically obtained directly from a FeatureStore, or through a
FeatureQuery.
A FeatureSet may contain subsets of Feature(s) of different
FeatureType(s). It allows iterating and editing the features.
FIXME: Actualizar javadoc
Si el store en el que esta basado el featureset es modificado, se realiza un
update, insert, delete o se modifican los featuretype de este, el FeatureSet
quedara invalidado, y cualquier acceso a el provocara que se lance una
excepcion de tiempo de ejecucion ConcurrentModificationException.
Habria que indicar que invocar al metodo accept del interface visitor
provocara la excepcion ConcurrentModificationException si el store a sido
modificado desde otro punto.
Indicar que los metodos insert/delete/update ademas de actuar sobre el set,
actuan sobre el store en el que este esta basado, pero que no invalidan el
set sobre el que se ejecutan. No se si esto deberia hacerse mencion en esos
metodos o en la doc general del featureset.-
Field Summary
Fields -
Method Summary
Modifier and TypeMethodDescriptionvoidaccept(org.gvsig.tools.visitor.Visitor visitor, long firstValueIndex) Provides each value of this Store to the providedVisitor, beginning from the provided index position.voidaccept(org.gvsig.tools.visitor.Visitor visitor, long firstValueIndex, long elements) voidvoidDeletes aFeaturefrom this FeatureSet.
AnyDisposableIteratorfrom this store that was still in use will be unsafe.org.gvsig.tools.dispose.DisposableIteratorReturns a fast iterator over this set.org.gvsig.tools.dispose.DisposableIteratorfastIterator(long index) Returns a fast iterator over this set, starting from the given index.org.gvsig.tools.dispose.DisposableIteratorfastIterator(long index, long elemets) first()Return the first feature of the set.Returns the defaultFeatureTypeof this FeatureSet.org.gvsig.tools.dynobject.DynObjectSetReturns aDynObjectSetof the contents of this set.org.gvsig.tools.dynobject.DynObjectSetgetDynObjectSet(boolean fast) Returns aDynObjectSetof the contents of this set.Returns a list of theFeatureType(s) in this FeatureSet.longgetSize()Returns the number ofFeature(s) contained in this FeatureSet.voidinsert(EditableFeature feature) Inserts a new feature in this set.iterable()iterable(boolean disposeFeatureSet) org.gvsig.tools.dispose.DisposableIteratoriterator()Returns an iterator over the elements in this collection, in the order (if any) defined when the collection was obtained.org.gvsig.tools.dispose.DisposableIteratoriterator(long index) Returns an iterator over the elements in this collection, in the order (if any) defined when the collection was obtained.org.gvsig.tools.dispose.DisposableIteratoriterator(long index, long elements) org.gvsig.expressionevaluator.ExpressionmakeFilter(int maxfeatures) javax.json.JsonArraytoJson()javax.json.JsonArraytoJSON()Deprecated.javax.json.JsonArrayBuildervoidupdate(EditableFeature feature) Updates aFeaturewith the givenEditableFeature.
AnyDisposableIteratorfrom this store that was still in use can will not reflect this change.Methods inherited from interface org.gvsig.fmap.dal.DataSet
accept, isFromStoreMethods inherited from interface org.gvsig.tools.dispose.Disposable
disposeMethods inherited from interface org.gvsig.tools.util.IsEmpty
isEmptyMethods inherited from interface java.lang.Iterable
forEach, spliteratorMethods inherited from interface org.gvsig.tools.util.Size
sizeMethods inherited from interface org.gvsig.tools.util.Size64
size64
-
Field Details
-
EMPTY_FEATURESET
-
-
Method Details
-
getDefaultFeatureType
FeatureType getDefaultFeatureType()Returns the defaultFeatureTypeof this FeatureSet.- Returns:
- default
FeatureTypein this FeatureSet.
-
getFeatureTypes
List getFeatureTypes()Returns a list of theFeatureType(s) in this FeatureSet.- Returns:
- list of the
FeatureType(s) in this FeatureSet.
-
getSize
Returns the number ofFeature(s) contained in this FeatureSet. The value returned by this method won't be accurate when the FeatureStore is being edited and this set's features are modified, added or deleted.- Returns:
- number of
Feature(s) contained in this FeatureSet. - Throws:
DataException
-
iterator
Returns an iterator over the elements in this collection, in the order (if any) defined when the collection was obtained. The iterator starts at the specified position in this collection. The specified index indicates the first element that would be returned by an initial call to the next method. An initial call to the previous method would return the element with the specified index minus one.NOTE: if you use this method to get the iterator, you must get sure the iterator is disposed (@see
Disposable.dispose()) in any case, even if an error occurs while getting the data. It is recommended to use theacceptmethods instead, which handle everything for you. Take into account the accept methods may use a fast iterator to get the features.- Parameters:
index- index of first element to be returned from the iterator (by a call to the next method).- Returns:
- an iterator of the elements in this collection (in proper sequence), starting at the specified position in the collection.
- Throws:
DataException- if the index is out of range (index < 0 || index > size()).- See Also:
-
iterator
- Throws:
DataException
-
iterator
org.gvsig.tools.dispose.DisposableIterator iterator()Returns an iterator over the elements in this collection, in the order (if any) defined when the collection was obtained. -
iterable
DisposableFeatureSetIterable iterable() -
iterable
-
fastIterator
Returns a fast iterator over this set.Fast in this case means that each of the elements returned may be a reused or pooled object instance, so don't use it to be stored in any way.
If you need to store one of the
Featureof the iterator, use theFeature.getCopy()to create a clone of the object.NOTE: if you use this method to get the iterator, you must get sure the iterator is disposed (@see
Disposable.dispose()) in any case, even if an error occurs while getting the data. It is recommended to use theacceptmethods instead, which handle everything for you. Take into account the accept methods may use a fast iterator to get the features.- Returns:
- an iterator over this set.
- Throws:
DataException- See Also:
-
fastIterator
Returns a fast iterator over this set, starting from the given index.Fast in this case means that each of the elements returned may be a reused or pooled object instance, so don't use it to be stored in any way.
If you need to store one of the
Featureof the iterator, use theFeature.getCopy()to create a clone of the object.NOTE: if you use this method to get the iterator, you must get sure the iterator is disposed (@see
Disposable.dispose()) in any case, even if an error occurs while getting the data. It is recommended to use theacceptmethods instead, which handle everything for you. Take into account the accept methods may use a fast iterator to get the features.- Parameters:
index- position in which the iterator is initially located.- Returns:
- an iterator initially located at the position indicated by the given index
- Throws:
DataException- See Also:
-
fastIterator
org.gvsig.tools.dispose.DisposableIterator fastIterator(long index, long elemets) throws DataException - Throws:
DataException
-
first
Feature first()Return the first feature of the set. If the set is empty return null. This not is a good method to determine if the set is empty. Use isEmpty instead. This is a utility method that call iterator and retrieve the first feature of the iterator.- Returns:
- the first fearure of the set or null.
-
update
Updates aFeaturewith the givenEditableFeature.
AnyDisposableIteratorfrom this store that was still in use can will not reflect this change.- Parameters:
feature- an instance ofEditableFeaturewith which to update the associatedFeature.- Throws:
DataException
-
commitChanges
- Throws:
DataException
-
delete
Deletes aFeaturefrom this FeatureSet.
AnyDisposableIteratorfrom this store that was still in use will be unsafe. UseIterator.remove()instead.- Parameters:
feature- theFeatureto delete.- Throws:
DataException
-
insert
Inserts a new feature in this set. It needs to be an instance ofEditableFeatureas it has not been stored yet.
AnyDisposableIteratorfrom this store that was still in use can will not reflect this change.- Parameters:
feature- theEditableFeatureto insert.- Throws:
DataException
-
getDynObjectSet
org.gvsig.tools.dynobject.DynObjectSet getDynObjectSet()Returns aDynObjectSetof the contents of this set. Defaults to fast iteration.- Returns:
- a
DynObjectSet
-
getDynObjectSet
org.gvsig.tools.dynobject.DynObjectSet getDynObjectSet(boolean fast) Returns aDynObjectSetof the contents of this set.- Parameters:
fast- if the set will be able to be iterated in a fast way, by reusing theDynObjectinstance for eachFeatureinstance.- Returns:
- a
DynObjectSet
-
accept
void accept(org.gvsig.tools.visitor.Visitor visitor, long firstValueIndex) throws org.gvsig.tools.exception.BaseException Provides each value of this Store to the providedVisitor, beginning from the provided index position. The values received through theVisitor.visit(Object)method may be transient, reused or externally modifiable, so they can't be used to be stored in any external form out of the visit method. If you need to store any of the values out of theVisitor.visit(Object)method execution, create a copy or clone the received value in order to be stored.- Specified by:
acceptin interfaceorg.gvsig.tools.visitor.IndexedVisitable- Parameters:
visitor- the visitor to apply to each value.firstValueIndex- index of first element to be visited by theVisitor- Throws:
org.gvsig.tools.exception.BaseException- if there is an error while performing the visit
-
accept
void accept(org.gvsig.tools.visitor.Visitor visitor, long firstValueIndex, long elements) throws org.gvsig.tools.exception.BaseException - Throws:
org.gvsig.tools.exception.BaseException
-
getFeatureStore
FeatureStore getFeatureStore() -
toJSON
Deprecated. -
toJson
javax.json.JsonArray toJson() -
toJsonBuilder
javax.json.JsonArrayBuilder toJsonBuilder() -
makeFilter
org.gvsig.expressionevaluator.Expression makeFilter(int maxfeatures)
-