Class MemBlockSet
java.lang.Object
java.util.AbstractCollection<E>
java.util.AbstractSet<BlockVector3>
com.sk89q.worldedit.regions.AbstractRegion
com.fastasyncworldedit.core.util.collection.BlockSet
com.fastasyncworldedit.core.util.collection.MemBlockSet
- All Implemented Interfaces:
IBatchProcessor
,Region
,Cloneable
,Iterable<BlockVector3>
,Collection<BlockVector3>
,Set<BlockVector3>
Memory optimized BlockVector3 Set using a sparsely populated bitset and grouped by chunk section
Note on spaghetti code / duplication
- Uses a minimum of 1 bit per entry
- 99.9% of the time there are no if checks on get/clear
- Grouping / iteration is by chunk section, and the y>z>x order
-
Nested Class Summary
Modifier and TypeClassDescriptionstatic interface
static interface
static final class
static final class
static final class
static final class
static final class
static final class
-
Field Summary
Modifier and TypeFieldDescriptionstatic final int
final MutableBlockVector3
static final MemBlockSet.IRow
static final MemBlockSet.IRow
static final MemBlockSet.IRow
final MemBlockSet.IRow[]
static final int
Fields inherited from class com.sk89q.worldedit.regions.AbstractRegion
world
-
Constructor Summary
ConstructorDescriptionMemBlockSet
(int size, int offsetX, int offsetZ, int minSectionPosition, int maxSectionPosition) -
Method Summary
Modifier and TypeMethodDescriptionboolean
add
(int x, int y, int z) void
clear()
void
clear
(int x, int y, int z) boolean
contains
(int x, int y, int z) Return a list of 16*16*16 chunks in a region.Get a list of chunks.Get the upper point of a region.int
int
getMaxX()
int
getMaxZ()
Get the lower point of a region.int
int
getMinX()
int
getMinZ()
boolean
isEmpty()
void
iterate
(MemBlockSet.BlockIterator iterator) iterator()
Get the iterator.boolean
remove
(int x, int y, int z) void
set
(int x, int y, int z) int
size()
long
sizeLong()
Methods inherited from class com.fastasyncworldedit.core.util.collection.BlockSet
add, contains, contains, contract, expand, getBlockOffsetX, getBlockOffsetZ, getChunkOffsetX, getChunkOffsetZ, highestBit, isGlobal, lowestBit, remove, remove
Methods inherited from class com.sk89q.worldedit.regions.AbstractRegion
clone, equals, getCenter, getHeight, getLength, getVolume, getWidth, getWorld, getWorldMaxY, getWorldMinY, hashCode, polygonize, setWorld, shift
Methods inherited from class java.util.AbstractSet
removeAll
Methods inherited from class java.util.AbstractCollection
addAll, containsAll, retainAll, toArray, toArray, toString
Methods inherited from class java.lang.Object
finalize, getClass, notify, notifyAll, wait, wait, wait
Methods inherited from interface java.util.Collection
parallelStream, removeIf, stream, toArray
Methods inherited from interface com.fastasyncworldedit.core.queue.IBatchProcessor
flush, join, joinPost, postProcess, postProcessSet, processGet, remove, trimNBT, trimY
Methods inherited from interface com.sk89q.worldedit.regions.Region
construct, contains, containsChunk, containsEntireCuboid, filter, filter, filter, filter, filter, getArea, getDimensions, getScope, processSet, processSet
Methods inherited from interface java.util.Set
addAll, containsAll, retainAll, spliterator, toArray, toArray
-
Field Details
-
BITS_PER_WORD
public static final int BITS_PER_WORD- See Also:
-
WORDS
public static final int WORDS -
NULL_ROW_X
-
NULL_ROW_Z
-
NULL_ROW_Y
-
rows
-
mutable
-
-
Constructor Details
-
MemBlockSet
public MemBlockSet(int size, int offsetX, int offsetZ, int minSectionPosition, int maxSectionPosition)
-
-
Method Details
-
contains
public boolean contains(int x, int y, int z) -
add
public boolean add(int x, int y, int z) -
set
public void set(int x, int y, int z) -
clear
public void clear(int x, int y, int z) -
remove
public boolean remove(int x, int y, int z) -
getMinimumPoint
Description copied from interface:Region
Get the lower point of a region.- Returns:
- min. point
-
getMaximumPoint
Description copied from interface:Region
Get the upper point of a region.- Returns:
- max. point
-
getChunks
Description copied from class:AbstractRegion
Get a list of chunks. -
getChunkCubes
Description copied from interface:Region
Return a list of 16*16*16 chunks in a region.- Specified by:
getChunkCubes
in interfaceRegion
- Specified by:
getChunkCubes
in classBlockSet
- Returns:
- the chunk cubes this region overlaps with
-
getMinimumY
public int getMinimumY() -
getMaximumY
public int getMaximumY() -
getMaxZ
public int getMaxZ() -
getMaxX
public int getMaxX() -
getMinZ
public int getMinZ() -
getMinX
public int getMinX() -
iterate
-
iterator
Description copied from class:AbstractRegion
Get the iterator.- Specified by:
iterator
in interfaceCollection<BlockVector3>
- Specified by:
iterator
in interfaceIterable<BlockVector3>
- Specified by:
iterator
in interfaceSet<BlockVector3>
- Specified by:
iterator
in classBlockSet
- Returns:
- iterator of points inside the region
-
isEmpty
public boolean isEmpty()- Specified by:
isEmpty
in interfaceCollection<BlockVector3>
- Specified by:
isEmpty
in interfaceSet<BlockVector3>
- Overrides:
isEmpty
in classAbstractCollection<BlockVector3>
-
size
public int size()- Specified by:
size
in interfaceCollection<BlockVector3>
- Specified by:
size
in interfaceSet<BlockVector3>
- Overrides:
size
in classAbstractRegion
-
sizeLong
public long sizeLong() -
clear
public void clear()- Specified by:
clear
in interfaceCollection<BlockVector3>
- Specified by:
clear
in interfaceSet<BlockVector3>
- Overrides:
clear
in classAbstractCollection<BlockVector3>
-