java.lang.Object
net.paulem.arcana.regions.container.blocks.ArraySectionContainer<S,K>
- Type Parameters:
S- the type of tracked objects, which must implement theTrackedinterfaceK- the type of the key associated with the tracked object
- All Implemented Interfaces:
SectionContainer<S,K>
public class ArraySectionContainer<S extends Tracked<K>,K extends WorldKey>
extends Object
implements SectionContainer<S,K>
A fixed-size
SectionContainer implementation backed by a plain array, indexed
directly by position. Offers O(1) access at the cost of always allocating the full
capacity upfront, regardless of how many positions are actually occupied.-
Method Summary
Modifier and TypeMethodDescriptionstatic <S extends Tracked<K>,K extends WorldKey>
ArraySectionContainer<S, K> create(int size) Creates a new, emptyArraySectionContainerwith the given fixed capacity.get(int position) Retrieves the holder stored at the given position.getAll()Builds a map of every occupied position to its holder.booleanisEmpty()voidStores or clears the holder at the given position, updating the tracked size accordingly.intsize()Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, waitMethods inherited from interface net.paulem.arcana.regions.container.blocks.SectionContainer
copyTo
-
Method Details
-
create
public static <S extends Tracked<K>,K extends WorldKey> ArraySectionContainer<S,K> create(int size) Creates a new, emptyArraySectionContainerwith the given fixed capacity.- Type Parameters:
S- the type of tracked objectsK- the type of the key associated with the tracked object- Parameters:
size- the number of positions this container can hold- Returns:
- a new
ArraySectionContainerinstance
-
get
Retrieves the holder stored at the given position. -
set
Stores or clears the holder at the given position, updating the tracked size accordingly. -
getAll
Builds a map of every occupied position to its holder. -
size
public int size() -
isEmpty
public boolean isEmpty()
-