de.lmu.ifi.dbs.elki.index.tree.metrical.mtreevariants.mtree
Class MTreeIndex<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,MTreeNode<O,D>,MTreeEntry<D>>
              extended by de.lmu.ifi.dbs.elki.index.tree.metrical.mtreevariants.mtree.MTree<O,D>
                  extended by de.lmu.ifi.dbs.elki.index.tree.metrical.mtreevariants.mtree.MTreeIndex<O,D>
Type Parameters:
O - Object type
D - Distance type
All Implemented Interfaces:
Index, KNNIndex<O>, RangeIndex<O>, Result

public class MTreeIndex<O,D extends Distance<D>>
extends MTree<O,D>
implements RangeIndex<O>, KNNIndex<O>

Class for using an m-tree as database index.


Field Summary
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
MTreeIndex(Relation<O> relation, PageFile<MTreeNode<O,D>> pagefile, DistanceQuery<O,D> distanceQuery, DistanceFunction<O,D> distanceFunction)
          Constructor.
 
Method Summary
protected  MTreeEntry<D> createNewLeafEntry(DBID id, O object, D parentDistance)
           
 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.
 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.
 
Methods inherited from class de.lmu.ifi.dbs.elki.index.tree.metrical.mtreevariants.mtree.MTree
createNewDirectoryEntry, createNewDirectoryNode, createNewLeafNode, createRootEntry, getLogger, initializeCapacities, preInsert
 
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, insert, insertAll, toString
 
Methods inherited from class de.lmu.ifi.dbs.elki.index.tree.IndexTree
createHeader, 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

relation

private Relation<O> relation
The relation indexed.

Constructor Detail

MTreeIndex

public MTreeIndex(Relation<O> relation,
                  PageFile<MTreeNode<O,D>> pagefile,
                  DistanceQuery<O,D> distanceQuery,
                  DistanceFunction<O,D> distanceFunction)
Constructor.

Parameters:
relation - Relation indexed
pagefile - Page file
distanceQuery - Distance query
distanceFunction - Distance function
Method Detail

createNewLeafEntry

protected MTreeEntry<D> createNewLeafEntry(DBID id,
                                           O object,
                                           D parentDistance)
Returns:
a new MTreeLeafEntry representing the specified data object

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

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)