@Description(value="Database using an in-memory hashtable and at least providing linear scans.") public class HashmapDatabase extends AbstractDatabase implements UpdatableDatabase
Modifier and Type | Class and Description |
---|---|
static class |
HashmapDatabase.Parameterizer
Parameterization class.
|
Modifier and Type | Field and Description |
---|---|
protected DatabaseConnection |
databaseConnection
The data source we get the initial data from.
|
private DBIDView |
idrep
The DBID representation we use
|
private HashSetModifiableDBIDs |
ids
IDs of this database
|
private static Logging |
LOG
Our logger
|
eventManager, indexFactories, relations
Constructor and Description |
---|
HashmapDatabase()
Constructor with no indexes.
|
HashmapDatabase(DatabaseConnection databaseConnection,
Collection<IndexFactory<?,?>> indexFactories)
Constructor.
|
Modifier and Type | Method and Description |
---|---|
private Relation<?> |
addNewRelation(SimpleTypeInformation<?> meta)
Add a new representation for the given meta.
|
protected Relation<?>[] |
alignColumns(ObjectBundle pack)
Find a mapping from package columns to database columns, eventually adding
new database columns when needed.
|
SingleObjectBundle |
delete(DBIDRef id)
Removes the object from the database (by calling
doDelete(DBIDRef)
) and indexes and fires a deletion event. |
MultipleObjectsBundle |
delete(DBIDs ids)
Removes the objects from the database (by calling
doDelete(DBIDRef) for each object) and indexes and fires a
deletion event. |
private void |
doDelete(DBIDRef id)
Removes the object with the specified id from this database.
|
protected Logging |
getLogger()
Get the class logger.
|
void |
initialize()
Initialize the database by getting the initial data from the database
connection.
|
DBIDs |
insert(ObjectBundle objpackages)
Inserts the given object(s) and their associations into the database.
|
accumulateDataStoreEvents, addDataStoreListener, flushDataStoreEvents, getBundle, getDistanceQuery, getKNNQuery, getLongName, getRangeQuery, getRelation, getRelations, getRKNNQuery, getShortName, getSimilarityQuery, removeDataStoreListener
addChildResult, getHierarchy, setHierarchy
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
accumulateDataStoreEvents, addDataStoreListener, flushDataStoreEvents, getBundle, getDistanceQuery, getKNNQuery, getRangeQuery, getRelation, getRelations, getRKNNQuery, getSimilarityQuery, removeDataStoreListener
getHierarchy, setHierarchy
getLongName, getShortName
private static final Logging LOG
private HashSetModifiableDBIDs ids
private final DBIDView idrep
protected DatabaseConnection databaseConnection
public HashmapDatabase(DatabaseConnection databaseConnection, Collection<IndexFactory<?,?>> indexFactories)
databaseConnection
- Database connection to get the initial data from.indexFactories
- Indexes to addpublic HashmapDatabase()
public void initialize()
initialize
in interface Database
public DBIDs insert(ObjectBundle objpackages)
UpdatableDatabase
insert
in interface UpdatableDatabase
objpackages
- the objects to be insertedprotected Relation<?>[] alignColumns(ObjectBundle pack)
pack
- Package to processprivate Relation<?> addNewRelation(SimpleTypeInformation<?> meta)
meta
- meta datapublic MultipleObjectsBundle delete(DBIDs ids)
doDelete(DBIDRef)
for each object) and indexes and fires a
deletion event.
Removes and returns the specified objects with the given ids from the
database.delete
in interface UpdatableDatabase
ids
- the ids of the object to be removed from the databasepublic SingleObjectBundle delete(DBIDRef id)
doDelete(DBIDRef)
) and indexes and fires a deletion event.
Removes and returns the specified objects with the given ids from the
database.delete
in interface UpdatableDatabase
id
- the id of the object to be removed from the databaseprivate void doDelete(DBIDRef id)
id
- id the id of the object to be removedprotected Logging getLogger()
AbstractDatabase
getLogger
in class AbstractDatabase
Copyright © 2015 ELKI Development Team, Lehr- und Forschungseinheit für Datenbanksysteme, Ludwig-Maximilians-Universität München. License information.