public interface RegionIndex extends ChangeTracked
Indexes may be thread-unsafe.
| Modifier and Type | Method and Description |
|---|---|
void |
add(ProtectedRegion region)
Add a region to this index, replacing any existing one with the same
name (equality determined using
Normal). |
void |
addAll(Collection<ProtectedRegion> regions)
Add a list of regions to this index, replacing any existing one
with the same name (equality determined using
Normal). |
void |
apply(com.google.common.base.Predicate<ProtectedRegion> consumer)
Apply the given predicate to all the regions in the index
until there are no more regions or the predicate returns false.
|
void |
applyContaining(com.sk89q.worldedit.Vector position,
com.google.common.base.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,
com.google.common.base.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.
|
void |
bias(com.sk89q.worldedit.Vector2D chunkPosition)
Bias the given chunk for faster lookups (put it in a hash table, etc.).
|
void |
biasAll(Collection<com.sk89q.worldedit.Vector2D> chunkPosition)
Bias the given chunk for faster lookups (put it in a hash table, etc.).
|
boolean |
contains(String id)
Test whether the index contains a region named by the given name
(equality determined using
Normal). |
void |
forget(com.sk89q.worldedit.Vector2D chunkPosition)
No longer bias the given chunk for faster lookup.
|
void |
forgetAll()
Clearly all extra cache data created by any calls to
bias(Vector2D). |
ProtectedRegion |
get(String id)
Get the region named by the given name (equality determined using
Normal). |
RegionDifference |
getAndClearDifference()
Get the list of changed or removed regions since last call and
clear those lists.
|
Set<ProtectedRegion> |
remove(String id,
RemovalStrategy strategy)
Remove a region from the index with the given name.
|
void |
setDirty(RegionDifference difference)
Set the index to be dirty using the given difference.
|
int |
size()
Return the number of regions in the index.
|
Collection<ProtectedRegion> |
values()
Get an unmodifiable collection of regions stored in this index.
|
isDirty, setDirtyvoid bias(com.sk89q.worldedit.Vector2D chunkPosition)
Implementations may choose to do nothing.
chunkPosition - the chunk positionvoid biasAll(Collection<com.sk89q.worldedit.Vector2D> chunkPosition)
Implementations may choose to do nothing.
chunkPosition - the chunk positionvoid forget(com.sk89q.worldedit.Vector2D chunkPosition)
chunkPosition - the chunk positionvoid forgetAll()
bias(Vector2D).void add(ProtectedRegion region)
Normal).
The parents of the region will also be added to the index.
region - the regionvoid addAll(Collection<ProtectedRegion> regions)
Normal).
The parents of the region will also be added to the index.
regions - a collections of regionsSet<ProtectedRegion> remove(String id, RemovalStrategy strategy)
id - the name of the regionstrategy - what to do with childrenidboolean contains(String id)
Normal).id - the name of the region@Nullable ProtectedRegion get(String id)
Normal).id - the name of the regionnullvoid apply(com.google.common.base.Predicate<ProtectedRegion> consumer)
consumer - a predicate that returns true to continue iteratingvoid applyContaining(com.sk89q.worldedit.Vector position,
com.google.common.base.Predicate<ProtectedRegion> consumer)
position - the positionconsumer - a predicate that returns true to continue iteratingvoid applyIntersecting(ProtectedRegion region, com.google.common.base.Predicate<ProtectedRegion> consumer)
region - the intersecting regionconsumer - a predicate that returns true to continue iteratingint size()
RegionDifference getAndClearDifference()
void setDirty(RegionDifference difference)
difference - the differenceCollection<ProtectedRegion> values()
Copyright © 2015. All Rights Reserved.