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 final class
A factory for new instances using this index. -
Constructor Summary
Constructors -
Method Summary
Modifier and TypeMethodDescriptionvoid
applyContaining
(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.void
applyIntersecting
(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 void
Called to rebuild the index after changes.
-
Constructor Details
-
PriorityRTreeIndex
public PriorityRTreeIndex()
-
-
Method Details
-
rebuildIndex
protected void rebuildIndex()Description copied from class:HashMapIndex
Called to rebuild the index after changes.- Overrides:
rebuildIndex
in classHashMapIndex
-
applyContaining
public void applyContaining(com.sk89q.worldedit.math.BlockVector3 position, Predicate<ProtectedRegion> consumer) Description copied from interface:RegionIndex
Apply the given predicate to all regions that contain the given position until there are no more regions or the predicate returns false.- Specified by:
applyContaining
in interfaceRegionIndex
- Overrides:
applyContaining
in classHashMapIndex
- Parameters:
position
- the positionconsumer
- a predicate that returns true to continue iterating
-
applyIntersecting
Description copied from interface:RegionIndex
Apply the given predicate to all regions that intersect the given region until there are no more regions or the predicate returns false.- Specified by:
applyIntersecting
in interfaceRegionIndex
- Overrides:
applyIntersecting
in classHashMapIndex
- Parameters:
region
- the intersecting regionconsumer
- a predicate that returns true to continue iterating
-