107 lines
1.9 KiB
Markdown
107 lines
1.9 KiB
Markdown
# 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.
|
|
|
|
```csharp
|
|
public class FixedSizeQueue<T> : , , , System.Collections.IEnumerable
|
|
```
|
|
|
|
#### Type Parameters
|
|
|
|
`T`<br>
|
|
|
|
Inheritance [Object](https://docs.microsoft.com/en-us/dotnet/api/system.object) → [FixedSizeQueue<T>](./llama.common.fixedsizequeue-1.md)<br>
|
|
Implements IReadOnlyList<T>, IReadOnlyCollection<T>, IEnumerable<T>, [IEnumerable](https://docs.microsoft.com/en-us/dotnet/api/system.collections.ienumerable)
|
|
|
|
## Properties
|
|
|
|
### **Item**
|
|
|
|
```csharp
|
|
public T Item { get; }
|
|
```
|
|
|
|
#### Property Value
|
|
|
|
T<br>
|
|
|
|
### **Count**
|
|
|
|
Number of items in this queue
|
|
|
|
```csharp
|
|
public int Count { get; }
|
|
```
|
|
|
|
#### Property Value
|
|
|
|
[Int32](https://docs.microsoft.com/en-us/dotnet/api/system.int32)<br>
|
|
|
|
### **Capacity**
|
|
|
|
Maximum number of items allowed in this queue
|
|
|
|
```csharp
|
|
public int Capacity { get; }
|
|
```
|
|
|
|
#### Property Value
|
|
|
|
[Int32](https://docs.microsoft.com/en-us/dotnet/api/system.int32)<br>
|
|
|
|
## Constructors
|
|
|
|
### **FixedSizeQueue(Int32)**
|
|
|
|
Create a new queue
|
|
|
|
```csharp
|
|
public FixedSizeQueue(int size)
|
|
```
|
|
|
|
#### Parameters
|
|
|
|
`size` [Int32](https://docs.microsoft.com/en-us/dotnet/api/system.int32)<br>
|
|
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
|
|
|
|
```csharp
|
|
public FixedSizeQueue(int size, IEnumerable<T> data)
|
|
```
|
|
|
|
#### Parameters
|
|
|
|
`size` [Int32](https://docs.microsoft.com/en-us/dotnet/api/system.int32)<br>
|
|
|
|
`data` IEnumerable<T><br>
|
|
|
|
## Methods
|
|
|
|
### **Enqueue(T)**
|
|
|
|
Enquene an element.
|
|
|
|
```csharp
|
|
public void Enqueue(T item)
|
|
```
|
|
|
|
#### Parameters
|
|
|
|
`item` T<br>
|
|
|
|
### **GetEnumerator()**
|
|
|
|
```csharp
|
|
public IEnumerator<T> GetEnumerator()
|
|
```
|
|
|
|
#### Returns
|
|
|
|
IEnumerator<T><br>
|