Package ghidra.util.database.spatial
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 ClassesModifier and TypeClassDescriptionprotected classprotected classprotected static classNested classes/interfaces inherited from class ghidra.util.database.spatial.AbstractConstraintsTree
AbstractConstraintsTree.TreeRecordVisitor, AbstractConstraintsTree.VisitResult -
Field Summary
FieldsModifier and TypeFieldDescriptionprotected static final intprotected static final doubleprotected static final intprotected final intprotected final intprotected static final doubleprotected final intFields inherited from class ghidra.util.database.spatial.AbstractConstraintsTree
cachedDataChildren, cachedNodeChildren, dataStore, leafLevel, nodeStore, root -
Constructor Summary
ConstructorsConstructorDescriptionAbstractRStarConstraintsTree(DBCachedObjectStoreFactory storeFactory, String tableName, Class<DR> dataType, Class<NR> nodeType, boolean upgradable, int maxChildren) -
Method Summary
Modifier 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 dstLevel, NS bounds) The ChooseSubtree algorithm as defined in Section 4.1 of the paper.protected voiddoInsert(DBTreeRecord<?, ? extends NS> entry, AbstractRStarConstraintsTree.LevelInfo levelInfo) protected 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>> Methods inherited from class ghidra.util.database.spatial.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, unionStream, visit, visit, visitAllData
-
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
The ChooseSubtree algorithm as defined in Section 4.1 of the paper.- Parameters:
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
For ChooseSubTree, the part which chooses a leaf node using the minimum area enlargement cost.- Parameters:
n-bounds-- Returns:
-
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
The Split algorithm as defined in Section 4.2 of the paper.- Parameters:
n- the node to split- Returns:
- the new node (containing the second group)
-
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) -
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
-