Package elki.database
Class HashmapDatabase
- java.lang.Object
-
- elki.database.AbstractDatabase
-
- elki.database.HashmapDatabase
-
- All Implemented Interfaces:
elki.database.Database,elki.database.UpdatableDatabase
@Description("Database using an in-memory hashtable and at least providing linear scans.") public class HashmapDatabase extends AbstractDatabase implements elki.database.UpdatableDatabaseDatabase storing data using hashtable storage, and thus allowing additional and removal of objects.- Since:
- 0.1
- Author:
- Arthur Zimek, Erich Schubert
-
-
Nested Class Summary
Nested Classes Modifier and Type Class Description static classHashmapDatabase.ParParameterization class.
-
Field Summary
Fields Modifier and Type Field Description protected elki.datasource.DatabaseConnectiondatabaseConnectionThe data source we get the initial data from.private DBIDViewidrepThe DBID representation we useprivate elki.database.ids.HashSetModifiableDBIDsidsIDs of this databaseprivate static elki.logging.LoggingLOGOur logger-
Fields inherited from class elki.database.AbstractDatabase
eventManager, indexFactories, relations
-
-
Constructor Summary
Constructors Constructor Description HashmapDatabase()Constructor with no indexes.HashmapDatabase(elki.datasource.DatabaseConnection databaseConnection, java.util.Collection<? extends elki.index.IndexFactory<?>> indexFactories)Constructor.
-
Method Summary
All Methods Instance Methods Concrete Methods Modifier and Type Method Description private elki.database.relation.Relation<?>addNewRelation(elki.data.type.SimpleTypeInformation<?> meta)Add a new representation for the given meta.protected elki.database.relation.Relation<?>[]alignColumns(elki.datasource.bundle.ObjectBundle pack)Find a mapping from package columns to database columns, eventually adding new database columns when needed.elki.datasource.bundle.SingleObjectBundledelete(elki.database.ids.DBIDRef id)Removes the object from the database (by callingdoDelete(DBIDRef)) and indexes and fires a deletion event.elki.datasource.bundle.MultipleObjectsBundledelete(elki.database.ids.DBIDs ids)Removes the objects from the database (by callingdoDelete(DBIDRef)for each object) and indexes and fires a deletion event.private voiddoDelete(elki.database.ids.DBIDRef id)Removes the object with the specified id from this database.protected elki.logging.LogginggetLogger()Get the class logger.voidinitialize()Initialize the database by getting the initial data from the database connection.elki.database.ids.DBIDsinsert(elki.datasource.bundle.ObjectBundle objpackages)-
Methods inherited from class elki.database.AbstractDatabase
accumulateDataStoreEvents, addDataStoreListener, flushDataStoreEvents, getBundle, getLongName, getRelation, getRelations, getShortName, removeDataStoreListener
-
-
-
-
Field Detail
-
LOG
private static final elki.logging.Logging LOG
Our logger
-
ids
private elki.database.ids.HashSetModifiableDBIDs ids
IDs of this database
-
idrep
private final DBIDView idrep
The DBID representation we use
-
databaseConnection
protected elki.datasource.DatabaseConnection databaseConnection
The data source we get the initial data from.
-
-
Constructor Detail
-
HashmapDatabase
public HashmapDatabase(elki.datasource.DatabaseConnection databaseConnection, java.util.Collection<? extends elki.index.IndexFactory<?>> indexFactories)Constructor.- Parameters:
databaseConnection- Database connection to get the initial data from.indexFactories- Indexes to add
-
HashmapDatabase
public HashmapDatabase()
Constructor with no indexes.
-
-
Method Detail
-
initialize
public void initialize()
Initialize the database by getting the initial data from the database connection.- Specified by:
initializein interfaceelki.database.Database
-
insert
public elki.database.ids.DBIDs insert(elki.datasource.bundle.ObjectBundle objpackages)
- Specified by:
insertin interfaceelki.database.UpdatableDatabase
-
alignColumns
protected elki.database.relation.Relation<?>[] alignColumns(elki.datasource.bundle.ObjectBundle pack)
Find a mapping from package columns to database columns, eventually adding new database columns when needed.- Parameters:
pack- Package to process- Returns:
- Column mapping
-
addNewRelation
private elki.database.relation.Relation<?> addNewRelation(elki.data.type.SimpleTypeInformation<?> meta)
Add a new representation for the given meta.- Parameters:
meta- meta data- Returns:
- new representation
-
delete
public elki.datasource.bundle.MultipleObjectsBundle delete(elki.database.ids.DBIDs ids)
Removes the objects from the database (by callingdoDelete(DBIDRef)for each object) and indexes and fires a deletion event.- Specified by:
deletein interfaceelki.database.UpdatableDatabase
-
delete
public elki.datasource.bundle.SingleObjectBundle delete(elki.database.ids.DBIDRef id)
Removes the object from the database (by callingdoDelete(DBIDRef)) and indexes and fires a deletion event.- Specified by:
deletein interfaceelki.database.UpdatableDatabase
-
doDelete
private void doDelete(elki.database.ids.DBIDRef id)
Removes the object with the specified id from this database.- Parameters:
id- id the id of the object to be removed
-
getLogger
protected elki.logging.Logging getLogger()
Description copied from class:AbstractDatabaseGet the class logger.- Specified by:
getLoggerin classAbstractDatabase- Returns:
- Class logger
-
-