de.lmu.ifi.dbs.elki.database
Class SequentialDatabase<O extends DatabaseObject>
java.lang.Object
de.lmu.ifi.dbs.elki.logging.AbstractLoggable
de.lmu.ifi.dbs.elki.utilities.optionhandling.AbstractParameterizable
de.lmu.ifi.dbs.elki.database.AbstractDatabase<O>
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
Constructor Summary |
SequentialDatabase()
Provides a database for main memory holding all objects in a hashtable. |
Method Summary |
|
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. |
|
kNNQueryForID(Integer id,
int k,
DistanceFunction<O,D> distanceFunction)
Performs a k-nearest neighbor query for the given object ID. |
|
kNNQueryForObject(O queryObject,
int k,
DistanceFunction<O,D> distanceFunction)
Performs a k-nearest neighbor query for the given object. |
|
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. |
|
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 |
SequentialDatabase
public SequentialDatabase()
- Provides a database for main memory holding all objects in a hashtable.
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 objectk
- the number of nearest neighbors to be returneddistanceFunction
- 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 objectk
- the number of nearest neighbors to be returneddistanceFunction
- 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 objectsk
- the number of nearest neighbors to be returneddistanceFunction
- 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 objectepsilon
- the string representation of the query rangedistanceFunction
- 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 objectk
- the number of nearest neighbors to be returneddistanceFunction
- 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()