Class SlotBucketry<T>
Expandable array of reusable element slots. Superfast deletion, fast insertion. Don't ask why I called it bucketry of all things.
public class SlotBucketry<T> where T : new()
Type Parameters
T
- Inheritance
-
SlotBucketry<T>
- Inherited Members
Constructors
SlotBucketry(int, int)
Creates a new SlotBucketry<T>.
public SlotBucketry(int bucketSizeIn64 = 1, int numInitialBuckets = 1)
Parameters
bucketSizeIn64
intMultiplier of bucket size. Default is 1x64.
numInitialBuckets
intInitial amount of buckets.
Properties
Buckets
How many buckets are currently allocated?
public int Buckets { get; }
Property Value
ElementsPerBucket
How many elements are allocated per "bucket".
public int ElementsPerBucket { get; }
Property Value
InternalArray
Provide the RAW ARRAY ITSELF because List<T> doesn't do that for some reason and yet it's very useful >:(
public T[] InternalArray { get; }
Property Value
- T[]
this[int]
public T this[int index] { get; set; }
Parameters
index
int
Property Value
- T
Methods
Clear()
public void Clear()
CopyTo(T[], int)
public void CopyTo(T[] array, int arrayIndex)
Parameters
array
T[]arrayIndex
int
CreateElement()
Creates a new T
at the next free slot
and returns a reference to it.
public ref T CreateElement()
Returns
- T
Expand(int)
Expands the list to support another numElements
elements.
public void Expand(int numElements)
Parameters
numElements
int
ExpandBuckets(int)
Expands the list by another numBuckets
buckets.
public void ExpandBuckets(int numBuckets)
Parameters
numBuckets
int
FindFreeIndex()
public int FindFreeIndex()
Returns
FreeElement(int)
Frees up the slot at elementIndex
.
public bool FreeElement(int elementIndex)
Parameters
elementIndex
int
Returns
GetIndexFlag(int)
public bool GetIndexFlag(int elementIndex)
Parameters
elementIndex
int
Returns
GetRefOf(int)
Gets a reference to a T
at index
.
public ref T GetRefOf(int index)
Parameters
index
int
Returns
- T
HasFreeIndices()
public bool HasFreeIndices()
Returns
HasFreeIndicesInRegion(int)
public bool HasFreeIndicesInRegion(int elementIndex)
Parameters
elementIndex
int
Returns
SetIndexFlag(int, bool)
public void SetIndexFlag(int elementIndex, bool value)