Package elki.database

Class 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.UpdatableDatabase
    Database 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 class  HashmapDatabase.Par
      Parameterization class.
    • 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.SingleObjectBundle delete​(elki.database.ids.DBIDRef id)
      Removes the object from the database (by calling doDelete(DBIDRef) ) and indexes and fires a deletion event.
      elki.datasource.bundle.MultipleObjectsBundle delete​(elki.database.ids.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​(elki.database.ids.DBIDRef id)
      Removes the object with the specified id from this database.
      protected elki.logging.Logging getLogger()
      Get the class logger.
      void initialize()
      Initialize the database by getting the initial data from the database connection.
      elki.database.ids.DBIDs insert​(elki.datasource.bundle.ObjectBundle objpackages)  
      • 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

        accumulateDataStoreEvents, addDataStoreListener, flushDataStoreEvents, getBundle, getRelation, getRelations, 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:
        initialize in interface elki.database.Database
      • insert

        public elki.database.ids.DBIDs insert​(elki.datasource.bundle.ObjectBundle objpackages)
        Specified by:
        insert in interface elki.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 calling doDelete(DBIDRef) for each object) and indexes and fires a deletion event.
        Specified by:
        delete in interface elki.database.UpdatableDatabase
      • delete

        public elki.datasource.bundle.SingleObjectBundle delete​(elki.database.ids.DBIDRef id)
        Removes the object from the database (by calling doDelete(DBIDRef) ) and indexes and fires a deletion event.
        Specified by:
        delete in interface elki.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