public class IndexFeatureSet extends Object implements FeatureSet, FeatureSetProvider, Iterable<Feature>
Modifier and Type | Class and Description |
---|---|
class |
IndexFeatureSet.FastIndexIterator |
class |
IndexFeatureSet.IndexIterator |
Constructor and Description |
---|
IndexFeatureSet(FeatureIndexProviderServices index,
LongList featureReferences) |
Modifier and Type | Method and Description |
---|---|
void |
accept(Visitor visitor)
Provides each value of this Store to the provided
Visitor . |
void |
accept(Visitor visitor,
long firstValueIndex)
Provides each value of this Store to the provided
Visitor ,
beginning from the provided index position. |
boolean |
canFilter() |
boolean |
canIterateFromIndex() |
boolean |
canOrder() |
void |
delete(Feature feature)
Deletes a
Feature from this FeatureSet. |
void |
dispose()
Disposes the current object, to allow it to close and dispose any used
resources.
|
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.
|
boolean |
isFromStore(DataStore store)
Indicates whether this DataSet belongs to a specific store
|
DisposableIterator |
iterator()
Returns an iterator over the elements in this collection, in the order
(if any) defined when the collection was obtained.
|
DisposableIterator |
iterator(long index)
Returns an iterator over the elements in this collection, in the order
(if any) defined when the collection was obtained.
|
void |
update(EditableFeature feature)
Updates a
Feature with the given EditableFeature . |
public IndexFeatureSet(FeatureIndexProviderServices index, LongList featureReferences)
public boolean canFilter()
canFilter
in interface FeatureSetProvider
public boolean canIterateFromIndex()
canIterateFromIndex
in interface FeatureSetProvider
public boolean canOrder()
canOrder
in interface FeatureSetProvider
public DisposableIterator fastIterator(long index) throws DataException
FeatureSet
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.
fastIterator
in interface FeatureSet
fastIterator
in interface FeatureSetProvider
index
- position in which the iterator is initially located.DataException
- if there is an error getting the iteratorDataSet.accept(org.gvsig.tools.visitor.Visitor)
,
FeatureSet.accept(org.gvsig.tools.visitor.Visitor, long)
public DisposableIterator fastIterator() throws DataException
FeatureSet
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.
fastIterator
in interface FeatureSet
fastIterator
in interface FeatureSetProvider
DataException
- if there is an error getting the iteratorDataSet.accept(org.gvsig.tools.visitor.Visitor)
,
FeatureSet.accept(org.gvsig.tools.visitor.Visitor, long)
public long getSize() throws DataException
FeatureSet
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.getSize
in interface FeatureSet
getSize
in interface FeatureSetProvider
Feature
(s) contained in this FeatureSet.DataException
public boolean isEmpty() throws DataException
FeatureSet
isEmpty
in interface FeatureSet
isEmpty
in interface FeatureSetProvider
DataException
public DisposableIterator iterator()
FeatureSet
iterator
in interface Iterable<Feature>
iterator
in interface FeatureSet
iterator
in interface FeatureSetProvider
DataSet.accept(org.gvsig.tools.visitor.Visitor)
,
FeatureSet.accept(org.gvsig.tools.visitor.Visitor, long)
,
FeatureSet.fastIterator()
,
FeatureSet.fastIterator(long)
public DisposableIterator iterator(long index) throws DataException
FeatureSet
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.
iterator
in interface FeatureSet
iterator
in interface FeatureSetProvider
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)
,
FeatureSet.accept(org.gvsig.tools.visitor.Visitor, long)
,
FeatureSet.fastIterator()
,
FeatureSet.fastIterator(long)
public void delete(Feature feature) throws DataException
FeatureSet
Feature
from this FeatureSet.DisposableIterator
from this store that was still in use will be
unsafe. Use Iterator.remove()
instead.delete
in interface FeatureSet
feature
- the Feature
to delete.DataException
public FeatureType getDefaultFeatureType()
FeatureSet
FeatureType
of this FeatureSet.getDefaultFeatureType
in interface FeatureSet
FeatureType
in this FeatureSet.public List getFeatureTypes()
FeatureSet
FeatureType
(s) in this FeatureSet.getFeatureTypes
in interface FeatureSet
FeatureType
(s) in this FeatureSet.public void insert(EditableFeature feature) throws DataException
FeatureSet
EditableFeature
as it has not been stored yet.DisposableIterator
from this store that was still in use can will not
reflect this change.insert
in interface FeatureSet
feature
- the EditableFeature
to insert.DataException
public void update(EditableFeature feature) throws DataException
FeatureSet
Feature
with the given EditableFeature
.DisposableIterator
from this store that was still in use can will not
reflect this change.update
in interface FeatureSet
feature
- an instance of EditableFeature
with which to update
the associated Feature
.DataException
public void dispose()
Disposable
NOTE:After calling this method, the object may not be usable anymore.
dispose
in interface Disposable
public boolean isFromStore(DataStore store)
DataSet
isFromStore
in interface DataSet
store
- a DataStorepublic void accept(Visitor visitor) throws BaseException
DataSet
Visitor
.
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 DataSet
accept
in interface Visitable
visitor
- the visitor to apply to each value.BaseException
- if there is an error while performing the visitpublic void accept(Visitor visitor, long firstValueIndex) throws BaseException
FeatureSet
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 FeatureSet
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 visitpublic DynObjectSet getDynObjectSet()
FeatureSet
DynObjectSet
of the contents of this set.
Defaults to fast iteration.getDynObjectSet
in interface FeatureSet
DynObjectSet
public DynObjectSet getDynObjectSet(boolean fast)
FeatureSet
DynObjectSet
of the contents of this set.getDynObjectSet
in interface FeatureSet
fast
- if the set will be able to be iterated in a fast way, by
reusing the DynObject
instance for each
Feature
instance.DynObjectSet