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 class
AbstractDatabase.Par
Parameterization class.
-
Field Summary
Fields Modifier and Type Field Description protected DatabaseEventManager
eventManager
The event manager, collects events and fires them on demand.protected java.util.Collection<IndexFactory<?>>
indexFactories
Index factories.protected java.util.List<Relation<?>>
relations
The 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 void
accumulateDataStoreEvents()
Collects all insertion, deletion and update events untilDatabase.flushDataStoreEvents()
is called.void
addDataStoreListener(DataStoreListener l)
Adds a listener for theDataStoreEvent
posted after the content of the database changes.void
flushDataStoreEvents()
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.SingleObjectBundle
getBundle(DBIDRef id)
Returns the DatabaseObject represented by the specified id.protected abstract Logging
getLogger()
Get the class logger.java.lang.String
getLongName()
<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.String
getShortName()
void
removeDataStoreListener(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:Database
Returns the DatabaseObject represented by the specified id.
-
getRelations
public java.util.Collection<Relation<?>> getRelations()
Description copied from interface:Database
Get all relations of a database.- Specified by:
getRelations
in 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:Database
Get an object representation.- Specified by:
getRelation
in 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:Database
Adds a listener for theDataStoreEvent
posted after the content of the database changes.- Specified by:
addDataStoreListener
in interfaceDatabase
- Parameters:
l
- the listener to add- See Also:
Database.removeDataStoreListener(DataStoreListener)
,DataStoreListener
,DataStoreEvent
-
removeDataStoreListener
public void removeDataStoreListener(DataStoreListener l)
Description copied from interface:Database
Removes a listener previously added withDatabase.addDataStoreListener(DataStoreListener)
.- Specified by:
removeDataStoreListener
in interfaceDatabase
- Parameters:
l
- the listener to remove- See Also:
Database.addDataStoreListener(DataStoreListener)
,DataStoreListener
,DataStoreEvent
-
accumulateDataStoreEvents
public void accumulateDataStoreEvents()
Description copied from interface:Database
Collects all insertion, deletion and update events untilDatabase.flushDataStoreEvents()
is called.- Specified by:
accumulateDataStoreEvents
in interfaceDatabase
- See Also:
DataStoreEvent
-
flushDataStoreEvents
public void flushDataStoreEvents()
Description copied from interface:Database
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.- Specified by:
flushDataStoreEvents
in 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
-
-