Class UpdatablePriorityQueue<TElement, TPriority>
Represents a min priority queue.
Inherited Members
Namespace: SuperLinq.Collections
Assembly: SuperLinq.dll
Syntax
public sealed class UpdatablePriorityQueue<TElement, TPriority>
Type Parameters
| Name | Description |
|---|---|
| TElement | Specifies the type of elements in the queue. |
| TPriority | Specifies the type of priority associated with enqueued elements. |
Remarks
Implements an array-backed quaternary min-heap. Each element is enqueued with an associated priority that determines the dequeue order: elements with the lowest priority get dequeued first.
Constructors
Properties
| Name | Description |
|---|---|
| Comparer | Gets the priority comparer used by the UpdatablePriorityQueue<TElement, TPriority>. |
| Count | Gets the number of elements contained in the UpdatablePriorityQueue<TElement, TPriority>. |
| UnorderedItems | Gets a collection that enumerates the elements of the queue in an unordered manner. |
Methods
| Name | Description |
|---|---|
| Clear() | Removes all items from the UpdatablePriorityQueue<TElement, TPriority>. |
| Dequeue() | Removes and returns the minimal element from the UpdatablePriorityQueue<TElement, TPriority>. |
| Enqueue(TElement, TPriority) | Adds or updates the specified element with associated priority to the UpdatablePriorityQueue<TElement, TPriority>. |
| EnqueueDequeue(TElement, TPriority) | Adds the specified element with associated priority to the UpdatablePriorityQueue<TElement, TPriority>, and immediately removes the minimal element, returning the result. |
| EnqueueMinimum(TElement, TPriority) | Adds or updates the specified element with associated priority to the UpdatablePriorityQueue<TElement, TPriority>, using the lessor of the existing or the new priority. |
| EnqueueRange(IEnumerable<(TElement Element, TPriority Priority)>) | Enqueues a sequence of element/priority pairs to the UpdatablePriorityQueue<TElement, TPriority>. |
| EnqueueRange(IEnumerable<TElement>, TPriority) | Enqueues a sequence of elements pairs to the UpdatablePriorityQueue<TElement, TPriority>, all associated with the specified priority. |
| EnqueueRangeMinimum(IEnumerable<(TElement Element, TPriority Priority)>) | Enqueues a sequence of element/priority pairs to the UpdatablePriorityQueue<TElement, TPriority>. |
| EnqueueRangeMinimum(IEnumerable<TElement>, TPriority) | Enqueues a sequence of elements pairs to the UpdatablePriorityQueue<TElement, TPriority>, all associated with the specified priority. |
| EnsureCapacity(int) | Ensures that the UpdatablePriorityQueue<TElement, TPriority> can hold up to
|
| Peek() | Returns the minimal element from the UpdatablePriorityQueue<TElement, TPriority> without removing it. |
| TrimExcess() | Sets the capacity to the actual number of items in the UpdatablePriorityQueue<TElement, TPriority>, if that is less than 90 percent of current capacity. |
| TryDequeue(out TElement, out TPriority) | Removes the minimal element from the UpdatablePriorityQueue<TElement, TPriority>,
and copies it to the |
| TryPeek(out TElement, out TPriority) | Returns a value that indicates whether there is a minimal element in the UpdatablePriorityQueue<TElement, TPriority>,
and if one is present, copies it to the |