Class PriorityQueue<T>
A priority queue over a set of IComparable<T> objects.
Inherited Members
Namespace: NetTopologySuite.Utilities
Assembly: NetTopologySuite.dll
Syntax
public class PriorityQueue<T> : IEnumerable<T>, IEnumerable where T : IComparable<T>
Type Parameters
Name | Description |
---|---|
T | Objects to add |
Constructors
| Improve this Doc View SourcePriorityQueue()
Creates an instance of this class
Declaration
public PriorityQueue()
PriorityQueue(Int32, IComparer<T>)
Creates an instance of this class
Declaration
public PriorityQueue(int capacity, IComparer<T> comparer)
Parameters
Type | Name | Description |
---|---|---|
Int32 | capacity | The capacity of the queue |
IComparer<T> | comparer | The comparer to use for computing priority values |
Properties
| Improve this Doc View SourceSize
Returns size.
Declaration
public int Size { get; }
Property Value
Type | Description |
---|---|
Int32 |
Methods
| Improve this Doc View SourceAdd(T)
Insert into the priority queue. Duplicates are allowed.
Declaration
public void Add(T x)
Parameters
Type | Name | Description |
---|---|---|
T | x | The item to insert. |
Clear()
Make the priority queue logically empty.
Declaration
public void Clear()
GetEnumerator()
Declaration
public IEnumerator<T> GetEnumerator()
Returns
Type | Description |
---|---|
IEnumerator<T> |
IsEmpty()
Test if the priority queue is logically empty.
Declaration
public bool IsEmpty()
Returns
Type | Description |
---|---|
Boolean |
|
Peek()
Gets the smallest item without removing it from the queue
Declaration
public T Peek()
Returns
Type | Description |
---|---|
T |
Poll()
Remove the smallest item from the priority queue.
Declaration
public T Poll()
Returns
Type | Description |
---|---|
T |
Remarks
The smallest item, or default(T)
if empty.
Explicit Interface Implementations
| Improve this Doc View SourceIEnumerable.GetEnumerator()
Declaration
IEnumerator IEnumerable.GetEnumerator()
Returns
Type | Description |
---|---|
IEnumerator |