Struct SimpleList<T>
An optimized System.Collections.Generic.List<T>-like data structure.
Namespace: GDX.Collections.Generic
Syntax
[VisualScriptingCompatible((short)1)]
public struct SimpleList<T>
Type Parameters
Name | Description |
---|---|
T | The type of the System.Objects contained within. |
Constructors
| Improve this Doc View SourceSimpleList(T[])
Create a SimpleList<T> providing an existing arrayToUse
.
Declaration
public SimpleList(T[] arrayToUse)
Parameters
Type | Name | Description |
---|---|---|
T[] | arrayToUse | An existing array to use in the SimpleList<T>. |
SimpleList(T[], Int32)
Create a SimpleList<T> providing an existing arrayToUse
and setting the
Count.
Declaration
public SimpleList(T[] arrayToUse, int count)
Parameters
Type | Name | Description |
---|---|---|
T[] | arrayToUse | An existing array to use in the SimpleList<T>. |
System.Int32 | count | An existing element count. |
SimpleList(Int32)
Create a SimpleList<T> with an initial capacity
.
Declaration
public SimpleList(int capacity)
Parameters
Type | Name | Description |
---|---|---|
System.Int32 | capacity | An initial sizing for the Array. |
Fields
| Improve this Doc View SourceArray
Internal array of backed data for the SimpleList<T>.
Declaration
public T[] Array
Field Value
Type | Description |
---|---|
T[] |
Count
The current number of occupied elements in the CircularBuffer<T>.
Declaration
public int Count
Field Value
Type | Description |
---|---|
System.Int32 |
Remarks
CAUTION! Changing this will alter the understanding of the data.
Methods
| Improve this Doc View SourceAddExpandClearBoth(T, ArrayPool<T>)
Add an item to the SimpleList<T>, checking if Array needs to be resized. Clears old and new arrays on resize.
Declaration
public void AddExpandClearBoth(T item, ArrayPool<T> pool)
Parameters
Type | Name | Description |
---|---|---|
T | item | A typed System.Object to add. |
ArrayPool<T> | pool | Pool to allocate the array from if resizing. |
AddExpandClearNew(T, ArrayPool<T>)
Add an item to the SimpleList<T>, checking if Array needs to be resized. Clears unused indices of the new array on resize.
Declaration
public void AddExpandClearNew(T item, ArrayPool<T> pool)
Parameters
Type | Name | Description |
---|---|---|
T | item | A typed System.Object to add. |
ArrayPool<T> | pool | Pool to allocate the array from if resizing. |
AddExpandClearOld(T, ArrayPool<T>)
Add an item to the SimpleList<T>, checking if Array needs to be resized. Clears the old array on resize after copying its contents.
Declaration
public void AddExpandClearOld(T item, ArrayPool<T> pool)
Parameters
Type | Name | Description |
---|---|---|
T | item | A typed System.Object to add. |
ArrayPool<T> | pool | Pool to allocate the array from if resizing. |
AddExpandNoClear(T, ArrayPool<T>)
Add an item to the SimpleList<T>, checking if Array needs to be resized.
Declaration
public void AddExpandNoClear(T item, ArrayPool<T> pool)
Parameters
Type | Name | Description |
---|---|---|
T | item | A typed System.Object to add. |
ArrayPool<T> | pool | Pool to allocate the array from if resizing. |
AddUnchecked(T)
Add an item to the SimpleList<T> without checking the Array size.
Declaration
public void AddUnchecked(T item)
Parameters
Type | Name | Description |
---|---|---|
T | item | A typed System.Object to add. |
AddWithExpandCheck(T)
Add an item to the SimpleList<T>, checking if Array needs to be resized.
Declaration
public void AddWithExpandCheck(T item)
Parameters
Type | Name | Description |
---|---|---|
T | item | A typed System.Object to add. |
AddWithExpandCheck(T, Int32)
Add an item to the SimpleList<T>, checking if Array needs to be resized.
Declaration
public void AddWithExpandCheck(T item, int howMuchToExpand)
Parameters
Type | Name | Description |
---|---|---|
T | item | A typed System.Object to add. |
System.Int32 | howMuchToExpand | How much to expand the array by. |
Clear()
Clear out the Array in SimpleList<T> and sets the Count to 0.
Declaration
public void Clear()
Compact()
Shrink/compact the backing Array so there is no unused space.
Declaration
public void Compact()
InsertExpandClearBoth(Int32, T, ArrayPool<T>)
Insert an item into the SimpleList<T>, checking if Array needs to be resized. Clears old and new arrays on resize.
Declaration
public void InsertExpandClearBoth(int index, T item, ArrayPool<T> pool)
Parameters
Type | Name | Description |
---|---|---|
System.Int32 | index | The index in Array to add the |
T | item | A typed System.Object to insert. |
ArrayPool<T> | pool | Pool to allocate the array from if resizing. |
InsertExpandClearNew(Int32, T, ArrayPool<T>)
Insert an item into the SimpleList<T>, checking if Array needs to be resized. Clears unused indices of the new array on resize.
Declaration
public void InsertExpandClearNew(int index, T item, ArrayPool<T> pool)
Parameters
Type | Name | Description |
---|---|---|
System.Int32 | index | The index in Array to add the |
T | item | A typed System.Object to insert. |
ArrayPool<T> | pool | Pool to allocate the array from if resizing. |
InsertExpandClearOld(Int32, T, ArrayPool<T>)
Insert an item into the SimpleList<T>, checking if Array needs to be resized. Clears the old array on resize after copying its contents.
Declaration
public void InsertExpandClearOld(int index, T item, ArrayPool<T> pool)
Parameters
Type | Name | Description |
---|---|---|
System.Int32 | index | The index in Array to add the |
T | item | A typed System.Object to insert. |
ArrayPool<T> | pool | Pool to allocate the array from if resizing. |
InsertExpandNoClear(Int32, T, ArrayPool<T>)
Insert an item into the SimpleList<T>, checking if Array needs to be resized.
Declaration
public void InsertExpandNoClear(int index, T item, ArrayPool<T> pool)
Parameters
Type | Name | Description |
---|---|---|
System.Int32 | index | The index in Array to add the |
T | item | A typed System.Object to insert. |
ArrayPool<T> | pool | Pool to allocate the array from if resizing. |
InsertUnchecked(Int32, T)
Insert an item into the SimpleList<T> without checking the Array size.
Declaration
public void InsertUnchecked(int index, T item)
Parameters
Type | Name | Description |
---|---|---|
System.Int32 | index | The index in Array to add the |
T | item | A typed System.Object to insert. |
InsertWithExpandCheck(Int32, T)
Insert an item into the SimpleList<T>, checking if Array needs to be resized.
Declaration
public void InsertWithExpandCheck(int index, T item)
Parameters
Type | Name | Description |
---|---|---|
System.Int32 | index | The index in Array to add the |
T | item | A typed System.Object to insert. |
InsertWithExpandCheck(Int32, T, Int32)
Insert an item into the SimpleList<T>, checking if Array needs to be resized.
Declaration
public void InsertWithExpandCheck(int index, T item, int howMuchToExpand)
Parameters
Type | Name | Description |
---|---|---|
System.Int32 | index | The index in Array to add the |
T | item | A typed System.Object to insert. |
System.Int32 | howMuchToExpand | The number of elements to add at the end of the array when expanding. |
RemoveAt(Int32)
Remove an item from the SimpleList<T> at a specific index
.
Declaration
public void RemoveAt(int index)
Parameters
Type | Name | Description |
---|---|---|
System.Int32 | index | The target index. |
RemoveAtSwapBack(Int32)
Remove an item from the SimpleList<T> at a specific index
, swapping it with the
item from the highest used index.
Declaration
public void RemoveAtSwapBack(int index)
Parameters
Type | Name | Description |
---|---|---|
System.Int32 | index | The target index. |
RemoveFromBack()
Remove the last element in the SimpleList<T>.
Declaration
public void RemoveFromBack()
Reserve(Int32)
Resizes the Array, ensuring there are the provided number of empty spots in it.
Declaration
public void Reserve(int numberToReserve)
Parameters
Type | Name | Description |
---|---|---|
System.Int32 | numberToReserve | Number of desired empty spots. |
ReserveClearBoth(Int32, ArrayPool<T>)
Resizes the Array, ensuring there are the provided number of empty spots in it. Clears old and new arrays on resize.
Declaration
public void ReserveClearBoth(int numberToReserve, ArrayPool<T> pool)
Parameters
Type | Name | Description |
---|---|---|
System.Int32 | numberToReserve | Number of desired empty spots. |
ArrayPool<T> | pool | Pool to allocate the array from if resizing. |
ReserveClearNew(Int32, ArrayPool<T>)
Resizes the Array, ensuring there are the provided number of empty spots in it. Clears unused indices of the new array on resize.
Declaration
public void ReserveClearNew(int numberToReserve, ArrayPool<T> pool)
Parameters
Type | Name | Description |
---|---|---|
System.Int32 | numberToReserve | Number of desired empty spots. |
ArrayPool<T> | pool | Pool to allocate the array from if resizing. |
ReserveClearOld(Int32, ArrayPool<T>)
Resizes the Array, ensuring there are the provided number of empty spots in it. Clears the old array on resize after copying its contents.
Declaration
public void ReserveClearOld(int numberToReserve, ArrayPool<T> pool)
Parameters
Type | Name | Description |
---|---|---|
System.Int32 | numberToReserve | Number of desired empty spots. |
ArrayPool<T> | pool | Pool to allocate the array from if resizing. |
ReserveNoClear(Int32, ArrayPool<T>)
Resizes the Array, ensuring there are the provided number of empty spots in it.
Declaration
public void ReserveNoClear(int numberToReserve, ArrayPool<T> pool)
Parameters
Type | Name | Description |
---|---|---|
System.Int32 | numberToReserve | Number of desired empty spots. |
ArrayPool<T> | pool | Pool to allocate the array from if resizing. |
Reverse()
Reverse the order of Array.
Declaration
public void Reverse()