de.lmu.ifi.dbs.elki.database
Class StaticArrayDatabase

java.lang.Object
  extended by de.lmu.ifi.dbs.elki.result.AbstractHierarchicalResult
      extended by de.lmu.ifi.dbs.elki.database.AbstractDatabase
          extended by de.lmu.ifi.dbs.elki.database.StaticArrayDatabase
All Implemented Interfaces:
Database, HierarchicalResult, Result, InspectionUtilFrequentlyScanned, Parameterizable

@Description(value="Database using an in-memory hashtable and at least providing linear scans.")
public class StaticArrayDatabase
extends AbstractDatabase
implements Database, Parameterizable

This database class uses array-based storage and thus does not allow for dynamic insert, delete and update operations. However, array access is expected to be faster and use less memory.


Nested Class Summary
static class StaticArrayDatabase.Parameterizer
          Parameterization class.
 
Field Summary
protected  DatabaseConnection databaseConnection
          The data source we get the initial data from.
private  DBIDView idrep
          The DBID representation we use
private  ArrayDBIDs ids
          IDs of this database
private static Logging logger
          Our logger
 
Fields inherited from class de.lmu.ifi.dbs.elki.database.AbstractDatabase
eventManager, INDEX_ID, indexes, indexFactories, relations
 
Constructor Summary
StaticArrayDatabase()
          Constructor with no indexes.
StaticArrayDatabase(DatabaseConnection databaseConnection, Collection<IndexFactory<?,?>> indexFactories)
          Constructor.
 
Method Summary
 void addIndex(Index index)
          Add a new index to the database.
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.
protected  int findDBIDColumn(ObjectBundle pack)
          Find an DBID column.
 StaticDBIDs getDBIDs()
          Deprecated. 
 Collection<Index> getIndexes()
          Collection of known indexes
protected  Logging getLogger()
           
 void initialize()
          Initialize the database by getting the initial data from the database connection.
 void removeIndex(Index index)
          Remove a particular index
 int size()
          Deprecated. 
 
Methods inherited from class de.lmu.ifi.dbs.elki.database.AbstractDatabase
accumulateDataStoreEvents, addDataStoreListener, flushDataStoreEvents, getBundle, getDistanceQuery, getKNNQuery, getLongName, getRangeQuery, getRelation, getRelations, getRKNNQuery, getShortName, getSimilarityQuery, removeDataStoreListener
 
Methods inherited from class de.lmu.ifi.dbs.elki.result.AbstractHierarchicalResult
addChildResult, getHierarchy, setHierarchy
 
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
 
Methods inherited from interface de.lmu.ifi.dbs.elki.database.Database
accumulateDataStoreEvents, addDataStoreListener, flushDataStoreEvents, getBundle, getDistanceQuery, getKNNQuery, getRangeQuery, getRelation, getRelations, getRKNNQuery, getSimilarityQuery, removeDataStoreListener
 
Methods inherited from interface de.lmu.ifi.dbs.elki.result.HierarchicalResult
getHierarchy, setHierarchy
 
Methods inherited from interface de.lmu.ifi.dbs.elki.result.Result
getLongName, getShortName
 

Field Detail

logger

private static final Logging logger
Our logger


ids

private ArrayDBIDs ids
IDs of this database


idrep

private DBIDView idrep
The DBID representation we use


databaseConnection

protected DatabaseConnection databaseConnection
The data source we get the initial data from.

Constructor Detail

StaticArrayDatabase

public StaticArrayDatabase(DatabaseConnection databaseConnection,
                           Collection<IndexFactory<?,?>> indexFactories)
Constructor.

Parameters:
databaseConnection - Database connection to get the initial data from.
indexFactories - Indexes to add

StaticArrayDatabase

public StaticArrayDatabase()
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 Database

addIndex

public void addIndex(Index index)
Description copied from interface: Database
Add a new index to the database.

Specified by:
addIndex in interface Database
Overrides:
addIndex in class AbstractDatabase
Parameters:
index - Index to add

getIndexes

public Collection<Index> getIndexes()
Description copied from interface: Database
Collection of known indexes

Specified by:
getIndexes in interface Database
Overrides:
getIndexes in class AbstractDatabase

removeIndex

public void removeIndex(Index index)
Description copied from interface: Database
Remove a particular index

Specified by:
removeIndex in interface Database
Overrides:
removeIndex in class AbstractDatabase
Parameters:
index - Index to remove

findDBIDColumn

protected int findDBIDColumn(ObjectBundle pack)
Find an DBID column.

Parameters:
pack - Package to process
Returns:
DBID column

alignColumns

protected Relation<?>[] alignColumns(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 Relation<?> addNewRelation(SimpleTypeInformation<?> meta)
Add a new representation for the given meta.

Parameters:
meta - meta data
Returns:
new representation

size

@Deprecated
public final int size()
Deprecated. 

Description copied from interface: Database
Returns the number of objects contained in this Database.

Specified by:
size in interface Database
Returns:
the number of objects in this Database

getDBIDs

@Deprecated
public StaticDBIDs getDBIDs()
Deprecated. 

Description copied from interface: Database
Returns a list comprising all IDs currently in use. The list returned shall not be linked to any actual list possibly hold in the database implementation.

Specified by:
getDBIDs in interface Database
Returns:
a list comprising all IDs currently in use

getLogger

protected Logging getLogger()
Specified by:
getLogger in class AbstractDatabase

Release 0.4.0 (2011-09-20_1324)