You can not select more than 25 topics Topics must start with a chinese character,a letter or number, can include dashes ('-') and can be up to 35 characters long.

llama.common.fixedsizequeue-1.md 2.1 kB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114
  1. # FixedSizeQueue<T>
  2. Namespace: LLama.Common
  3. A queue with fixed storage size.
  4. Currently it's only a naive implementation and needs to be further optimized in the future.
  5. ```csharp
  6. public class FixedSizeQueue<T> : , System.Collections.IEnumerable
  7. ```
  8. #### Type Parameters
  9. `T`<br>
  10. Inheritance [Object](https://docs.microsoft.com/en-us/dotnet/api/system.object) → [FixedSizeQueue&lt;T&gt;](./llama.common.fixedsizequeue-1.md)<br>
  11. Implements IEnumerable&lt;T&gt;, [IEnumerable](https://docs.microsoft.com/en-us/dotnet/api/system.collections.ienumerable)
  12. ## Properties
  13. ### **Count**
  14. Number of items in this queue
  15. ```csharp
  16. public int Count { get; }
  17. ```
  18. #### Property Value
  19. [Int32](https://docs.microsoft.com/en-us/dotnet/api/system.int32)<br>
  20. ### **Capacity**
  21. Maximum number of items allowed in this queue
  22. ```csharp
  23. public int Capacity { get; }
  24. ```
  25. #### Property Value
  26. [Int32](https://docs.microsoft.com/en-us/dotnet/api/system.int32)<br>
  27. ## Constructors
  28. ### **FixedSizeQueue(Int32)**
  29. Create a new queue
  30. ```csharp
  31. public FixedSizeQueue(int size)
  32. ```
  33. #### Parameters
  34. `size` [Int32](https://docs.microsoft.com/en-us/dotnet/api/system.int32)<br>
  35. the maximum number of items to store in this queue
  36. ### **FixedSizeQueue(Int32, IEnumerable&lt;T&gt;)**
  37. Fill the quene with the data. Please ensure that data.Count &lt;= size
  38. ```csharp
  39. public FixedSizeQueue(int size, IEnumerable<T> data)
  40. ```
  41. #### Parameters
  42. `size` [Int32](https://docs.microsoft.com/en-us/dotnet/api/system.int32)<br>
  43. `data` IEnumerable&lt;T&gt;<br>
  44. ## Methods
  45. ### **FillWith(T)**
  46. Replace every item in the queue with the given value
  47. ```csharp
  48. public FixedSizeQueue<T> FillWith(T value)
  49. ```
  50. #### Parameters
  51. `value` T<br>
  52. The value to replace all items with
  53. #### Returns
  54. [FixedSizeQueue&lt;T&gt;](./llama.common.fixedsizequeue-1.md)<br>
  55. returns this
  56. ### **Enqueue(T)**
  57. Enquene an element.
  58. ```csharp
  59. public void Enqueue(T item)
  60. ```
  61. #### Parameters
  62. `item` T<br>
  63. ### **GetEnumerator()**
  64. ```csharp
  65. public IEnumerator<T> GetEnumerator()
  66. ```
  67. #### Returns
  68. IEnumerator&lt;T&gt;<br>