public interface FeatureSet extends DataSet, IndexedVisitable
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.Modifier and Type | Method and Description |
---|---|
void |
accept(Visitor visitor,
long firstValueIndex)
Provides each value of this Store to the provided
Visitor ,
beginning from the provided index position. |
void |
accept(Visitor visitor,
long firstValueIndex,
long elements) |
void |
delete(Feature feature)
Deletes a
Feature from this FeatureSet. |
DisposableIterator |
fastIterator()
Returns a fast iterator over this set.
|
DisposableIterator |
fastIterator(long index)
Returns a fast iterator over this set, starting from the given index.
|
DisposableIterator |
fastIterator(long index,
long elemets) |
Feature |
first()
Return the first feature of the set.
|
FeatureType |
getDefaultFeatureType()
Returns the default
FeatureType of this FeatureSet. |
DynObjectSet |
getDynObjectSet()
Returns a
DynObjectSet of the contents of this set. |
DynObjectSet |
getDynObjectSet(boolean fast)
Returns a
DynObjectSet of the contents of this set. |
List |
getFeatureTypes()
Returns a list of the
FeatureType (s) in this FeatureSet. |
long |
getSize()
Returns the number of
Feature (s) contained in this FeatureSet. |
void |
insert(EditableFeature feature)
Inserts a new feature in this set.
|
boolean |
isEmpty()
Indicates whether this FeatureSet contains zero features.
|
DisposableIterator |
iterator()
Deprecated.
use fastiterator. In next versions the signature of this
method will be changed to "Iterator<Feature> iterator()".
|
DisposableIterator |
iterator(long index)
Deprecated.
use
fastIterator(long) instead |
DisposableIterator |
iterator(long index,
long elements) |
void |
update(EditableFeature feature)
Updates a
Feature with the given EditableFeature . |
accept, isFromStore
dispose
FeatureType getDefaultFeatureType()
FeatureType
of this FeatureSet.FeatureType
in this FeatureSet.List getFeatureTypes()
FeatureType
(s) in this FeatureSet.FeatureType
(s) in this FeatureSet.long getSize() throws DataException
Feature
(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.Feature
(s) contained in this FeatureSet.DataException
DisposableIterator iterator(long index) throws DataException
fastIterator(long)
instead
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 the accept
methods instead, which handle everything for you.
Take into account the accept methods may use a fast iterator to
get the features.
index
- index of first element to be returned from the iterator (by a
call to the next method).DataException
- if the index is out of range (index < 0 || index >
size()).DataSet.accept(org.gvsig.tools.visitor.Visitor)
,
accept(org.gvsig.tools.visitor.Visitor, long)
,
fastIterator()
,
fastIterator(long)
DisposableIterator iterator(long index, long elements) throws DataException
DataException
DisposableIterator iterator()
DataSet.accept(org.gvsig.tools.visitor.Visitor)
,
accept(org.gvsig.tools.visitor.Visitor, long)
,
fastIterator()
,
fastIterator(long)
DisposableIterator fastIterator() throws DataException
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 Feature
of the iterator, use the
Feature.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 the accept
methods instead, which handle everything for you.
Take into account the accept methods may use a fast iterator to
get the features.
DataException
DataSet.accept(org.gvsig.tools.visitor.Visitor)
,
accept(org.gvsig.tools.visitor.Visitor, long)
DisposableIterator fastIterator(long index) throws DataException
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 Feature
of the iterator, use the
Feature.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 the accept
methods instead, which handle everything for you.
Take into account the accept methods may use a fast iterator to
get the features.
index
- position in which the iterator is initially located.DataException
DataSet.accept(org.gvsig.tools.visitor.Visitor)
,
accept(org.gvsig.tools.visitor.Visitor, long)
DisposableIterator fastIterator(long index, long elemets) throws DataException
DataException
boolean isEmpty() throws DataException
DataException
Feature first()
void update(EditableFeature feature) throws DataException
Feature
with the given EditableFeature
.DisposableIterator
from this store that was still in use can will not
reflect this change.feature
- an instance of EditableFeature
with which to update
the associated Feature
.DataException
void delete(Feature feature) throws DataException
Feature
from this FeatureSet.DisposableIterator
from this store that was still in use will be
unsafe. Use Iterator.remove()
instead.feature
- the Feature
to delete.DataException
void insert(EditableFeature feature) throws DataException
EditableFeature
as it has not been stored yet.DisposableIterator
from this store that was still in use can will not
reflect this change.feature
- the EditableFeature
to insert.DataException
DynObjectSet getDynObjectSet()
DynObjectSet
of the contents of this set.
Defaults to fast iteration.DynObjectSet
DynObjectSet getDynObjectSet(boolean fast)
DynObjectSet
of the contents of this set.fast
- if the set will be able to be iterated in a fast way, by
reusing the DynObject
instance for each
Feature
instance.DynObjectSet
void accept(Visitor visitor, long firstValueIndex) throws BaseException
Visitor
,
beginning from the provided index position.
The values received through the Visitor.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 the
Visitor.visit(Object)
method execution, create a copy or clone
the received value in order to be stored.accept
in interface IndexedVisitable
visitor
- the visitor to apply to each value.firstValueIndex
- index of first element to be visited by the Visitor
BaseException
- if there is an error while performing the visitvoid accept(Visitor visitor, long firstValueIndex, long elements) throws BaseException
BaseException