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
| Edit this page View SourcePriorityQueue()
Creates an instance of this class
Declaration
public PriorityQueue()
PriorityQueue(int, IComparer<T>)
Creates an instance of this class
Declaration
public PriorityQueue(int capacity, IComparer<T> comparer)
Parameters
| Type | Name | Description |
|---|---|---|
| int | capacity | The capacity of the queue |
| IComparer<T> | comparer | The comparer to use for computing priority values |
Properties
| Edit this page View SourceSize
Returns size.
Declaration
public int Size { get; }
Property Value
| Type | Description |
|---|---|
| int |
Methods
| Edit this page 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 |
|---|---|
| bool |
|
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.