Interface IPriorityQueue<TItem, TPriority>
The IPriorityQueue interface. This is mainly here for purists, and in case I decide to add more implementations later. For speed purposes, it is actually recommended that you don't access the priority queue through this interface, since the JIT can (theoretically?) optimize method calls from concrete-types slightly better.
Namespace: System.Dynamic.ExpandoObject
Syntax
public interface IPriorityQueue<TItem, in TPriority>
where TPriority : IComparable<TPriority>
Type Parameters
TItem
|
TPriority
|
Properties
Count
Returns the number of nodes in the queue.
Declaration
int Count { get; }
Property Value
System.Int32
|
First
Returns the head of the queue, without removing it (use Dequeue() for that).
Declaration
TItem First { get; }
Property Value
TItem
|
Methods
Clear()
Removes every node from the queue.
Declaration
void Clear()
Contains(TItem)
Returns whether the given node is in the queue.
Declaration
bool Contains(TItem node)
Parameters
TItem
node
|
Returns
System.Boolean
|
Dequeue()
Removes the head of the queue (node with minimum priority; ties are broken by order of insertion), and returns it.
Declaration
TItem Dequeue()
Returns
TItem
|
Enqueue(TItem, TPriority)
Enqueue a node to the priority queue. Lower values are placed in front. Ties are broken by first-in-first-out. See implementation for how duplicates are handled.
Declaration
void Enqueue(TItem node, TPriority priority)
Parameters
TItem
node
|
TPriority
priority
|
Remove(TItem)
Removes a node from the queue. The node does not need to be the head of the queue.
Declaration
void Remove(TItem node)
Parameters
TItem
node
|
UpdatePriority(TItem, TPriority)
Call this method to change the priority of a node.
Declaration
void UpdatePriority(TItem node, TPriority priority)
Parameters
TItem
node
|
TPriority
priority
|