Package elki.database
Interface Database
-
- All Known Subinterfaces:
UpdatableDatabase
- All Known Implementing Classes:
AbstractDatabase
,HashmapDatabase
,ProxyDatabase
,StaticArrayDatabase
public interface Database
Database specifies the requirements for any database implementation. Note that any implementing class is supposed to provide a constructor without parameters for dynamic instantiation.- Since:
- 0.1
- Author:
- Elke Achtert
-
-
Method Summary
All Methods Instance Methods Abstract Methods Modifier and Type Method Description void
accumulateDataStoreEvents()
Collects all insertion, deletion and update events untilflushDataStoreEvents()
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 sinceaccumulateDataStoreEvents()
has been called.SingleObjectBundle
getBundle(DBIDRef id)
Returns the DatabaseObject represented by the specified id.<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.void
initialize()
Initialize the database, for example by loading the input data.void
removeDataStoreListener(DataStoreListener l)
Removes a listener previously added withaddDataStoreListener(DataStoreListener)
.
-
-
-
Method Detail
-
initialize
void initialize()
Initialize the database, for example by loading the input data. (Since this should NOT be done on construction time!)
-
getRelations
java.util.Collection<Relation<?>> getRelations()
Get all relations of a database.- Returns:
- All relations in the database
-
getRelation
<O> Relation<O> getRelation(TypeInformation restriction, java.lang.Object... hints)
Get an object representation.- Type Parameters:
O
- Object type- Parameters:
restriction
- Type restrictionhints
- Optimizer hints- Returns:
- representation
-
getBundle
SingleObjectBundle getBundle(DBIDRef id)
Returns the DatabaseObject represented by the specified id.- Parameters:
id
- the id of the Object to be obtained from the Database- Returns:
- Bundle containing the objects' data
-
addDataStoreListener
void addDataStoreListener(DataStoreListener l)
Adds a listener for theDataStoreEvent
posted after the content of the database changes.- Parameters:
l
- the listener to add- See Also:
removeDataStoreListener(DataStoreListener)
,DataStoreListener
,DataStoreEvent
-
removeDataStoreListener
void removeDataStoreListener(DataStoreListener l)
Removes a listener previously added withaddDataStoreListener(DataStoreListener)
.- Parameters:
l
- the listener to remove- See Also:
addDataStoreListener(DataStoreListener)
,DataStoreListener
,DataStoreEvent
-
accumulateDataStoreEvents
void accumulateDataStoreEvents()
Collects all insertion, deletion and update events untilflushDataStoreEvents()
is called.- See Also:
DataStoreEvent
-
flushDataStoreEvents
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 sinceaccumulateDataStoreEvents()
has been called.- See Also:
DataStoreListener
,DataStoreEvent
-
-