
@Description(value="Database using an in-memory hashtable and at least providing linear scans.") public class HashmapDatabase extends AbstractDatabase implements UpdatableDatabase, Parameterizable
| 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 TreeSetModifiableDBIDs |
ids
IDs of this database
|
private static Logging |
logger
Our logger
|
eventManager, INDEX_ID, indexes, 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.
|
MultipleObjectsBundle |
delete(DBIDs ids)
Removes the objects from the database (by calling
doDelete(DBID)
for each object) and indexes and fires a deletion event. |
private void |
doDelete(DBID id)
Removes the object with the specified id from this database.
|
StaticDBIDs |
getDBIDs()
Deprecated.
|
protected Logging |
getLogger() |
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.
|
private void |
restoreID(DBID id)
Makes the given id reusable for new insertion operations.
|
int |
size()
Deprecated.
|
accumulateDataStoreEvents, addDataStoreListener, addIndex, flushDataStoreEvents, getBundle, getDistanceQuery, getIndexes, getKNNQuery, getLongName, getRangeQuery, getRelation, getRelations, getRKNNQuery, getShortName, getSimilarityQuery, removeDataStoreListener, removeIndexaddChildResult, getHierarchy, setHierarchyclone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, waitaccumulateDataStoreEvents, addDataStoreListener, addIndex, flushDataStoreEvents, getBundle, getDistanceQuery, getIndexes, getKNNQuery, getRangeQuery, getRelation, getRelations, getRKNNQuery, getSimilarityQuery, removeDataStoreListener, removeIndexgetHierarchy, setHierarchygetLongName, getShortNameprivate static final Logging logger
private TreeSetModifiableDBIDs 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 Databasepublic DBIDs insert(ObjectBundle objpackages)
UpdatableDatabaseinsert in interface UpdatableDatabaseobjpackages - 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(DBID)
for each object) and indexes and fires a deletion event.delete in interface UpdatableDatabaseids - the ids of the object to be removed from the databaseprivate void doDelete(DBID id)
id - id the id of the object to be removed@Deprecated public final int size()
Database@Deprecated public StaticDBIDs getDBIDs()
Databaseprivate void restoreID(DBID id)
id - the id to become reusableprotected Logging getLogger()
getLogger in class AbstractDatabase