Environment for
DeveLoping
KDD-Applications
Supported by Index-Structures

de.lmu.ifi.dbs.elki.database
Class SequentialDatabase<O extends DatabaseObject>

java.lang.Object
  extended by de.lmu.ifi.dbs.elki.logging.AbstractLoggable
      extended by de.lmu.ifi.dbs.elki.utilities.optionhandling.AbstractParameterizable
          extended by de.lmu.ifi.dbs.elki.database.AbstractDatabase<O>
              extended by de.lmu.ifi.dbs.elki.database.SequentialDatabase<O>
All Implemented Interfaces:
Database<O>, Loggable, Parameterizable
Direct Known Subclasses:
InvertedListDatabase

public class SequentialDatabase<O extends DatabaseObject>
extends AbstractDatabase<O>

SequentialDatabase is a simple implementation of a Database.

It does not support any index structure and holds all objects in main memory (as a Map).

Author:
Arthur Zimek

Field Summary
 
Fields inherited from class de.lmu.ifi.dbs.elki.database.AbstractDatabase
listenerList
 
Fields inherited from class de.lmu.ifi.dbs.elki.utilities.optionhandling.AbstractParameterizable
optionHandler
 
Fields inherited from class de.lmu.ifi.dbs.elki.logging.AbstractLoggable
debug
 
Constructor Summary
SequentialDatabase()
          Provides a database for main memory holding all objects in a hashtable.
 
Method Summary
<D extends Distance<D>>
List<List<QueryResult<D>>>
bulkKNNQueryForID(List<Integer> ids, int k, DistanceFunction<O,D> distanceFunction)
          Performs k-nearest neighbor queries for the given object IDs.
 String description()
          Provides a description for SequentialDatabase.
<D extends Distance<D>>
List<QueryResult<D>>
kNNQueryForID(Integer id, int k, DistanceFunction<O,D> distanceFunction)
          Performs a k-nearest neighbor query for the given object ID.
<D extends Distance<D>>
List<QueryResult<D>>
kNNQueryForObject(O queryObject, int k, DistanceFunction<O,D> distanceFunction)
          Performs a k-nearest neighbor query for the given object.
<D extends Distance<D>>
List<QueryResult<D>>
rangeQuery(Integer id, String epsilon, DistanceFunction<O,D> distanceFunction)
          Performs a range query for the given object ID with the given epsilon range and the according distance function.
<D extends Distance<D>>
List<QueryResult<D>>
reverseKNNQuery(Integer id, int k, DistanceFunction<O,D> distanceFunction)
          Performs a reverse k-nearest neighbor query for the given object ID.
 
Methods inherited from class de.lmu.ifi.dbs.elki.database.AbstractDatabase
addDatabaseListener, associate, associateGlobally, delete, delete, deleteAssociations, dimensionality, fireObjectInserted, fireObjectRemoved, fireObjectsChanged, fireObjectsInserted, fireObjectsRemoved, get, getAssociation, getAssociations, getGlobalAssociation, getIDs, getObjects, insert, insert, isSet, isSetForAllObjects, isSetGlobally, iterator, partition, partition, randomSample, removeDatabaseListener, restoreID, setAssociations, setNewID, size
 
Methods inherited from class de.lmu.ifi.dbs.elki.utilities.optionhandling.AbstractParameterizable
addOption, checkGlobalParameterConstraints, deleteOption, description, description, getAttributeSettings, getParameters, getParameterValue, getPossibleOptions, inlineDescription, isSet, setParameters, setParameters
 
Methods inherited from class de.lmu.ifi.dbs.elki.logging.AbstractLoggable
debugFine, debugFiner, debugFinest, exception, message, progress, progress, progress, verbose, verbose, warning
 
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.utilities.optionhandling.Parameterizable
checkGlobalParameterConstraints, getAttributeSettings, getParameters, getPossibleOptions, inlineDescription, setParameters
 

Constructor Detail

SequentialDatabase

public SequentialDatabase()
Provides a database for main memory holding all objects in a hashtable.

Method Detail

kNNQueryForObject

public <D extends Distance<D>> List<QueryResult<D>> kNNQueryForObject(O queryObject,
                                                                      int k,
                                                                      DistanceFunction<O,D> distanceFunction)
Description copied from interface: Database
Performs a k-nearest neighbor query for the given object. The query result is in ascending order to the distance to the query object.

Parameters:
queryObject - the query object
k - the number of nearest neighbors to be returned
distanceFunction - the distance function that computes the distances beween the objects
Returns:
a List of the query results
See Also:
Database.kNNQueryForObject(DatabaseObject, int, de.lmu.ifi.dbs.elki.distance.distancefunction.DistanceFunction)

kNNQueryForID

public <D extends Distance<D>> List<QueryResult<D>> kNNQueryForID(Integer id,
                                                                  int k,
                                                                  DistanceFunction<O,D> distanceFunction)
Description copied from interface: Database
Performs a k-nearest neighbor query for the given object ID. The query result is in ascending order to the distance to the query object.

Parameters:
id - the ID of the query object
k - the number of nearest neighbors to be returned
distanceFunction - the distance function that computes the distances beween the objects
Returns:
a List of the query results
See Also:
Database.kNNQueryForID(java.lang.Integer, int, de.lmu.ifi.dbs.elki.distance.distancefunction.DistanceFunction)

bulkKNNQueryForID

public <D extends Distance<D>> List<List<QueryResult<D>>> bulkKNNQueryForID(List<Integer> ids,
                                                                            int k,
                                                                            DistanceFunction<O,D> distanceFunction)
Description copied from interface: Database
Performs k-nearest neighbor queries for the given object IDs. The query result is in ascending order to the distance to the query object.

Parameters:
ids - the IDs of the query objects
k - the number of nearest neighbors to be returned
distanceFunction - the distance function that computes the distances beween the objects
Returns:
a List of List of the query results
See Also:
Database.bulkKNNQueryForID(java.util.List, int, de.lmu.ifi.dbs.elki.distance.distancefunction.DistanceFunction)

rangeQuery

public <D extends Distance<D>> List<QueryResult<D>> rangeQuery(Integer id,
                                                               String epsilon,
                                                               DistanceFunction<O,D> distanceFunction)
Description copied from interface: Database
Performs a range query for the given object ID with the given epsilon range and the according distance function. The query result is in ascending order to the distance to the query object.

Parameters:
id - the ID of the query object
epsilon - the string representation of the query range
distanceFunction - the distance function that computes the distances beween the objects
Returns:
a List of the query results
See Also:
Database.rangeQuery(java.lang.Integer, java.lang.String, de.lmu.ifi.dbs.elki.distance.distancefunction.DistanceFunction)

reverseKNNQuery

public <D extends Distance<D>> List<QueryResult<D>> reverseKNNQuery(Integer id,
                                                                    int k,
                                                                    DistanceFunction<O,D> distanceFunction)
Description copied from interface: Database
Performs a reverse k-nearest neighbor query for the given object ID. The query result is in ascending order to the distance to the query object.

Parameters:
id - the ID of the query object
k - the number of nearest neighbors to be returned
distanceFunction - the distance function that computes the distances beween the objects
Returns:
a List of the query results
See Also:
Database.reverseKNNQuery(Integer, int, de.lmu.ifi.dbs.elki.distance.distancefunction.DistanceFunction)

description

public String description()
Provides a description for SequentialDatabase.

Specified by:
description in interface Database<O extends DatabaseObject>
Specified by:
description in interface Parameterizable
Overrides:
description in class AbstractParameterizable
Returns:
String a description of the class and the required parameters
See Also:
Database.description()

Release 0.1 (2008-07-10_1838)