de.lmu.ifi.dbs.elki.index.tree.metrical.mtreevariants.mktrees.mktab
Class MkTabTreeIndex<O,D extends Distance<D>>

java.lang.Object
  extended by de.lmu.ifi.dbs.elki.index.tree.IndexTree<N,E>
      extended by de.lmu.ifi.dbs.elki.index.tree.metrical.MetricalIndexTree<O,D,N,E>
          extended by de.lmu.ifi.dbs.elki.index.tree.metrical.mtreevariants.AbstractMTree<O,D,N,E>
              extended by de.lmu.ifi.dbs.elki.index.tree.metrical.mtreevariants.mktrees.AbstractMkTree<O,D,N,E>
                  extended by de.lmu.ifi.dbs.elki.index.tree.metrical.mtreevariants.mktrees.AbstractMkTreeUnified<O,D,MkTabTreeNode<O,D>,MkTabEntry<D>>
                      extended by de.lmu.ifi.dbs.elki.index.tree.metrical.mtreevariants.mktrees.mktab.MkTabTree<O,D>
                          extended by de.lmu.ifi.dbs.elki.index.tree.metrical.mtreevariants.mktrees.mktab.MkTabTreeIndex<O,D>
Type Parameters:
O - Object type
D - Distance type
All Implemented Interfaces:
Index, KNNIndex<O>, RangeIndex<O>, RKNNIndex<O>, Result

public class MkTabTreeIndex<O,D extends Distance<D>>
extends MkTabTree<O,D>
implements RangeIndex<O>, KNNIndex<O>, RKNNIndex<O>

MkTabTree used as database index.


Field Summary
private  KNNQuery<O,D> knnQuery
          The knn query we use internally.
private  Relation<O> relation
          The relation indexed.
 
Fields inherited from class de.lmu.ifi.dbs.elki.index.tree.metrical.mtreevariants.AbstractMTree
distanceFunction, distanceQuery, extraIntegrityChecks
 
Fields inherited from class de.lmu.ifi.dbs.elki.index.tree.IndexTree
dirCapacity, dirMinimum, initialized, leafCapacity, leafMinimum
 
Constructor Summary
MkTabTreeIndex(Relation<O> relation, PageFile<MkTabTreeNode<O,D>> pagefile, DistanceQuery<O,D> distanceQuery, DistanceFunction<O,D> distanceFunction, int k_max)
          Constructor.
 
Method Summary
protected  MkTabEntry<D> createNewLeafEntry(DBID id, O object, D parentDistance)
          Creates a new leaf entry representing the specified data object in the specified subtree.
 boolean delete(DBID id)
          Throws an UnsupportedOperationException since deletion of objects is not yet supported by an M-Tree.
 void deleteAll(DBIDs ids)
          Throws an UnsupportedOperationException since deletion of objects is not yet supported by an M-Tree.
<S extends Distance<S>>
KNNQuery<O,S>
getKNNQuery(DistanceQuery<O,S> distanceQuery, Object... hints)
          Get a KNN query object for the given distance query and k.
 String getLongName()
          A "pretty" name for the result, for use in titles, captions and menus.
<S extends Distance<S>>
RangeQuery<O,S>
getRangeQuery(DistanceQuery<O,S> distanceQuery, Object... hints)
          Get a range query object for the given distance query and k.
<S extends Distance<S>>
RKNNQuery<O,S>
getRKNNQuery(DistanceQuery<O,S> distanceQuery, Object... hints)
          Get a KNN query object for the given distance query and k.
 String getShortName()
          A short name for the result, useful for file names.
 void insert(DBID id)
          Inserts the specified object into this index.
 void insertAll(DBIDs ids)
          Inserts the specified objects into this index.
private  List<D> knnDistances(O object)
          Returns the knn distance of the object with the specified id.
 
Methods inherited from class de.lmu.ifi.dbs.elki.index.tree.metrical.mtreevariants.mktrees.mktab.MkTabTree
createNewDirectoryEntry, createNewDirectoryNode, createNewLeafNode, createRootEntry, getLogger, initializeCapacities, insert, kNNdistanceAdjustment, preInsert, reverseKNNQuery
 
Methods inherited from class de.lmu.ifi.dbs.elki.index.tree.metrical.mtreevariants.mktrees.AbstractMkTreeUnified
createHeader, getKmax, insertAll
 
Methods inherited from class de.lmu.ifi.dbs.elki.index.tree.metrical.mtreevariants.AbstractMTree
batchNN, createEmptyRoot, distance, distance, doKNNQuery, getDistanceFactory, getDistanceFunction, getDistanceQuery, getHeight, getLeaves, getSortedEntries, getSortedEntries, toString
 
Methods inherited from class de.lmu.ifi.dbs.elki.index.tree.IndexTree
deleteNode, getFile, getNode, getNode, getPageFileStatistics, getPageID, getPageSize, getRoot, getRootEntry, getRootID, getRootPath, initialize, initialize, initializeFromFile, isRoot, postDelete, writeNode
 
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, wait, wait, wait
 
Methods inherited from interface de.lmu.ifi.dbs.elki.index.Index
getPageFileStatistics
 

Field Detail

knnQuery

private final KNNQuery<O,D extends Distance<D>> knnQuery
The knn query we use internally.


relation

private Relation<O> relation
The relation indexed.

Constructor Detail

MkTabTreeIndex

public MkTabTreeIndex(Relation<O> relation,
                      PageFile<MkTabTreeNode<O,D>> pagefile,
                      DistanceQuery<O,D> distanceQuery,
                      DistanceFunction<O,D> distanceFunction,
                      int k_max)
Constructor.

Parameters:
relation - Relation indexed
pagefile - Page file
distanceQuery - Distance query
distanceFunction - Distance function
k_max - Maximum value for k
Method Detail

createNewLeafEntry

protected MkTabEntry<D> createNewLeafEntry(DBID id,
                                           O object,
                                           D parentDistance)
Creates a new leaf entry representing the specified data object in the specified subtree.

Parameters:
object - the data object to be represented by the new entry
parentDistance - the distance from the object to the routing object of the parent node

knnDistances

private List<D> knnDistances(O object)
Returns the knn distance of the object with the specified id.

Parameters:
object - the query object
Returns:
the knn distance of the object with the specified id

insert

public void insert(DBID id)
Description copied from interface: Index
Inserts the specified object into this index.

Specified by:
insert in interface Index
Parameters:
id - the object to be inserted

insertAll

public void insertAll(DBIDs ids)
Description copied from interface: Index
Inserts the specified objects into this index. If a bulk load mode is implemented, the objects are inserted in one bulk.

Specified by:
insertAll in interface Index
Parameters:
ids - the objects to be inserted

delete

public final boolean delete(DBID id)
Throws an UnsupportedOperationException since deletion of objects is not yet supported by an M-Tree.

Specified by:
delete in interface Index
Parameters:
id - Object to remove
Returns:
true if this index did contain the object, false otherwise
Throws:
UnsupportedOperationException - thrown, since deletions aren't implemented yet.

deleteAll

public void deleteAll(DBIDs ids)
Throws an UnsupportedOperationException since deletion of objects is not yet supported by an M-Tree.

Specified by:
deleteAll in interface Index
Parameters:
ids - Objects to remove
Throws:
UnsupportedOperationException - thrown, since deletions aren't implemented yet.

getKNNQuery

public <S extends Distance<S>> KNNQuery<O,S> getKNNQuery(DistanceQuery<O,S> distanceQuery,
                                                         Object... hints)
Description copied from interface: KNNIndex
Get a KNN query object for the given distance query and k. This function MAY return null, when the given distance is not supported!

Specified by:
getKNNQuery in interface KNNIndex<O>
Type Parameters:
S - Distance type
Parameters:
distanceQuery - Distance query
hints - Hints for the optimizer
Returns:
KNN Query object or null

getRangeQuery

public <S extends Distance<S>> RangeQuery<O,S> getRangeQuery(DistanceQuery<O,S> distanceQuery,
                                                             Object... hints)
Description copied from interface: RangeIndex
Get a range query object for the given distance query and k. This function MAY return null, when the given distance is not supported!

Specified by:
getRangeQuery in interface RangeIndex<O>
Type Parameters:
S - Distance type
Parameters:
distanceQuery - Distance query
hints - Hints for the optimizer
Returns:
KNN Query object or null

getRKNNQuery

public <S extends Distance<S>> RKNNQuery<O,S> getRKNNQuery(DistanceQuery<O,S> distanceQuery,
                                                           Object... hints)
Description copied from interface: RKNNIndex
Get a KNN query object for the given distance query and k. This function MAY return null, when the given distance is not supported!

Specified by:
getRKNNQuery in interface RKNNIndex<O>
Type Parameters:
S - Distance type
Parameters:
distanceQuery - Distance query
hints - Hints for the optimizer
Returns:
KNN Query object or null

getLongName

public String getLongName()
Description copied from interface: Result
A "pretty" name for the result, for use in titles, captions and menus.

Specified by:
getLongName in interface Result
Returns:
result name

getShortName

public String getShortName()
Description copied from interface: Result
A short name for the result, useful for file names.

Specified by:
getShortName in interface Result
Returns:
result name

Release 0.4.0 (2011-09-20_1324)