Class PriorityRTreeIndex
java.lang.Object
com.sk89q.worldguard.protection.managers.index.HashMapIndex
com.sk89q.worldguard.protection.managers.index.PriorityRTreeIndex
- All Implemented Interfaces:
ConcurrentRegionIndex,RegionIndex,ChangeTracked
An implementation of an index that uses
HashMapIndex for queries
by region name and a priority R-tree for spatial queries.
At the moment, the R-tree is only utilized for the
applyContaining(BlockVector3, Predicate) method, and the underlying
hash map-based index is used for the other spatial queries. In addition,
every modification to the index requires the entire R-tree to be rebuilt,
although this operation is reasonably quick.
This implementation is as thread-safe as the underlying
HashMapIndex, although spatial queries may lag behind changes
for very brief periods of time as the tree is rebuilt.
-
Nested Class Summary
Nested ClassesModifier and TypeClassDescriptionstatic classA factory for new instances using this index. -
Constructor Summary
Constructors -
Method Summary
Modifier and TypeMethodDescriptionvoidapplyContaining(com.sk89q.worldedit.math.BlockVector3 position, Predicate<ProtectedRegion> consumer)Apply the given predicate to all regions that contain the given position until there are no more regions or the predicate returns false.voidapplyIntersecting(ProtectedRegion region, Predicate<ProtectedRegion> consumer)Apply the given predicate to all regions that intersect the given region until there are no more regions or the predicate returns false.protected voidCalled to rebuild the index after changes.
-
Constructor Details
-
PriorityRTreeIndex
public PriorityRTreeIndex()
-
-
Method Details
-
rebuildIndex
protected void rebuildIndex()Description copied from class:HashMapIndexCalled to rebuild the index after changes.- Overrides:
rebuildIndexin classHashMapIndex
-
applyContaining
public void applyContaining(com.sk89q.worldedit.math.BlockVector3 position, Predicate<ProtectedRegion> consumer)Description copied from interface:RegionIndexApply the given predicate to all regions that contain the given position until there are no more regions or the predicate returns false.- Specified by:
applyContainingin interfaceRegionIndex- Overrides:
applyContainingin classHashMapIndex- Parameters:
position- the positionconsumer- a predicate that returns true to continue iterating
-
applyIntersecting
Description copied from interface:RegionIndexApply the given predicate to all regions that intersect the given region until there are no more regions or the predicate returns false.- Specified by:
applyIntersectingin interfaceRegionIndex- Overrides:
applyIntersectingin classHashMapIndex- Parameters:
region- the intersecting regionconsumer- a predicate that returns true to continue iterating
-