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
bucketSizeIn64intMultiplier of bucket size. Default is 1x64.
numInitialBucketsintInitial 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
indexint
Property Value
- T
Methods
Clear()
public void Clear()
CopyTo(T[], int)
public void CopyTo(T[] array, int arrayIndex)
Parameters
arrayT[]arrayIndexint
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
numElementsint
ExpandBuckets(int)
Expands the list by another numBuckets buckets.
public void ExpandBuckets(int numBuckets)
Parameters
numBucketsint
FindFreeIndex()
public int FindFreeIndex()
Returns
FreeElement(int)
Frees up the slot at elementIndex.
public bool FreeElement(int elementIndex)
Parameters
elementIndexint
Returns
GetIndexFlag(int)
public bool GetIndexFlag(int elementIndex)
Parameters
elementIndexint
Returns
GetRefOf(int)
Gets a reference to a T at index.
public ref T GetRefOf(int index)
Parameters
indexint
Returns
- T
HasFreeIndices()
public bool HasFreeIndices()
Returns
HasFreeIndicesInRegion(int)
public bool HasFreeIndicesInRegion(int elementIndex)
Parameters
elementIndexint
Returns
SetIndexFlag(int, bool)
public void SetIndexFlag(int elementIndex, bool value)