de.lmu.ifi.dbs.elki.index.tree.metrical.mtreevariants.mktrees.mkapp
Class MkAppTreeIndex<O,D extends NumberDistance<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,MkAppTreeNode<O,D>,MkAppEntry<D>>
                  extended by de.lmu.ifi.dbs.elki.index.tree.metrical.mtreevariants.mktrees.mkapp.MkAppTree<O,D>
                      extended by de.lmu.ifi.dbs.elki.index.tree.metrical.mtreevariants.mktrees.mkapp.MkAppTreeIndex<O,D>
Type Parameters:
O - Object type
D - Distance type
All Implemented Interfaces:
Index, KNNIndex<O>, RangeIndex<O>, RKNNIndex<O>, Result

public class MkAppTreeIndex<O,D extends NumberDistance<D,?>>
extends MkAppTree<O,D>
implements RangeIndex<O>, KNNIndex<O>, RKNNIndex<O>

MkAppTree used 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
MkAppTreeIndex(Relation<O> relation, PageFile<MkAppTreeNode<O,D>> pageFile, DistanceQuery<O,D> distanceQuery, DistanceFunction<O,D> distanceFunction, int k_max, int p, boolean log)
          Constructor.
 
Method Summary
protected  MkAppEntry<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.
 
Methods inherited from class de.lmu.ifi.dbs.elki.index.tree.metrical.mtreevariants.mktrees.mkapp.MkAppTree
createNewDirectoryEntry, createNewDirectoryNode, createNewLeafNode, createRootEntry, getK_max, getLogger, initializeCapacities, insert, insertAll, preInsert, reverseKNNQuery
 
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
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

MkAppTreeIndex

public MkAppTreeIndex(Relation<O> relation,
                      PageFile<MkAppTreeNode<O,D>> pageFile,
                      DistanceQuery<O,D> distanceQuery,
                      DistanceFunction<O,D> distanceFunction,
                      int k_max,
                      int p,
                      boolean log)
Constructor.

Parameters:
relation - Relation to index
pageFile - Page file
distanceQuery - Distance query
distanceFunction - Distance function
k_max - Maximum value of k supported
p - Parameter p
log - Logspace flag
Method Detail

createNewLeafEntry

protected MkAppEntry<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

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)