IFixedSizePriorityQueue.cs 1.1 KB

12345678910111213141516171819202122232425262728
  1. using System;
  2. using System.Collections.Generic;
  3. using System.Linq;
  4. using System.Text;
  5. using System.Threading.Tasks;
  6. namespace Priority_Queue
  7. {
  8. /// <summary>
  9. /// Credit: https://github.com/BlueRaja/High-Speed-Priority-Queue-for-C-Sharp
  10. /// A helper-interface only needed to make writing unit tests a bit easier (hence the 'internal' access modifier)
  11. /// </summary>
  12. internal interface IFixedSizePriorityQueue<TItem, in TPriority> : IPriorityQueue<TItem, TPriority>
  13. where TPriority : IComparable<TPriority>
  14. {
  15. /// <summary>
  16. /// Resize the queue so it can accept more nodes. All currently enqueued nodes are remain.
  17. /// Attempting to decrease the queue size to a size too small to hold the existing nodes results in undefined behavior
  18. /// </summary>
  19. void Resize(int maxNodes);
  20. /// <summary>
  21. /// Returns the maximum number of items that can be enqueued at once in this queue. Once you hit this number (ie. once Count == MaxSize),
  22. /// attempting to enqueue another item will cause undefined behavior.
  23. /// </summary>
  24. int MaxSize { get; }
  25. }
  26. }