O
- the type of DatabaseObject to be stored in the metrical indexN
- the type of MetricalNode used in the metrical indexE
- the type of MetricalEntry used in the metrical indexS
- the type to store settings in.public abstract class AbstractMTree<O,N extends AbstractMTreeNode<O,N,E>,E extends MTreeEntry,S extends MTreeSettings<O,N,E>> extends MetricalIndexTree<O,N,E>
Modifier and Type | Class and Description |
---|---|
class |
AbstractMTree.Statistics
Class for tracking some statistics.
|
Modifier and Type | Field and Description |
---|---|
protected static boolean |
EXTRA_INTEGRITY_CHECKS
Debugging flag: do extra integrity checks.
|
protected S |
settings
Tree settings.
|
AbstractMTree.Statistics |
statistics
For counting the number of distance computations.
|
dirCapacity, dirMinimum, initialized, leafCapacity, leafMinimum
Constructor and Description |
---|
AbstractMTree(PageFile<N> pagefile,
S settings)
Constructor.
|
Modifier and Type | Method and Description |
---|---|
private void |
adjustTree(IndexTreePath<E> subtree)
Adjusts the tree after insertion of some nodes.
|
protected void |
createEmptyRoot(E exampleLeaf)
Creates an empty root node and writes it to file.
|
protected abstract E |
createNewDirectoryEntry(N node,
DBID routingObjectID,
double parentDistance)
Creates a new directory entry representing the specified node.
|
private IndexTreePath<E> |
createNewRoot(N oldRoot,
N newNode,
DBID firstRoutingObjectID,
DBID secondRoutingObjectID)
Creates a new root node that points to the two specified child nodes and
return the path to the new root.
|
abstract double |
distance(DBIDRef id1,
DBIDRef id2)
Returns the distance between the two specified ids.
|
double |
distance(E e1,
E e2)
Returns the distance between the routing object of two entries.
|
DistanceFunction<? super O> |
getDistanceFunction()
Returns the distance function of this metrical index.
|
int |
getHeight()
FIXME: expensive depth computation by following a path.
|
List<E> |
getLeaves()
Returns a list of entries pointing to the leaf nodes of this spatial index.
|
protected List<DoubleIntPair> |
getSortedEntries(N node,
DBID q)
Sorts the entries of the specified node according to their minimum distance
to the specified object.
|
private boolean |
hasOverflow(N node)
Returns true if in the specified node an overflow has occurred, false
otherwise.
|
void |
insert(E entry,
boolean withPreInsert)
Inserts the specified object into this M-Tree.
|
void |
insertAll(List<E> entries)
Bulk insert.
|
void |
logStatistics()
Log some statistics, if enabled.
|
String |
toString()
Returns a string representation of this M-Tree by performing a breadth
first enumeration on the tree and adding the string representation of the
visited nodes and their entries to the result.
|
createHeader, createNewDirectoryNode, createNewLeafNode, createRootEntry, deleteNode, getFile, getLogger, getNode, getNode, getPageID, getPageSize, getRoot, getRootEntry, getRootID, getRootPath, initialize, initialize, initializeCapacities, initializeFromFile, isRoot, postDelete, preInsert, writeNode
clone, equals, finalize, getClass, hashCode, notify, notifyAll, wait, wait, wait
getLongName, getShortName
protected static final boolean EXTRA_INTEGRITY_CHECKS
protected S extends MTreeSettings<O,N,E> settings
public AbstractMTree.Statistics statistics
public final DistanceFunction<? super O> getDistanceFunction()
MetricalIndexTree
getDistanceFunction
in class MetricalIndexTree<O,N extends AbstractMTreeNode<O,N,E>,E extends MTreeEntry>
public String toString()
public void insert(E entry, boolean withPreInsert)
entry
- the entry to be insertedwithPreInsert
- if this flag is true, the preInsert method will be
called before inserting the objectpublic void insertAll(List<E> entries)
entries
- Entries to insertprotected final void createEmptyRoot(E exampleLeaf)
IndexTree
createEmptyRoot
in class IndexTree<N extends AbstractMTreeNode<O,N,E>,E extends MTreeEntry>
exampleLeaf
- an object that will be stored in the indexprotected final List<DoubleIntPair> getSortedEntries(N node, DBID q)
node
- the nodeq
- the id of the objectpublic abstract double distance(DBIDRef id1, DBIDRef id2)
id1
- the first idid2
- the second idpublic final double distance(E e1, E e2)
e1
- First entrye2
- Second entryprotected abstract E createNewDirectoryEntry(N node, DBID routingObjectID, double parentDistance)
node
- the node to be represented by the new entryroutingObjectID
- the id of the routing object of the nodeparentDistance
- the distance from the routing object of the node to
the routing object of the parent nodeprivate void adjustTree(IndexTreePath<E> subtree)
subtree
- the subtree to be adjustedprivate boolean hasOverflow(N node)
node
- the node to be tested for overflowprivate IndexTreePath<E> createNewRoot(N oldRoot, N newNode, DBID firstRoutingObjectID, DBID secondRoutingObjectID)
oldRoot
- the old root of this RTreenewNode
- the new split nodefirstRoutingObjectID
- the id of the routing objects of the first
child nodesecondRoutingObjectID
- the id of the routing objects of the second
child nodepublic List<E> getLeaves()
MetricalIndexTree
getLeaves
in class MetricalIndexTree<O,N extends AbstractMTreeNode<O,N,E>,E extends MTreeEntry>
public int getHeight()
public void logStatistics()
IndexTree
logStatistics
in interface Index
logStatistics
in class IndexTree<N extends AbstractMTreeNode<O,N,E>,E extends MTreeEntry>
Copyright © 2015 ELKI Development Team, Lehr- und Forschungseinheit für Datenbanksysteme, Ludwig-Maximilians-Universität München. License information.