Class PriorityQueue<T>
- Namespace
- NetTopologySuite.Utilities
- Assembly
- NetTopologySuite.dll
A priority queue over a set of IComparable<T> objects.
public class PriorityQueue<T> : IEnumerable<T>, IEnumerable where T : IComparable<T>
Type Parameters
TObjects to add
- Inheritance
-
PriorityQueue<T>
- Implements
-
IEnumerable<T>
- Inherited Members
Constructors
PriorityQueue()
Creates an instance of this class
public PriorityQueue()
PriorityQueue(int, IComparer<T>)
Creates an instance of this class
public PriorityQueue(int capacity, IComparer<T> comparer)
Parameters
capacityintThe capacity of the queue
comparerIComparer<T>The comparer to use for computing priority values
Properties
Size
Returns size.
public int Size { get; }
Property Value
Methods
Add(T)
Insert into the priority queue. Duplicates are allowed.
public void Add(T x)
Parameters
xTThe item to insert.
Clear()
Make the priority queue logically empty.
public void Clear()
GetEnumerator()
public IEnumerator<T> GetEnumerator()
Returns
- IEnumerator<T>
IsEmpty()
Test if the priority queue is logically empty.
public bool IsEmpty()
Returns
- bool
trueif empty,falseotherwise.
Peek()
Gets the smallest item without removing it from the queue
public T Peek()
Returns
- T
Poll()
Remove the smallest item from the priority queue.
public T Poll()
Returns
- T
Remarks
The smallest item, or default(T) if empty.