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

public interface FeatureSet extends DataSet, org.gvsig.tools.util.Size64, org.gvsig.tools.util.Size, org.gvsig.tools.util.IsEmpty, org.gvsig.tools.visitor.IndexedVisitable, Iterable<Feature>
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.
  • Field Summary

    Fields
    Modifier and Type
    Field
    Description
    static final FeatureSet
     
  • Method Summary

    Modifier and Type
    Method
    Description
    void
    accept(org.gvsig.tools.visitor.Visitor visitor, long firstValueIndex)
    Provides each value of this Store to the provided Visitor, beginning from the provided index position.
    void
    accept(org.gvsig.tools.visitor.Visitor visitor, long firstValueIndex, long elements)
     
    void
     
    void
    delete(Feature feature)
    Deletes a Feature from this FeatureSet.
    Any DisposableIterator from this store that was still in use will be unsafe.
    org.gvsig.tools.dispose.DisposableIterator
    Returns a fast iterator over this set.
    org.gvsig.tools.dispose.DisposableIterator
    fastIterator(long index)
    Returns a fast iterator over this set, starting from the given index.
    org.gvsig.tools.dispose.DisposableIterator
    fastIterator(long index, long elemets)
     
    Return the first feature of the set.
    Returns the default FeatureType of this FeatureSet.
    org.gvsig.tools.dynobject.DynObjectSet
    Returns a DynObjectSet of the contents of this set.
    org.gvsig.tools.dynobject.DynObjectSet
    getDynObjectSet(boolean fast)
    Returns a DynObjectSet of the contents of this set.
     
    Returns a list of the FeatureType(s) in this FeatureSet.
    long
    Returns the number of Feature(s) contained in this FeatureSet.
    void
    Inserts a new feature in this set.
     
    iterable(boolean disposeFeatureSet)
     
    org.gvsig.tools.dispose.DisposableIterator
    Returns an iterator over the elements in this collection, in the order (if any) defined when the collection was obtained.
    org.gvsig.tools.dispose.DisposableIterator
    iterator(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.DisposableIterator
    iterator(long index, long elements)
     
    org.gvsig.expressionevaluator.Expression
    makeFilter(int maxfeatures)
     
    javax.json.JsonArray
     
    javax.json.JsonArray
    Deprecated.
    javax.json.JsonArrayBuilder
     
    void
    Updates a Feature with the given EditableFeature.
    Any DisposableIterator from this store that was still in use can will not reflect this change.

    Methods inherited from interface org.gvsig.fmap.dal.DataSet

    accept, isFromStore

    Methods inherited from interface org.gvsig.tools.dispose.Disposable

    dispose

    Methods inherited from interface org.gvsig.tools.util.IsEmpty

    isEmpty

    Methods inherited from interface java.lang.Iterable

    forEach, spliterator

    Methods inherited from interface org.gvsig.tools.util.Size

    size

    Methods inherited from interface org.gvsig.tools.util.Size64

    size64
  • Field Details

    • EMPTY_FEATURESET

      static final FeatureSet EMPTY_FEATURESET
  • Method Details

    • 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

      org.gvsig.tools.dispose.DisposableIterator iterator(long index) throws DataException
      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:
    • iterator

      org.gvsig.tools.dispose.DisposableIterator iterator(long index, long elements) throws DataException
      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.
      Specified by:
      iterator in interface Iterable<Feature>
      Returns:
      an iterator of the elements in this collection (in proper sequence).
      See Also:
    • iterable

    • iterable

      DisposableFeatureSetIterable iterable(boolean disposeFeatureSet)
    • fastIterator

      org.gvsig.tools.dispose.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:
    • fastIterator

      org.gvsig.tools.dispose.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:
    • 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

      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
    • commitChanges

      void commitChanges() throws DataException
      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

      org.gvsig.tools.dynobject.DynObjectSet getDynObjectSet()
      Returns a DynObjectSet of the contents of this set. Defaults to fast iteration.
      Returns:
      a DynObjectSet
    • getDynObjectSet

      org.gvsig.tools.dynobject.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(org.gvsig.tools.visitor.Visitor visitor, long firstValueIndex) throws org.gvsig.tools.exception.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 org.gvsig.tools.visitor.IndexedVisitable
      Parameters:
      visitor - the visitor to apply to each value.
      firstValueIndex - index of first element to be visited by the Visitor
      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 javax.json.JsonArray toJSON()
      Deprecated.
    • toJson

      javax.json.JsonArray toJson()
    • toJsonBuilder

      javax.json.JsonArrayBuilder toJsonBuilder()
    • makeFilter

      org.gvsig.expressionevaluator.Expression makeFilter(int maxfeatures)