public class DefaultFeatureSet extends AbstractFeatureSet implements FeatureSet, Observer
Modifier and Type | Class and Description |
---|---|
static class |
DefaultFeatureSet.SetConcurrentModificationException |
Modifier and Type | Field and Description |
---|---|
protected FeatureType |
defatulFeatureTypeForProvider |
protected static int |
DEFAULT |
protected FeatureType |
defaultFeatureType |
protected static int |
EDITED |
protected static int |
EDITED_FILTERED |
protected Feature |
featureToIgnoreNotification |
protected java.util.List |
featureTypes |
protected static int |
FILTERED |
protected boolean |
ignoreChanges |
protected int |
iteratorMode |
protected static int |
NO_CHECKED |
protected static int |
ORDERD_EDITED |
protected static int |
ORDERED |
protected static int |
ORDERED_EDITED_FILTER |
protected static int |
ORDERED_FILTERED |
protected java.util.List |
orderedData |
protected boolean |
ownFeaturesModified |
protected FeatureSetProvider |
provider |
protected FeatureQuery |
query |
protected FeatureQuery |
queryForProvider |
protected long |
size |
protected boolean |
sourceStoreModified |
protected java.lang.Throwable |
sourceStoreModifiedCause |
protected DefaultFeatureStore |
store |
protected DefaultFeatureStoreTransforms |
transform |
LOG
EMPTY_FEATURESET
Constructor and Description |
---|
DefaultFeatureSet(DefaultFeatureStore store,
FeatureQuery query) |
Modifier and Type | Method and Description |
---|---|
protected void |
checkSourceStoreModified() |
void |
commitChanges() |
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.
|
void |
doDispose() |
DisposableIterator |
fastIterator(long index)
Returns a fast iterator over this set, starting from the given index.
|
DisposableIterator |
fastIterator(long index,
long elements) |
FeatureType |
getDefaultFeatureType()
Returns the default
FeatureType of this FeatureSet. |
FeatureStore |
getFeatureStore() |
java.util.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.
|
DisposableIterator |
iterator(long index)
Returns an iterator over the elements in this collection, in the order
(if any) defined when the collection was obtained.
|
DisposableIterator |
iterator(long index,
long elements) |
void |
setIgnoreConcurrentChanges(boolean b) |
void |
update(EditableFeature feature)
Updates a
Feature with the given EditableFeature . |
void |
update(Observable obsevable,
java.lang.Object notification)
Called whenever a
Observable object is changed and this
Observer has registered on it to receive notifications. |
accept, doAccept, doAccept, fastIterator, first, getDynObjectSet, getDynObjectSet, isEmpty, isFromStore, iterable, iterable, iterator, makeFilter, size, size64, toJson, toJSON, toJsonBuilder
accept, doAccept
accept
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
accept, accept, fastIterator, first, getDynObjectSet, getDynObjectSet, iterable, iterable, iterator, makeFilter, toJson, toJSON, toJsonBuilder
accept, isFromStore
isEmpty, isEmpty, isEmpty, isEmptyQuietly
protected static final int NO_CHECKED
protected static final int DEFAULT
protected static final int FILTERED
protected static final int ORDERED
protected static final int ORDERED_FILTERED
protected static final int EDITED
protected static final int EDITED_FILTERED
protected static final int ORDERD_EDITED
protected static final int ORDERED_EDITED_FILTER
protected java.lang.Throwable sourceStoreModifiedCause
protected boolean sourceStoreModified
protected boolean ownFeaturesModified
protected DefaultFeatureStore store
protected java.util.List featureTypes
protected FeatureQuery query
protected FeatureSetProvider provider
protected long size
protected int iteratorMode
protected java.util.List orderedData
protected Feature featureToIgnoreNotification
protected DefaultFeatureStoreTransforms transform
protected FeatureQuery queryForProvider
protected FeatureType defaultFeatureType
protected FeatureType defatulFeatureTypeForProvider
protected boolean ignoreChanges
public DefaultFeatureSet(DefaultFeatureStore store, FeatureQuery query) throws DataException
DataException
public FeatureType getDefaultFeatureType()
FeatureSet
FeatureType
of this FeatureSet.getDefaultFeatureType
in interface FeatureSet
FeatureType
in this FeatureSet.public java.util.List getFeatureTypes()
FeatureSet
FeatureType
(s) in this FeatureSet.getFeatureTypes
in interface FeatureSet
FeatureType
(s) in this FeatureSet.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
Feature
(s) contained in this FeatureSet.DataException
public final void dispose()
Disposable
NOTE:After calling this method, the object may not be usable anymore.
dispose
in interface Disposable
public void doDispose()
public void update(Observable obsevable, java.lang.Object notification)
Observer
Observable
object is changed and this
Observer
has registered on it to receive notifications.
Implementations of this method will be called for each simple notification or, if a complex notification is created, for each of the child notifications.
In the latter case, don't assume any ordering in the notification between
this Observer
and other Observer
s listening to the same
Observable
.
In a complex notification scenario, if you want to receive only the
complex notification and not each of the child notifications, just
implement the ComplexObserver
and prepare this method
implementation to handle receiving DefaultComplexNotification
instances
as well as direct notification objects.
protected void checkSourceStoreModified()
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
index
- position in which the iterator is initially located.DataException
DataSet.accept(org.gvsig.tools.visitor.Visitor)
,
FeatureSet.accept(org.gvsig.tools.visitor.Visitor, long)
public DisposableIterator fastIterator(long index, long elements) throws DataException
fastIterator
in interface FeatureSet
DataException
public void setIgnoreConcurrentChanges(boolean b)
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
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 DisposableIterator iterator(long index, long elements) throws DataException
iterator
in interface FeatureSet
DataException
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 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 commitChanges() throws DataException
commitChanges
in interface FeatureSet
DataException
public FeatureStore getFeatureStore()
getFeatureStore
in interface FeatureSet
getFeatureStore
in class AbstractFeatureSet