2.0 KiB
2.0 KiB
FixedSizeQueue<T>
Namespace: LLama.Common
A queue with fixed storage size. Currently it's only a naive implementation and needs to be further optimized in the future.
public class FixedSizeQueue<T> : , System.Collections.IEnumerable
Type Parameters
T
Inheritance Object → FixedSizeQueue<T>
Implements IEnumerable<T>, IEnumerable
Properties
Count
Number of items in this queue
public int Count { get; }
Property Value
Capacity
Maximum number of items allowed in this queue
public int Capacity { get; }
Property Value
Constructors
FixedSizeQueue(Int32)
Create a new queue
public FixedSizeQueue(int size)
Parameters
size
Int32
the maximum number of items to store in this queue
FixedSizeQueue(Int32, IEnumerable<T>)
Fill the quene with the data. Please ensure that data.Count <= size
public FixedSizeQueue(int size, IEnumerable<T> data)
Parameters
size
Int32
data
IEnumerable<T>
Methods
FillWith(T)
Replace every item in the queue with the given value
public FixedSizeQueue<T> FillWith(T value)
Parameters
value
T
The value to replace all items with
Returns
FixedSizeQueue<T>
returns this
Enqueue(T)
Enquene an element.
public void Enqueue(T item)
Parameters
item
T
GetEnumerator()
public IEnumerator<T> GetEnumerator()
Returns
IEnumerator<T>