Table of Contents

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

T

Objects to add

Inheritance
PriorityQueue<T>
Implements
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

capacity int

The capacity of the queue

comparer IComparer<T>

The comparer to use for computing priority values

Properties

Size

Returns size.

public int Size { get; }

Property Value

int

Methods

Add(T)

Insert into the priority queue. Duplicates are allowed.

public void Add(T x)

Parameters

x T

The 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

true if empty, false otherwise.

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.