diff --git a/Pathfinding/RPriorityQueue.cs b/Pathfinding/RPriorityQueue.cs index 5463e37..e710afa 100644 --- a/Pathfinding/RPriorityQueue.cs +++ b/Pathfinding/RPriorityQueue.cs @@ -33,4 +33,19 @@ public class RPriorityQueue where TKey : notnull Count = queue.Count; return before - Count; } + + public int RemoveExcept(IEnumerable exceptKeys) + { + int before = Count; + queue = queue.IntersectBy(exceptKeys, item => item.Key).ToDictionary(item => item.Key, item => item.Value); + Count = queue.Count; + return before - Count; + } + + public int Clear() + { + int before = Count; + queue.Clear(); + return before; + } } \ No newline at end of file