Package org.gvsig.fmap.dal.feature.impl
Class DefaultFeatureSelection
java.lang.Object
org.gvsig.tools.visitor.impl.AbstractVisitable
org.gvsig.tools.visitor.impl.AbstractIndexedVisitable
org.gvsig.fmap.dal.feature.impl.featureset.AbstractFeatureSet
org.gvsig.fmap.dal.feature.impl.DefaultFeatureSelection
- All Implemented Interfaces:
Cloneable,Iterable<org.gvsig.fmap.dal.feature.Feature>,org.gvsig.fmap.dal.DataSelection,org.gvsig.fmap.dal.DataSet,org.gvsig.fmap.dal.feature.FeatureReferenceSelection,org.gvsig.fmap.dal.feature.FeatureSelection,org.gvsig.fmap.dal.feature.FeatureSet,org.gvsig.tools.dispose.Disposable,org.gvsig.tools.lang.Cloneable,org.gvsig.tools.observer.ComplexObservable,org.gvsig.tools.observer.Observable,org.gvsig.tools.observer.Observer,org.gvsig.tools.observer.WeakReferencingObservable,org.gvsig.tools.persistence.Persistent,org.gvsig.tools.util.IsEmpty,org.gvsig.tools.util.Size,org.gvsig.tools.util.Size64,org.gvsig.tools.visitor.IndexedVisitable,org.gvsig.tools.visitor.Visitable
public class DefaultFeatureSelection
extends AbstractFeatureSet
implements org.gvsig.fmap.dal.feature.FeatureSelection
Default implementation of the FeatureSelection interface. Internally, only
FeatureReference values are stored.
This implementation performs better if used with the selection related
methods: select, deselect and isSelected ones.
- Author:
- Cèsar Ordiñana
-
Nested Class Summary
Nested ClassesModifier and TypeClassDescriptionclass -
Field Summary
Fields inherited from class org.gvsig.fmap.dal.feature.impl.featureset.AbstractFeatureSet
LOGFields inherited from interface org.gvsig.fmap.dal.feature.FeatureSelection
EMTPY_FEATURE_SELECTIONFields inherited from interface org.gvsig.fmap.dal.feature.FeatureSet
EMPTY_FEATURESET -
Constructor Summary
ConstructorsConstructorDescriptionConstructor used by the persistence manager.DefaultFeatureSelection(org.gvsig.fmap.dal.feature.FeatureStore featureStore, FeatureSelectionHelper helper) Creates a new Selection with the total size of Features from which the selection will be performed.DefaultFeatureSelection(DefaultFeatureStore featureStore) Creates a DefaultFeatureSelection, with a FeatureStore. -
Method Summary
Modifier and TypeMethodDescriptionvoidaddObserver(org.gvsig.tools.observer.Observer obsrvr) voidprotected voidclone()voidvoiddelete(org.gvsig.fmap.dal.feature.Feature feature) voiddeleteObserver(org.gvsig.tools.observer.Observer obsrvr) voidbooleandeselect(org.gvsig.fmap.dal.feature.Feature feature) booleandeselect(org.gvsig.fmap.dal.feature.Feature feature, boolean undoable) booleandeselect(org.gvsig.fmap.dal.feature.FeatureReference reference) booleandeselect(org.gvsig.fmap.dal.feature.FeatureReference reference, boolean undoable) booleandeselect(org.gvsig.fmap.dal.feature.FeatureSet features) booleandeselect(org.gvsig.fmap.dal.feature.FeatureSet features, boolean undoable) voidvoiddeselectAll(boolean undoable) voidfinal voiddispose()protected voiddoAccept(org.gvsig.tools.visitor.Visitor visitor, long firstValueIndex, long elements) protected voidvoidvoidorg.gvsig.tools.dispose.DisposableIteratorfastIterator(long index) Returns the list of selected values, or the deselected ones if the selection has been reversed.org.gvsig.tools.dispose.DisposableIteratorfastIterator(long index, long elements) getData()org.gvsig.fmap.dal.feature.FeatureTypeorg.gvsig.fmap.dal.feature.FeatureStorelonglonggetSize()voidinsert(org.gvsig.fmap.dal.feature.EditableFeature feature) booleanbooleanbooleanisSelected(org.gvsig.fmap.dal.feature.Feature feature) booleanisSelected(org.gvsig.fmap.dal.feature.FeatureReference reference) org.gvsig.tools.dispose.DisposableIteratoriterator(long index) Returns the list of selected values, or the deselected ones if the selection has been reversed.org.gvsig.tools.dispose.DisposableIteratoriterator(long index, long elements) voidloadFromState(org.gvsig.tools.persistence.PersistentState state) Iterable<org.gvsig.fmap.dal.feature.FeatureReference> org.gvsig.fmap.dal.feature.FeatureReferenceIteratorstatic voidvoidreverse()voidsaveToState(org.gvsig.tools.persistence.PersistentState ps) booleanselect(org.gvsig.fmap.dal.feature.Feature feature) booleanselect(org.gvsig.fmap.dal.feature.Feature feature, boolean undoable) booleanselect(org.gvsig.fmap.dal.feature.FeatureReference reference) booleanselect(org.gvsig.fmap.dal.feature.FeatureReference reference, boolean undoable) booleanselect(org.gvsig.fmap.dal.feature.FeatureSet features) booleanselect(org.gvsig.fmap.dal.feature.FeatureSet features, boolean undoable) voidtoString()voidupdate(org.gvsig.fmap.dal.feature.EditableFeature feature) voidMethods inherited from class org.gvsig.fmap.dal.feature.impl.featureset.AbstractFeatureSet
accept, doAccept, fastIterator, first, getDynObjectSet, getDynObjectSet, isEmpty, isFromStore, iterable, iterable, iterator, makeFilter, size, size64, toJson, toJSON, toJsonBuilderMethods inherited from class org.gvsig.tools.visitor.impl.AbstractIndexedVisitable
accept, doAcceptMethods inherited from class org.gvsig.tools.visitor.impl.AbstractVisitable
acceptMethods inherited from class java.lang.Object
equals, finalize, getClass, hashCode, notify, notifyAll, wait, wait, waitMethods inherited from interface org.gvsig.fmap.dal.DataSet
accept, isFromStoreMethods inherited from interface org.gvsig.fmap.dal.feature.FeatureSet
accept, accept, fastIterator, first, getDynObjectSet, getDynObjectSet, iterable, iterable, iterator, makeFilter, toJson, toJSON, toJsonBuilderMethods inherited from interface org.gvsig.tools.util.IsEmpty
isEmptyMethods inherited from interface java.lang.Iterable
forEach, spliteratorMethods inherited from interface org.gvsig.tools.util.Size
sizeMethods inherited from interface org.gvsig.tools.util.Size64
size64
-
Constructor Details
-
DefaultFeatureSelection
public DefaultFeatureSelection(DefaultFeatureStore featureStore) throws org.gvsig.fmap.dal.exception.DataException Creates a DefaultFeatureSelection, with a FeatureStore.- Parameters:
featureStore- the FeatureStore to load Features from- Throws:
org.gvsig.fmap.dal.exception.DataException- if there is an error while getting the total number of Features of the Store.- See Also:
-
DefaultFeatureSelection
public DefaultFeatureSelection(org.gvsig.fmap.dal.feature.FeatureStore featureStore, FeatureSelectionHelper helper) throws org.gvsig.fmap.dal.exception.DataException Creates a new Selection with the total size of Features from which the selection will be performed.- Parameters:
featureStore- the FeatureStore of the selected FeatureReferenceshelper- to get some information of the Store- Throws:
org.gvsig.fmap.dal.exception.DataException- if there is an error while getting the total number of Features of the Store.
-
DefaultFeatureSelection
public DefaultFeatureSelection()Constructor used by the persistence manager. Don't use directly. After to invoke this method, the persistence manager calls the the methodloadFromState(PersistentState)to set the values of the internal attributes that this class needs to work.
-
-
Method Details
-
getFeatureStore
public org.gvsig.fmap.dal.feature.FeatureStore getFeatureStore()- Specified by:
getFeatureStorein interfaceorg.gvsig.fmap.dal.feature.FeatureSet- Specified by:
getFeatureStorein classAbstractFeatureSet
-
getCommands
-
enableNotifications
public void enableNotifications()- Specified by:
enableNotificationsin interfaceorg.gvsig.tools.observer.ComplexObservable
-
disableNotifications
public void disableNotifications()- Specified by:
disableNotificationsin interfaceorg.gvsig.tools.observer.ComplexObservable
-
isReversed
public boolean isReversed() -
getSelectedCount
public long getSelectedCount()- Specified by:
getSelectedCountin interfaceorg.gvsig.fmap.dal.feature.FeatureReferenceSelection
-
getData
-
select
public boolean select(org.gvsig.fmap.dal.feature.FeatureReference reference) - Specified by:
selectin interfaceorg.gvsig.fmap.dal.feature.FeatureReferenceSelection
-
select
public boolean select(org.gvsig.fmap.dal.feature.FeatureReference reference, boolean undoable) -
deselect
public boolean deselect(org.gvsig.fmap.dal.feature.FeatureReference reference) - Specified by:
deselectin interfaceorg.gvsig.fmap.dal.feature.FeatureReferenceSelection
-
deselect
public boolean deselect(org.gvsig.fmap.dal.feature.FeatureReference reference, boolean undoable) -
referenceIterator
public org.gvsig.fmap.dal.feature.FeatureReferenceIterator referenceIterator()- Specified by:
referenceIteratorin interfaceorg.gvsig.fmap.dal.feature.FeatureReferenceSelection
-
referenceIterable
- Specified by:
referenceIterablein interfaceorg.gvsig.fmap.dal.feature.FeatureReferenceSelection
-
selectAll
public void selectAll() throws org.gvsig.fmap.dal.exception.DataException- Specified by:
selectAllin interfaceorg.gvsig.fmap.dal.feature.FeatureReferenceSelection- Throws:
org.gvsig.fmap.dal.exception.DataException
-
deselectAll
public void deselectAll() throws org.gvsig.fmap.dal.exception.DataException- Specified by:
deselectAllin interfaceorg.gvsig.fmap.dal.feature.FeatureReferenceSelection- Throws:
org.gvsig.fmap.dal.exception.DataException
-
deselectAll
public void deselectAll(boolean undoable) throws org.gvsig.fmap.dal.exception.DataException - Throws:
org.gvsig.fmap.dal.exception.DataException
-
isSelected
public boolean isSelected(org.gvsig.fmap.dal.feature.FeatureReference reference) - Specified by:
isSelectedin interfaceorg.gvsig.fmap.dal.feature.FeatureReferenceSelection
-
reverse
public void reverse()- Specified by:
reversein interfaceorg.gvsig.fmap.dal.feature.FeatureReferenceSelection
-
dispose
public final void dispose()- Specified by:
disposein interfaceorg.gvsig.tools.dispose.Disposable
-
update
- Specified by:
updatein interfaceorg.gvsig.tools.observer.Observer
-
addObserver
public void addObserver(org.gvsig.tools.observer.Observer obsrvr) - Specified by:
addObserverin interfaceorg.gvsig.tools.observer.Observable
-
deleteObserver
public void deleteObserver(org.gvsig.tools.observer.Observer obsrvr) - Specified by:
deleteObserverin interfaceorg.gvsig.tools.observer.Observable
-
deleteObservers
public void deleteObservers()- Specified by:
deleteObserversin interfaceorg.gvsig.tools.observer.Observable
-
beginComplexNotification
public void beginComplexNotification()- Specified by:
beginComplexNotificationin interfaceorg.gvsig.tools.observer.ComplexObservable
-
endComplexNotification
public void endComplexNotification()- Specified by:
endComplexNotificationin interfaceorg.gvsig.tools.observer.ComplexObservable
-
saveToState
public void saveToState(org.gvsig.tools.persistence.PersistentState ps) throws org.gvsig.tools.persistence.exception.PersistenceException - Specified by:
saveToStatein interfaceorg.gvsig.tools.persistence.Persistent- Throws:
org.gvsig.tools.persistence.exception.PersistenceException
-
select
public boolean select(org.gvsig.fmap.dal.feature.Feature feature) - Specified by:
selectin interfaceorg.gvsig.fmap.dal.feature.FeatureSelection
-
select
public boolean select(org.gvsig.fmap.dal.feature.Feature feature, boolean undoable) - Parameters:
feature-undoable- if the action must be undoable- Returns:
- See Also:
-
select
public boolean select(org.gvsig.fmap.dal.feature.FeatureSet features) throws org.gvsig.fmap.dal.exception.DataException - Specified by:
selectin interfaceorg.gvsig.fmap.dal.feature.FeatureSelection- Throws:
org.gvsig.fmap.dal.exception.DataException
-
select
public boolean select(org.gvsig.fmap.dal.feature.FeatureSet features, boolean undoable) throws org.gvsig.fmap.dal.exception.DataException - Parameters:
features-undoable- if the action must be undoable- Returns:
- Throws:
org.gvsig.fmap.dal.exception.DataException- See Also:
-
deselect
public boolean deselect(org.gvsig.fmap.dal.feature.Feature feature) - Specified by:
deselectin interfaceorg.gvsig.fmap.dal.feature.FeatureSelection
-
deselect
public boolean deselect(org.gvsig.fmap.dal.feature.Feature feature, boolean undoable) - Parameters:
feature-undoable- if the action must be undoable- Returns:
- See Also:
-
deselect
public boolean deselect(org.gvsig.fmap.dal.feature.FeatureSet features) throws org.gvsig.fmap.dal.exception.DataException - Specified by:
deselectin interfaceorg.gvsig.fmap.dal.feature.FeatureSelection- Throws:
org.gvsig.fmap.dal.exception.DataException
-
deselect
public boolean deselect(org.gvsig.fmap.dal.feature.FeatureSet features, boolean undoable) throws org.gvsig.fmap.dal.exception.DataException - Parameters:
features-undoable- if the action must be undoable- Returns:
- Throws:
org.gvsig.fmap.dal.exception.DataException- See Also:
-
isSelected
public boolean isSelected(org.gvsig.fmap.dal.feature.Feature feature) - Specified by:
isSelectedin interfaceorg.gvsig.fmap.dal.feature.FeatureSelection
-
getDefaultFeatureType
public org.gvsig.fmap.dal.feature.FeatureType getDefaultFeatureType()- Specified by:
getDefaultFeatureTypein interfaceorg.gvsig.fmap.dal.feature.FeatureSet
-
getFeatureTypes
- Specified by:
getFeatureTypesin interfaceorg.gvsig.fmap.dal.feature.FeatureSet
-
getSize
public long getSize() throws org.gvsig.fmap.dal.exception.DataException- Specified by:
getSizein interfaceorg.gvsig.fmap.dal.feature.FeatureSet- Throws:
org.gvsig.fmap.dal.exception.DataException
-
iterator
public org.gvsig.tools.dispose.DisposableIterator iterator(long index) Returns the list of selected values, or the deselected ones if the selection has been reversed. WARN: not very good performance implementation.- Specified by:
iteratorin interfaceorg.gvsig.fmap.dal.feature.FeatureSet
-
iterator
public org.gvsig.tools.dispose.DisposableIterator iterator(long index, long elements) - Specified by:
iteratorin interfaceorg.gvsig.fmap.dal.feature.FeatureSet
-
fastIterator
public org.gvsig.tools.dispose.DisposableIterator fastIterator(long index) Returns the list of selected values, or the deselected ones if the selection has been reversed. WARN: not really a fast implementation.- Specified by:
fastIteratorin interfaceorg.gvsig.fmap.dal.feature.FeatureSet
-
fastIterator
public org.gvsig.tools.dispose.DisposableIterator fastIterator(long index, long elements) - Specified by:
fastIteratorin interfaceorg.gvsig.fmap.dal.feature.FeatureSet
-
clearFeatureReferences
protected void clearFeatureReferences() -
delete
public void delete(org.gvsig.fmap.dal.feature.Feature feature) throws org.gvsig.fmap.dal.exception.DataException - Specified by:
deletein interfaceorg.gvsig.fmap.dal.feature.FeatureSet- Throws:
org.gvsig.fmap.dal.exception.DataException
-
insert
public void insert(org.gvsig.fmap.dal.feature.EditableFeature feature) throws org.gvsig.fmap.dal.exception.DataException - Specified by:
insertin interfaceorg.gvsig.fmap.dal.feature.FeatureSet- Throws:
org.gvsig.fmap.dal.exception.DataException
-
update
public void update(org.gvsig.fmap.dal.feature.EditableFeature feature) throws org.gvsig.fmap.dal.exception.DataException - Specified by:
updatein interfaceorg.gvsig.fmap.dal.feature.FeatureSet- Throws:
org.gvsig.fmap.dal.exception.DataException
-
commitChanges
public void commitChanges() throws org.gvsig.fmap.dal.exception.DataException- Specified by:
commitChangesin interfaceorg.gvsig.fmap.dal.feature.FeatureSet- Throws:
org.gvsig.fmap.dal.exception.DataException
-
loadFromState
public void loadFromState(org.gvsig.tools.persistence.PersistentState state) throws org.gvsig.tools.persistence.exception.PersistenceException - Specified by:
loadFromStatein interfaceorg.gvsig.tools.persistence.Persistent- Throws:
org.gvsig.tools.persistence.exception.PersistenceException
-
doDispose
protected void doDispose() throws org.gvsig.tools.exception.BaseException- Throws:
org.gvsig.tools.exception.BaseException
-
registerPersistent
public static void registerPersistent() -
clone
- Specified by:
clonein interfaceorg.gvsig.tools.lang.Cloneable- Overrides:
clonein classObject- Throws:
CloneNotSupportedException
-
doAccept
protected void doAccept(org.gvsig.tools.visitor.Visitor visitor, long firstValueIndex, long elements) throws org.gvsig.tools.exception.BaseException - Overrides:
doAcceptin classAbstractFeatureSet- Throws:
org.gvsig.tools.exception.BaseException
-
isAvailable
public boolean isAvailable()- Specified by:
isAvailablein interfaceorg.gvsig.fmap.dal.feature.FeatureReferenceSelection- Specified by:
isAvailablein interfaceorg.gvsig.fmap.dal.feature.FeatureSelection
-
toString
-