Package elki.database
Class AbstractDatabase
- java.lang.Object
-
- elki.database.AbstractDatabase
-
- All Implemented Interfaces:
Database
- Direct Known Subclasses:
HashmapDatabase,ProxyDatabase,StaticArrayDatabase
public abstract class AbstractDatabase extends java.lang.Object implements Database
Abstract base class for database API implementations. Provides default management of relations, indexes and events as well as default query matching.Note: when debugging index usage, set logging for this package to FINEST via -enableDebug elki.database=FINEST
- Since:
- 0.1
- Author:
- Erich Schubert
-
-
Nested Class Summary
Nested Classes Modifier and Type Class Description static classAbstractDatabase.ParParameterization class.
-
Field Summary
Fields Modifier and Type Field Description protected DatabaseEventManagereventManagerThe event manager, collects events and fires them on demand.protected java.util.Collection<IndexFactory<?>>indexFactoriesIndex factories.protected java.util.List<Relation<?>>relationsThe relations we manage.
-
Constructor Summary
Constructors Constructor Description AbstractDatabase()Constructor.
-
Method Summary
All Methods Instance Methods Abstract Methods Concrete Methods Modifier and Type Method Description voidaccumulateDataStoreEvents()Collects all insertion, deletion and update events untilDatabase.flushDataStoreEvents()is called.voidaddDataStoreListener(DataStoreListener l)Adds a listener for theDataStoreEventposted after the content of the database changes.voidflushDataStoreEvents()Fires all collected insertion, deletion and update events as one DataStoreEvent, i.e. notifies all registered DataStoreListener how the content of the database has been changed sinceDatabase.accumulateDataStoreEvents()has been called.SingleObjectBundlegetBundle(DBIDRef id)Returns the DatabaseObject represented by the specified id.protected abstract LogginggetLogger()Get the class logger.java.lang.StringgetLongName()<O> Relation<O>getRelation(TypeInformation restriction, java.lang.Object... hints)Get an object representation.java.util.Collection<Relation<?>>getRelations()Get all relations of a database.java.lang.StringgetShortName()voidremoveDataStoreListener(DataStoreListener l)Removes a listener previously added withDatabase.addDataStoreListener(DataStoreListener).-
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
-
Methods inherited from interface elki.database.Database
initialize
-
-
-
-
Field Detail
-
eventManager
protected final DatabaseEventManager eventManager
The event manager, collects events and fires them on demand.
-
relations
protected final java.util.List<Relation<?>> relations
The relations we manage.
-
indexFactories
protected final java.util.Collection<IndexFactory<?>> indexFactories
Index factories.
-
-
Method Detail
-
getBundle
public SingleObjectBundle getBundle(DBIDRef id)
Description copied from interface:DatabaseReturns the DatabaseObject represented by the specified id.
-
getRelations
public java.util.Collection<Relation<?>> getRelations()
Description copied from interface:DatabaseGet all relations of a database.- Specified by:
getRelationsin interfaceDatabase- Returns:
- All relations in the database
-
getRelation
public <O> Relation<O> getRelation(TypeInformation restriction, java.lang.Object... hints) throws NoSupportedDataTypeException
Description copied from interface:DatabaseGet an object representation.- Specified by:
getRelationin interfaceDatabase- Type Parameters:
O- Object type- Parameters:
restriction- Type restrictionhints- Optimizer hints- Returns:
- representation
- Throws:
NoSupportedDataTypeException
-
addDataStoreListener
public void addDataStoreListener(DataStoreListener l)
Description copied from interface:DatabaseAdds a listener for theDataStoreEventposted after the content of the database changes.- Specified by:
addDataStoreListenerin interfaceDatabase- Parameters:
l- the listener to add- See Also:
Database.removeDataStoreListener(DataStoreListener),DataStoreListener,DataStoreEvent
-
removeDataStoreListener
public void removeDataStoreListener(DataStoreListener l)
Description copied from interface:DatabaseRemoves a listener previously added withDatabase.addDataStoreListener(DataStoreListener).- Specified by:
removeDataStoreListenerin interfaceDatabase- Parameters:
l- the listener to remove- See Also:
Database.addDataStoreListener(DataStoreListener),DataStoreListener,DataStoreEvent
-
accumulateDataStoreEvents
public void accumulateDataStoreEvents()
Description copied from interface:DatabaseCollects all insertion, deletion and update events untilDatabase.flushDataStoreEvents()is called.- Specified by:
accumulateDataStoreEventsin interfaceDatabase- See Also:
DataStoreEvent
-
flushDataStoreEvents
public void flushDataStoreEvents()
Description copied from interface:DatabaseFires all collected insertion, deletion and update events as one DataStoreEvent, i.e. notifies all registered DataStoreListener how the content of the database has been changed sinceDatabase.accumulateDataStoreEvents()has been called.- Specified by:
flushDataStoreEventsin interfaceDatabase- See Also:
DataStoreListener,DataStoreEvent
-
getLongName
public java.lang.String getLongName()
-
getShortName
public java.lang.String getShortName()
-
getLogger
protected abstract Logging getLogger()
Get the class logger.- Returns:
- Class logger
-
-