public class DefaultFeatureIndex extends AbstractDisposable implements FeatureIndexProviderServices, WeakReferencingObservable
| Constructor and Description |
|---|
DefaultFeatureIndex(FeatureStoreProviderServices featureStore,
FeatureType featureType,
FeatureIndexProvider indexProvider,
String attributeName,
String indexName) |
| Modifier and Type | Method and Description |
|---|---|
void |
addObserver(Observer observer) |
void |
delete(Feature feat)
Deletes a Feature in the index.
|
void |
delete(FeatureSet data)
Deletes a FeatureSet from this index
FeatureType is not checked so it will accept any FeatureType
as long as exists a column with a valid name
|
void |
deleteObserver(Observer observer) |
void |
deleteObservers() |
protected void |
doDispose()
Internal implementation for the
AbstractDisposable.dispose() method, to be
implemented by child classes. |
void |
fill()
Fills this index with the store's data.
|
void |
fill(boolean background,
Observer observer)
Fills this index with the store's data.
|
String |
getAttributeName() |
List |
getAttributeNames()
Attribute names
|
int |
getDataType()
Data type
|
FeatureAttributeDescriptor |
getFeatureAttributeDescriptor()
Column to which belongs this index
|
FeatureIndexProvider |
getFeatureIndexProvider() |
FeatureStoreProviderServices |
getFeatureStoreProviderServices()
FeatureStore to which belongs this index
|
FeatureType |
getFeatureType()
FeatureType to which belongs this index
|
String |
getFileName()
Returns the absolute path (directory + filename) where this index is or
will be stored
|
FeatureSet |
getMatchFeatureSet(Object value)
Returns a FeatureSet with the set of values that match the given value.
|
String |
getName()
Index name
|
FeatureSet |
getNearestFeatureSet(int count,
Object value)
Returns a FeatureSet with the set of up to
count values that are nearest to the given value. |
FeatureSet |
getNearestFeatureSet(int count,
Object value,
Object tolerance)
Returns a FeatureSet with the set of up to
count values whose distance to the given value
is not greater than tolerance |
String |
getNewFileName(String prefix,
String sufix)
Calculates and returns a new filename for an index, using the given
prefix and suffix
|
FeatureSet |
getRangeFeatureSet(Object value1,
Object value2)
Returns a FeatureSet with the set of values that belong to the range defined by value1 and value2.
|
String |
getTemporaryFileName()
Returns a temporary absolute path (directory + filename) according to the
system environment
|
void |
initialize()
Initializes this provider
|
void |
insert(Feature feat)
Inserts a Feature in the index.
|
void |
insert(FeatureSet data)
Inserts a FeatureSet into this index
FeatureType is not checked so it will accept any FeatureType
as long as exists a column with a valid name
|
boolean |
isFilling()
Returns if the index is in the process of being filled with the Features
of a store.
|
boolean |
isValid()
Returns if the index is valid and might be used to get Features.
|
void |
notifyObservers(Object notification) |
void |
setValid(boolean valid)
Sets the index as valid or invalid, so it may be used or not.
|
String |
toString() |
void |
waitForIndex()
If the index is in the process of being filled by a background task,
synchronize this method or add some mechanism for external callers to
block on it.
|
dispose, disposeclone, equals, finalize, getClass, hashCode, notify, notifyAll, wait, wait, waitdisposepublic DefaultFeatureIndex(FeatureStoreProviderServices featureStore, FeatureType featureType, FeatureIndexProvider indexProvider, String attributeName, String indexName)
public final FeatureAttributeDescriptor getFeatureAttributeDescriptor()
FeatureIndexProviderServicesgetFeatureAttributeDescriptor in interface FeatureIndexProviderServicespublic final FeatureStoreProviderServices getFeatureStoreProviderServices()
FeatureIndexProviderServicesgetFeatureStoreProviderServices in interface FeatureIndexProviderServicespublic final FeatureType getFeatureType()
FeatureIndexProviderServicesgetFeatureType in interface FeatureIndexProviderServicespublic final String getAttributeName()
public final int getDataType()
FeatureIndexgetDataType in interface FeatureIndexpublic void fill()
throws FeatureIndexException
FeatureIndexProviderServicesfill in interface FeatureIndexProviderServicesFeatureIndexException - if there is an error while filling the indexpublic void fill(boolean background,
Observer observer)
throws FeatureIndexException
FeatureIndexProviderServicesfill in interface FeatureIndexProviderServicesbackground - if the filling must be performed in backgroundobserver - optional observer to be notified when the
fill index operation finishesFeatureIndexException - if there is an error while filling the indexFeatureStoreNotification.INDEX_FILLING_STARTED,
FeatureStoreNotification.INDEX_FILLING_SUCCESS,
FeatureStoreNotification.INDEX_FILLING_CANCELLED,
FeatureStoreNotification.INDEX_FILLING_ERRORpublic final void insert(FeatureSet data) throws DataException
FeatureIndexinsert in interface FeatureIndexDataExceptionpublic final void insert(Feature feat) throws DataException
FeatureIndexinsert in interface FeatureIndexDataExceptionpublic final void delete(FeatureSet data) throws FeatureIndexException
FeatureIndexdelete in interface FeatureIndexFeatureIndexExceptionpublic final void delete(Feature feat) throws DataException
FeatureIndexdelete in interface FeatureIndexDataExceptionpublic FeatureSet getMatchFeatureSet(Object value) throws FeatureIndexException
FeatureIndexgetMatchFeatureSet in interface FeatureIndexvalue - is the value to match.FeatureIndexExceptionpublic FeatureSet getRangeFeatureSet(Object value1, Object value2) throws FeatureIndexException
FeatureIndexgetRangeFeatureSet in interface FeatureIndexvalue1 - range lower limit.value2 - range higher limit.FeatureIndexExceptionpublic FeatureSet getNearestFeatureSet(int count, Object value) throws FeatureIndexException
FeatureIndexcount values that are nearest to the given value.getNearestFeatureSet in interface FeatureIndexcount - maximum number of values that their resulting FeatureSet will returnvalue - the value around which the nearest count will be looked up.count values that are nearest to the given value.FeatureIndexExceptionpublic FeatureSet getNearestFeatureSet(int count, Object value, Object tolerance) throws FeatureIndexException
FeatureIndexcount values whose distance to the given value
is not greater than tolerancegetNearestFeatureSet in interface FeatureIndexcount - maximum number of values that their resulting FeatureSet will returnvalue - the value around which the nearest count will be looked up.tolerance - maximum distance from the given value.count values that are nearest to the given value.FeatureIndexExceptionpublic void initialize()
throws InitializeException
FeatureIndexProviderServicesinitialize in interface FeatureIndexProviderServicesInitializeExceptionpublic List getAttributeNames()
FeatureIndexgetAttributeNames in interface FeatureIndexpublic String getNewFileName(String prefix, String sufix)
FeatureIndexProviderServicesgetNewFileName in interface FeatureIndexProviderServicespublic String getFileName()
FeatureIndexProviderServicesgetFileName in interface FeatureIndexProviderServicespublic String getTemporaryFileName()
FeatureIndexProviderServicesgetTemporaryFileName in interface FeatureIndexProviderServicespublic FeatureIndexProvider getFeatureIndexProvider()
public boolean isFilling()
FeatureIndexisFilling in interface FeatureIndexpublic boolean isValid()
FeatureIndexisValid in interface FeatureIndexpublic void waitForIndex()
FeatureIndexProviderServiceswaitForIndex in interface FeatureIndexProviderServicespublic void setValid(boolean valid)
FeatureIndexProviderServicessetValid in interface FeatureIndexProviderServicesvalid - status to set the index toprotected void doDispose()
throws BaseException
AbstractDisposableAbstractDisposable.dispose() method, to be
implemented by child classes.doDispose in class AbstractDisposableBaseExceptionAbstractDisposable.dispose()public void notifyObservers(Object notification)
public String getName()
FeatureIndexgetName in interface FeatureIndexpublic void addObserver(Observer observer)
addObserver in interface Observablepublic void deleteObserver(Observer observer)
deleteObserver in interface Observablepublic void deleteObservers()
deleteObservers in interface Observable