public class DefaultFeatureSelection extends DefaultFeatureReferenceSelection implements FeatureSelection
DefaultFeatureReferenceSelection.SelectionData
DYNCLASS_PERSISTENT_NAME, selectionData
Constructor and Description |
---|
DefaultFeatureSelection()
Constructor used by the persistence manager.
|
DefaultFeatureSelection(DefaultFeatureStore featureStore)
Creates a DefaultFeatureSelection, with a FeatureStore.
|
DefaultFeatureSelection(FeatureStore featureStore,
FeatureSelectionHelper helper)
Creates a new Selection with the total size of Features from which the
selection will be performed.
|
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. |
protected void |
clearFeatureReferences()
Removes all the stored FeatureRefence objects.
|
Object |
clone()
Creates a copy of the object.
|
void |
delete(Feature feature)
Deletes a
Feature from this FeatureSet. |
boolean |
deselect(Feature feature)
Removes a feature from the selection.
|
boolean |
deselect(Feature feature,
boolean undoable) |
boolean |
deselect(FeatureSet features)
Removes a DataSet of features from the selection.
|
boolean |
deselect(FeatureSet features,
boolean undoable) |
protected void |
doDispose()
Internal implementation for the
AbstractDisposable.dispose() method, to be
implemented by child classes. |
DisposableIterator |
fastIterator()
Returns the list of selected values, or the deselected ones if the
selection has been reversed.
|
DisposableIterator |
fastIterator(long index)
Returns the list of selected values, or the deselected ones if the
selection has been reversed.
|
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 |
isSelected(Feature feature)
Returns if a feature is selected.
|
DisposableIterator |
iterator()
Returns the list of selected values, or the deselected ones if the
selection has been reversed.
|
DisposableIterator |
iterator(long index)
Returns the list of selected values, or the deselected ones if the
selection has been reversed.
|
void |
loadFromState(PersistentState state)
Set the state of the object from the state passed as parameter.
|
static void |
registerPersistent() |
boolean |
select(Feature feature)
Adds a feature to the selection.
|
boolean |
select(Feature feature,
boolean undoable) |
boolean |
select(FeatureSet features)
Adds a DataSet of features to the selection.
|
boolean |
select(FeatureSet features,
boolean undoable) |
void |
update(EditableFeature feature)
Updates a
Feature with the given EditableFeature . |
addObserver, addObserver, addObservers, beginComplexNotification, countObservers, deleteObserver, deleteObserver, deleteObservers, deselect, deselect, deselectAll, deselectAll, disableNotifications, enableNotifications, endComplexNotification, getCommands, getData, getFeatureStore, getSelectedCount, inComplex, isEnabledNotifications, isFromStore, isReversed, isSelected, notifyObservers, notifyObservers, referenceIterator, reverse, reverse, saveToState, select, select, selectAll, selectAll, setData, toString, update
dispose, dispose
equals, finalize, getClass, hashCode, notify, notifyAll, wait, wait, wait
deselect, deselectAll, getSelectedCount, isSelected, referenceIterator, reverse, select, selectAll
isFromStore
dispose
addObserver, deleteObserver, deleteObservers
beginComplexNotification, disableNotifications, enableNotifications, endComplexNotification
saveToState
public DefaultFeatureSelection(DefaultFeatureStore featureStore) throws DataException
featureStore
- the FeatureStore to load Features fromDataException
- if there is an error while getting the total number of
Features of the Store.AbstractSetBasedDataSelection#DefaultSelection(int)
public DefaultFeatureSelection(FeatureStore featureStore, FeatureSelectionHelper helper) throws DataException
featureStore
- the FeatureStore of the selected FeatureReferenceshelper
- to get some information of the StoreDataException
- if there is an error while getting the total number of
Features of the Store.public DefaultFeatureSelection()
loadFromState(PersistentState)
to set the values of the internal
attributes that this class needs to work.public boolean select(Feature feature)
FeatureSelection
select
in interface FeatureSelection
feature
- the selected featurepublic boolean select(Feature feature, boolean undoable)
undoable
- if the action must be undoableselect(Feature)
public boolean select(FeatureSet features) throws DataException
FeatureSelection
select
in interface FeatureSelection
features
- the selected featuresDataException
- if there is an error reading the FeatureSet valuespublic boolean select(FeatureSet features, boolean undoable) throws DataException
undoable
- if the action must be undoableDataException
select(FeatureSet)
public boolean deselect(Feature feature)
FeatureSelection
deselect
in interface FeatureSelection
feature
- the deselected featurepublic boolean deselect(Feature feature, boolean undoable)
undoable
- if the action must be undoabledeselect(Feature)
public boolean deselect(FeatureSet features) throws DataException
FeatureSelection
deselect
in interface FeatureSelection
features
- the deselected featuresDataException
- if there is an error reading the FeatureSet valuespublic boolean deselect(FeatureSet features, boolean undoable) throws DataException
undoable
- if the action must be undoableDataException
deselect(FeatureSet)
public boolean isSelected(Feature feature)
FeatureSelection
isSelected
in interface FeatureSelection
feature
- to checkpublic 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 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 boolean isEmpty() throws DataException
FeatureSet
isEmpty
in interface FeatureSet
DataException
public DisposableIterator iterator()
iterator
in interface FeatureSet
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)
iterator
in interface FeatureSet
index
- index of first element to be returned from the iterator (by a
call to the next method).DataSet.accept(org.gvsig.tools.visitor.Visitor)
,
FeatureSet.accept(org.gvsig.tools.visitor.Visitor, long)
,
FeatureSet.fastIterator()
,
FeatureSet.fastIterator(long)
public DisposableIterator fastIterator()
fastIterator
in interface FeatureSet
DataSet.accept(org.gvsig.tools.visitor.Visitor)
,
FeatureSet.accept(org.gvsig.tools.visitor.Visitor, long)
public DisposableIterator fastIterator(long index)
fastIterator
in interface FeatureSet
index
- position in which the iterator is initially located.DataSet.accept(org.gvsig.tools.visitor.Visitor)
,
FeatureSet.accept(org.gvsig.tools.visitor.Visitor, long)
protected void clearFeatureReferences()
DefaultFeatureReferenceSelection
clearFeatureReferences
in class DefaultFeatureReferenceSelection
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 loadFromState(PersistentState state) throws PersistenceException
Persistent
loadFromState
in interface Persistent
loadFromState
in class DefaultFeatureReferenceSelection
PersistenceException
public 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
accept
in class DefaultFeatureReferenceSelection
visitor
- the visitor to apply to each value.BaseException
- if there is an error while performing the visitpublic final 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 visitprotected void doDispose() throws BaseException
AbstractDisposable
AbstractDisposable.dispose()
method, to be
implemented by child classes.doDispose
in class DefaultFeatureReferenceSelection
BaseException
AbstractDisposable.dispose()
public static void registerPersistent()
public Object clone() throws CloneNotSupportedException
Cloneable
clone
in class DefaultFeatureReferenceSelection
CloneNotSupportedException
- if the instance of the object cannot
be cloned. As this is extending Cloneable
so
its sure it implements it, so this exception may be used for problems
on specific object instances.Object#clone()}.
public 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