N
- Node typeE
- Entry typepublic abstract class AbstractRStarTree<N extends AbstractRStarTreeNode<N,E>,E extends SpatialEntry,S extends RTreeSettings> extends SpatialIndexTree<N,E>
Modifier and Type | Class and Description |
---|---|
class |
AbstractRStarTree.Statistics
Class for tracking some statistics.
|
Modifier and Type | Field and Description |
---|---|
protected static boolean |
EXTRA_INTEGRITY_CHECKS
Development flag: This will enable some extra integrity checks on the tree.
|
protected int |
height
The height of this R*-Tree.
|
(package private) E |
lastInsertedEntry
The last inserted entry.
|
protected S |
settings
Settings class.
|
AbstractRStarTree.Statistics |
statistics
For counting the number of distance computations.
|
dirCapacity, dirMinimum, initialized, leafCapacity, leafMinimum
Constructor and Description |
---|
AbstractRStarTree(PageFile<N> pagefile,
S settings)
Constructor.
|
Modifier and Type | Method and Description |
---|---|
protected void |
adjustTree(IndexTreePath<E> subtree)
Adjusts the tree after insertion of some nodes.
|
protected abstract void |
bulkLoad(java.util.List<E> entries)
Performs a bulk load on this RTree with the specified data.
|
boolean |
canBulkLoad()
Test whether a bulk insert is still possible.
|
protected IndexTreePath<E> |
choosePath(IndexTreePath<E> subtree,
SpatialComparable mbr,
int depth,
int cur)
Chooses the best path of the specified subtree for insertion of the given
mbr at the specified level.
|
protected abstract int |
computeHeight()
Computes the height of this RTree.
|
private void |
condenseTree(IndexTreePath<E> subtree,
java.util.Stack<N> stack)
Condenses the tree after deletion of some nodes.
|
protected IndexTreePath<E> |
containedTest(IndexTreePath<E> subtree,
N node,
SpatialComparable mbr)
Test on whether or not any child of
node contains
mbr . |
protected java.util.List<E> |
createBulkLeafNodes(java.util.List<E> objects)
Creates and returns the leaf nodes for bulk load.
|
protected abstract E |
createNewDirectoryEntry(N node)
Creates a new directory entry representing the specified node.
|
protected IndexTreePath<E> |
createNewRoot(N oldRoot,
N newNode)
Creates a new root node that points to the two specified child nodes and
return the path to the new root.
|
protected void |
deletePath(IndexTreePath<E> deletionPath)
Delete a leaf at a given path - deletions for non-leaves are not supported!
|
void |
doExtraIntegrityChecks()
Perform additional integrity checks.
|
protected IndexTreePath<E> |
findPathToObject(IndexTreePath<E> subtree,
SpatialComparable mbr,
DBIDRef id)
Returns the path to the leaf entry in the specified subtree that represents
the data object with the specified mbr and id.
|
int |
getHeight()
Returns the height of this R*-Tree.
|
private void |
getLeafNodes(N node,
java.util.List<E> result,
int currentLevel)
Determines the entries pointing to the leaf nodes of the specified subtree.
|
java.util.List<E> |
getLeaves()
Returns a list of entries pointing to the leaf entries of this spatial
index.
|
protected abstract boolean |
hasOverflow(N node)
Returns true if in the specified node an overflow occurred, false
otherwise.
|
protected abstract boolean |
hasUnderflow(N node)
Returns true if in the specified node an underflow occurred, false
otherwise.
|
protected void |
initializeCapacities(E exampleLeaf)
Determines the maximum and minimum number of entries in a node.
|
void |
initializeFromFile(TreeIndexHeader header,
PageFile<N> file)
Initializes this R*-Tree from an existing persistent file.
|
protected void |
insertDirectoryEntry(E entry,
int depth)
Inserts the specified directory entry at the specified level into this
R*-Tree.
|
void |
insertLeaf(E leaf)
Add a new leaf entry to the tree.
|
protected void |
insertLeafEntry(E entry)
Inserts the specified leaf entry into this R*-Tree.
|
void |
logStatistics()
Log some statistics, if enabled.
|
private N |
overflowTreatment(N node,
IndexTreePath<E> path)
Treatment of overflow in the specified node: if the node is not the root
node and this is the first call of overflowTreatment in the given level
during insertion the specified node will be reinserted, otherwise the node
will be split.
|
void |
reInsert(N node,
IndexTreePath<E> path,
int[] offs)
Reinserts the specified node at the specified level.
|
protected void |
setHeight(int height)
Sets the height of this R*-Tree.
|
private N |
split(N node)
Splits the specified node and returns the newly created split node.
|
java.lang.String |
toString()
Returns a string representation of this R*-Tree.
|
createEmptyRoot, createHeader, createNewDirectoryNode, createNewLeafNode, createRootEntry, deleteNode, getDirMinimum, getFile, getLeafMinimum, getLogger, getNode, getNode, getPageID, getPageSize, getRoot, getRootEntry, getRootID, getRootPath, initialize, initialize, isRoot, postDelete, preInsert, writeNode
clone, equals, finalize, getClass, hashCode, notify, notifyAll, wait, wait, wait
getLongName, getShortName
protected static final boolean EXTRA_INTEGRITY_CHECKS
protected int height
public AbstractRStarTree.Statistics statistics
E extends SpatialEntry lastInsertedEntry
protected S extends RTreeSettings settings
protected IndexTreePath<E> findPathToObject(IndexTreePath<E> subtree, SpatialComparable mbr, DBIDRef id)
subtree
- the subtree to be testedmbr
- the mbr to look forid
- the id to look forpublic void insertLeaf(E leaf)
SpatialIndexTree
insertLeaf
in class SpatialIndexTree<N extends AbstractRStarTreeNode<N,E>,E extends SpatialEntry>
leaf
- Leaf entryprotected void insertLeafEntry(E entry)
entry
- the leaf entry to be insertedprotected void insertDirectoryEntry(E entry, int depth)
entry
- the directory entry to be inserteddepth
- the depth at which the directory entry is to be insertedprotected void deletePath(IndexTreePath<E> deletionPath)
deletionPath
- Path to deletepublic void initializeFromFile(TreeIndexHeader header, PageFile<N> file)
initializeFromFile
in class IndexTree<N extends AbstractRStarTreeNode<N,E>,E extends SpatialEntry>
header
- File headerfile
- Page fileprotected void initializeCapacities(E exampleLeaf)
IndexTree
initializeCapacities
in class IndexTree<N extends AbstractRStarTreeNode<N,E>,E extends SpatialEntry>
exampleLeaf
- an object that will be stored in the indexpublic boolean canBulkLoad()
protected java.util.List<E> createBulkLeafNodes(java.util.List<E> objects)
objects
- the objects to be insertedprotected abstract void bulkLoad(java.util.List<E> entries)
entries
- Entries to bulk loadpublic final int getHeight()
protected void setHeight(int height)
height
- the height to be setprotected abstract int computeHeight()
protected abstract boolean hasOverflow(N node)
node
- the node to be tested for overflowprotected abstract boolean hasUnderflow(N node)
node
- the node to be tested for underflowprotected abstract E createNewDirectoryEntry(N node)
node
- the node to be represented by the new entryprotected IndexTreePath<E> createNewRoot(N oldRoot, N newNode)
oldRoot
- the old root of this RTreenewNode
- the new split nodeprotected IndexTreePath<E> containedTest(IndexTreePath<E> subtree, N node, SpatialComparable mbr)
node
contains
mbr
. If there are several containing children, the child with
the minimum volume is chosen in order to get compact pages.node
- subtreembr
- MBR to test fornode
containing mbr
with the
minimum volume or null
if none existsprotected IndexTreePath<E> choosePath(IndexTreePath<E> subtree, SpatialComparable mbr, int depth, int cur)
subtree
- the subtree to be tested for insertionmbr
- the mbr to be inserteddepth
- Reinsertion depth, 1 indicates root levelcur
- Current depthprivate N overflowTreatment(N node, IndexTreePath<E> path)
node
- the node where an overflow occurredpath
- the path to the specified nodeprivate N split(N node)
node
- the node to be splitpublic void reInsert(N node, IndexTreePath<E> path, int[] offs)
node
- the node to be reinsertedpath
- the path to the nodeoffs
- the nodes indexes to reinsertprotected void adjustTree(IndexTreePath<E> subtree)
subtree
- the subtree to be adjustedprivate void condenseTree(IndexTreePath<E> subtree, java.util.Stack<N> stack)
subtree
- the subtree to be condensedstack
- the stack holding the nodes to be reinserted after the tree
has been condensedpublic final java.util.List<E> getLeaves()
SpatialIndexTree
getLeaves
in class SpatialIndexTree<N extends AbstractRStarTreeNode<N,E>,E extends SpatialEntry>
private void getLeafNodes(N node, java.util.List<E> result, int currentLevel)
node
- the subtreeresult
- the result to store the ids incurrentLevel
- the level of the node in the R-Treepublic void doExtraIntegrityChecks()
public void logStatistics()
IndexTree
logStatistics
in interface Index
logStatistics
in class IndexTree<N extends AbstractRStarTreeNode<N,E>,E extends SpatialEntry>
public java.lang.String toString()
toString
in class java.lang.Object
Copyright © 2019 ELKI Development Team. License information.