IFixedSizePriorityQueue.cs 1.1 KB

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