Class AbstractRStarConstraintsTree<DS extends BoundedShape<NS>, DR extends DBTreeDataRecord<DS,NS,T>, NS extends BoundingShape<NS>, NR extends DBTreeNodeRecord<NS>, T, Q extends Query<DS,NS>>
java.lang.Object
ghidra.util.database.spatial.AbstractConstraintsTree<DS,DR,NS,NR,T,Q>
ghidra.util.database.spatial.AbstractRStarConstraintsTree<DS,DR,NS,NR,T,Q>
- Type Parameters:
DS- The shape of each data entryDR- The record type for each data entryNS- The shape of each nodeNR- The record type for each nodeT- The type of value stored in a data entryQ- The type of supported queries
- Direct Known Subclasses:
Abstract2DRStarTree, AbstractHyperRStarTree
public abstract class AbstractRStarConstraintsTree<DS extends BoundedShape<NS>, DR extends DBTreeDataRecord<DS,NS,T>, NS extends BoundingShape<NS>, NR extends DBTreeNodeRecord<NS>, T, Q extends Query<DS,NS>>
extends AbstractConstraintsTree<DS,DR,NS,NR,T,Q>
An R*-Tree implementation of
AbstractConstraintsTree
The implementation follows The R*-tree: An Efficient and Robust Access Method for Points and Rectangles. Comments in code referring to "the paper", specific sections, or steps of algorithms, are referring specifically to that paper.
-
Nested Class Summary
Nested ClassesChangeModifier and TypeClassDescriptionprotected classprotected classprotected classprotected static classprotected static classNested classes/interfaces inherited from class AbstractConstraintsTree
AbstractConstraintsTree.TreeRecordVisitor, AbstractConstraintsTree.VisitResult -
Field Summary
FieldsChangeModifier and TypeFieldDescriptionprotected static final intprotected static final doubleprotected static final intprotected final intprotected final intprotected static final doubleprotected final intFields inherited from class AbstractConstraintsTree
cachedDataChildren, cachedNodeChildren, dataStore, leafLevel, nodeStore, root -
Constructor Summary
ConstructorsChangeConstructorDescriptionAbstractRStarConstraintsTree(DBCachedObjectStoreFactory storeFactory, String tableName, Class<DR> dataType, Class<NR> nodeType, boolean upgradable, int maxChildren) -
Method Summary
ChangeModifier and TypeMethodDescriptionprotected voidCheck the integrity of a single node entry.protected doublecomputeOverlap(NS n, Iterable<NR> all, NR ignore) Computes the overlap of a bounding shape (with respect to its siblings)protected Comparator<NS> doChooseSplitAxis(List<DBTreeRecord<?, ? extends NS>> children) protected intdoChooseSplitIndex(List<DBTreeRecord<?, ? extends NS>> children, Comparator<NS> axis) protected NRdoChooseSubtree(int dstLevelFromTop, NS bounds) The ChooseSubtree algorithm as defined in Section 4.1 of the paper.protected voiddoInsert(DBTreeRecord<?, ? extends NS> entry, AbstractRStarConstraintsTree.LevelInfo levelInfo) Insert an entry (data or node) into the tree at the given levelprotected DRdoInsertData(DS shape, T value) protected NRdoOverflowTreatment(NR n, AbstractRStarConstraintsTree.LevelInfo levelInfo) protected voiddoReInsert(NR n, AbstractRStarConstraintsTree.LevelInfo levelInfo) protected NRThe Split algorithm as defined in Section 4.2 of the paper.protected NRfindChildByMinimumEnlargementCost(NR n, NS bounds) For ChooseSubTree, the part which chooses a leaf node using the minimum area enlargement cost.protected NRfindChildByNearlyMinimumOverlapCost(NR n, NS bounds) For ChooseSubtree, the part which chooses a leaf node using the nearly minimum overlap enlargement cost as defined in Section 4.1 of the paper, at the bottom of page 325.protected abstract List<Comparator<NS>> protected NRCreate a new node with the two given nodes.Methods inherited from class AbstractConstraintsTree
asSpatialMap, checkDataIntegrity, checkIntegrity, clear, computeLeafLevel, count, createDataEntry, createNodeEntry, destroySubtree, doAddToCachedChildren, doDecrementDataCount, doDeleteEntry, doFindExact, doRecomputeBounds, doRemoveData, doRemoveFromCachedChildren, doSetParentKey, doUnparentEntry, doUpdateOrDeleteAlongPath, dump, first, getChildrenOf, getDataByKey, getDataChildrenOf, getDataChildrenOf, getDefaultBoundsComparator, getNodeChildrenOf, getNodeChildrenOf, getOrCreateRoot, getParentOf, getUserIndex, init, invalidateCache, isEmpty, iterator, iterator, orderedIterator, resyncMetadata, stream, unionStream, visit, visit, visitAllData, visitDirectory, visitLeaf
-
Field Details
-
MAX_LEVELS
protected static final int MAX_LEVELS- See Also:
-
FILL_RATE
protected static final double FILL_RATE- See Also:
-
REINSERT_RATE
protected static final double REINSERT_RATE- See Also:
-
CHEAT_OVERLAP_COUNT
protected static final int CHEAT_OVERLAP_COUNT- See Also:
-
maxChildren
protected final int maxChildren -
minChildren
protected final int minChildren -
reinsertCount
protected final int reinsertCount
-
-
Constructor Details
-
AbstractRStarConstraintsTree
public AbstractRStarConstraintsTree(DBCachedObjectStoreFactory storeFactory, String tableName, Class<DR> dataType, Class<NR> nodeType, boolean upgradable, int maxChildren) throws VersionException, IOException - Throws:
VersionExceptionIOException
-
-
Method Details
-
getSplitAxes
-
doChooseSubtree MODIFIED
param 1 renamed: dstLevel → dstLevelFromTop-NR doChooseSubtree(int dstLevel, NS bounds)+NR doChooseSubtree(int dstLevelFromTop, NS bounds)The ChooseSubtree algorithm as defined in Section 4.1 of the paper.- Parameters:
dstLevelFromTop(was: dstLevel) - the level of the node to choosebounds- the bounds of the object being inserted- Returns:
- the leaf node into which the object should be inserted
-
findChildByMinimumEnlargementCost
-
findChildByNearlyMinimumOverlapCost
For ChooseSubtree, the part which chooses a leaf node using the nearly minimum overlap enlargement cost as defined in Section 4.1 of the paper, at the bottom of page 325.Ties are resolved using the minimum area enlargement cost.
- Parameters:
n- the node whose children are leaf nodesbounds- the bounds of the object being inserted- Returns:
- the leaf node into which the object should be inserted
-
computeOverlap
Computes the overlap of a bounding shape (with respect to its siblings)This measure is defined in Section 4.1 of the paper.
- Parameters:
n- the shape to measureall- the sibling nodes (may containn, which is ignored)ignore- the node whose shape is being considered- Returns:
- the overlap measure
-
doSplit
-
doChooseSplitAxis
-
doChooseSplitIndex
-
doInsertData
- Specified by:
doInsertDatain classAbstractConstraintsTree<DS extends BoundedShape<NS>, DR extends DBTreeDataRecord<DS,NS, T>, NS extends BoundingShape<NS>, NR extends DBTreeNodeRecord<NS>, T, Q extends Query<DS, NS>>
-
doInsert
protected void doInsert(DBTreeRecord<?, ? extends NS> entry, AbstractRStarConstraintsTree.LevelInfo levelInfo) Insert an entry (data or node) into the tree at the given level- Parameters:
entry- the entry to insert
-
reRoot NEW
Create a new node with the two given nodes.One of the nodes, probably n1 must be the root node. The other must be the node which resulted from splitting the root node.
- Parameters:
n1- the current root noden2- the node resulting from splitting the current root node- Returns:
- the parent node, which must become the new root node
-
doOverflowTreatment
-
doReInsert
-
checkNodeIntegrity
Description copied from class:AbstractConstraintsTreeCheck the integrity of a single node entry.This method is for tree developers and testers. Override this method if you have additional integrity checks.
- Overrides:
checkNodeIntegrityin classAbstractConstraintsTree<DS extends BoundedShape<NS>, DR extends DBTreeDataRecord<DS,NS, T>, NS extends BoundingShape<NS>, NR extends DBTreeNodeRecord<NS>, T, Q extends Query<DS, NS>> - Parameters:
n- the entry to check
-