org.gvsig.fmap.dal.feature
Interface FeatureSet

All Superinterfaces:
DataSet, Disposable, IndexedVisitable, Visitable
All Known Subinterfaces:
FeatureSelection

public interface FeatureSet
extends DataSet, IndexedVisitable

A FeatureSet represents a set of 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.


Method Summary
 void accept(Visitor visitor, long firstValueIndex)
          Provides each value of this Store to the provided Visitor, beginning from the provided index position.
 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.
 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() instead
 DisposableIterator iterator(long index)
          Deprecated. use fastIterator(long) instead
 void update(EditableFeature feature)
          Updates a Feature with the given EditableFeature.
 
Methods inherited from interface org.gvsig.fmap.dal.DataSet
accept, isFromStore
 
Methods inherited from interface org.gvsig.tools.dispose.Disposable
dispose
 

Method Detail

getDefaultFeatureType

FeatureType getDefaultFeatureType()
Returns the default FeatureType of this FeatureSet.

Returns:
default FeatureType in this FeatureSet.

getFeatureTypes

List getFeatureTypes()
Returns a list of the FeatureType(s) in this FeatureSet.

Returns:
list of the FeatureType(s) in this FeatureSet.

getSize

long getSize()
             throws DataException
Returns the number of 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.

Returns:
number of Feature(s) contained in this FeatureSet.
Throws:
DataException

iterator

DisposableIterator iterator(long index)
                            throws DataException
Deprecated. use fastIterator(long) instead

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 the accept methods 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:
DataSet.accept(org.gvsig.tools.visitor.Visitor), accept(org.gvsig.tools.visitor.Visitor, long), fastIterator(), fastIterator(long)

iterator

DisposableIterator iterator()
                            throws DataException
Deprecated. use fastIterator() instead

Returns an iterator over the elements in this collection, in the order (if any) defined when the collection was obtained.

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.

Returns:
an iterator of the elements in this collection (in proper sequence).
Throws:
DataException - if there is an error getting the iterator
See Also:
DataSet.accept(org.gvsig.tools.visitor.Visitor), accept(org.gvsig.tools.visitor.Visitor, long), fastIterator(), fastIterator(long)

fastIterator

DisposableIterator fastIterator()
                                throws DataException
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 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.

Returns:
an iterator over this set.
Throws:
DataException
See Also:
DataSet.accept(org.gvsig.tools.visitor.Visitor), accept(org.gvsig.tools.visitor.Visitor, long)

fastIterator

DisposableIterator fastIterator(long index)
                                throws DataException
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 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.

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:
DataSet.accept(org.gvsig.tools.visitor.Visitor), accept(org.gvsig.tools.visitor.Visitor, long)

isEmpty

boolean isEmpty()
                throws DataException
Indicates whether this FeatureSet contains zero features. 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:
true if this FeatureSet is empty, false otherwise.
Throws:
DataException

update

void update(EditableFeature feature)
            throws DataException
Updates a Feature with the given EditableFeature.
Any DisposableIterator from this store that was still in use can will not reflect this change.

Parameters:
feature - an instance of EditableFeature with which to update the associated Feature.
Throws:
DataException

delete

void delete(Feature feature)
            throws DataException
Deletes a Feature from this FeatureSet.
Any DisposableIterator from this store that was still in use will be unsafe. Use Iterator.remove() instead.

Parameters:
feature - the Feature to delete.
Throws:
DataException

insert

void insert(EditableFeature feature)
            throws DataException
Inserts a new feature in this set. It needs to be an instance of EditableFeature as it has not been stored yet.
Any DisposableIterator from this store that was still in use can will not reflect this change.

Parameters:
feature - the EditableFeature to insert.
Throws:
DataException

getDynObjectSet

DynObjectSet getDynObjectSet()
Returns a DynObjectSet of the contents of this set. Defaults to fast iteration.

Returns:
a DynObjectSet

getDynObjectSet

DynObjectSet getDynObjectSet(boolean fast)
Returns a DynObjectSet of the contents of this set.

Parameters:
fast - if the set will be able to be iterated in a fast way, by reusing the DynObject instance for each Feature instance.
Returns:
a DynObjectSet

accept

void accept(Visitor visitor,
            long firstValueIndex)
            throws BaseException
Provides each value of this Store to the provided 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.

Specified by:
accept in interface IndexedVisitable
Parameters:
visitor - the visitor to apply to each value.
firstValueIndex - index of first element to be visited by the Visitor
Throws:
BaseException - if there is an error while performing the visit


Copyright © 2004-2012 gvSIG. All Rights Reserved.