Skip to content

Commit 60879e4

Browse files
authored
Merge pull request #80 from tgiachi/develop
release: optimized priority queue family
2 parents 7fcad74 + acb38f0 commit 60879e4

18 files changed

Lines changed: 3272 additions & 0 deletions

src/SquidStd.Core/Collections/PriorityQueues/FastPriorityQueue.cs

Lines changed: 580 additions & 0 deletions
Large diffs are not rendered by default.
Lines changed: 29 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,29 @@
1+
// Adapted from High-Speed Priority Queue for C# by BlueRaja
2+
// https://github.com/BlueRaja/High-Speed-Priority-Queue-for-C-Sharp - MIT License
3+
4+
namespace SquidStd.Core.Collections.PriorityQueues;
5+
6+
/// <summary>
7+
/// The bookkeeping base class an item must extend to be enqueued in a <see cref="FastPriorityQueue{T}" />.
8+
/// </summary>
9+
public class FastPriorityQueueNode
10+
{
11+
/// <summary>
12+
/// The priority this node was inserted at. Cannot be set directly - use <see cref="FastPriorityQueue{T}.Enqueue" />
13+
/// or <see cref="FastPriorityQueue{T}.UpdatePriority" /> instead.
14+
/// </summary>
15+
public float Priority { get; protected internal set; }
16+
17+
/// <summary>
18+
/// The node's current position in the owning queue's backing array.
19+
/// </summary>
20+
public int QueueIndex { get; internal set; }
21+
22+
#if DEBUG
23+
/// <summary>
24+
/// The queue this node is currently tied to. Populated only in DEBUG builds, to validate that a node isn't
25+
/// used across multiple queues without first calling <see cref="FastPriorityQueue{T}.ResetNode" />.
26+
/// </summary>
27+
public object? Queue { get; internal set; }
28+
#endif
29+
}

0 commit comments

Comments
 (0)