/// <summary>
 /// Initializes a new instance of the <see cref="FixedSizeQueue{T}" /> class.
 /// </summary>
 public FixedSizeQueue(IEnumerable <T> source)
 {
     _indexDequeue = 0;
     _entries      = new FixedSizeBucket <T>(source);
     _capacity     = _entries.Capacity;
     _indexEnqueue = _entries.Count;
     _preCount     = _indexEnqueue;
 }
 /// <summary>
 /// Initializes a new instance of the <see cref="FixedSizeQueue{T}" /> class.
 /// </summary>
 /// <param name="capacity">The capacity.</param>
 public FixedSizeQueue(int capacity)
 {
     _capacity     = NumericHelper.PopulationCount(capacity) == 1 ? capacity : NumericHelper.NextPowerOf2(capacity);
     _preCount     = 0;
     _indexEnqueue = 0;
     _indexDequeue = 0;
     _entries      = new FixedSizeBucket <T>(_capacity);
 }
Esempio n. 3
0
 /// <summary>
 /// Initializes a new instance of the <see cref="CircularBucket{T}" /> class.
 /// </summary>
 /// <param name="capacity">The capacity.</param>
 public CircularBucket(int capacity)
 {
     _capacity = NumericHelper.PopulationCount(capacity) == 1 ? capacity : NumericHelper.NextPowerOf2(capacity);
     _index    = -1;
     _entries  = new FixedSizeBucket <T>(_capacity);
 }