Satsuma
a delicious .NET graph library
 All Classes Namespaces Files Functions Variables Enumerations Enumerator Properties Pages
Public Member Functions | Properties | List of all members
Satsuma.PriorityQueue< TElement, TPriority > Class Template Reference

A heap-based no-duplicates priority queue implementation. More...

Inheritance diagram for Satsuma.PriorityQueue< TElement, TPriority >:
Satsuma.IPriorityQueue< TElement, TPriority > Satsuma.IReadOnlyPriorityQueue< TElement, TPriority > Satsuma.IClearable

Public Member Functions

void Clear ()
 Reverts the object to its default state. More...
 
bool Contains (TElement element)
 Returns whether the specified element is in the priority queue. More...
 
TElement Peek ()
 Returns the most prioritized element (that is, which has the lowest priority). More...
 
TElement Peek (out TPriority priority)
 Returns the most prioritized element (that is, which has the lowest priority) and its priority. More...
 
bool Pop ()
 Removes the most prioritized element from the queue, if it is not empty. More...
 
bool Remove (TElement element)
 Removes a certain element from the queue, if present. More...
 
bool TryGetPriority (TElement element, out TPriority priority)
 Gets the priority of an element without throwing an exception. More...
 

Properties

int Count [get]
 
IEnumerable< KeyValuePair
< TElement, TPriority > > 
Items [get]
 
TPriority this[TElement element] [get, set]
 

Detailed Description

A heap-based no-duplicates priority queue implementation.

Type Constraints
TPriority :IComparable<TPriority> 

Definition at line 67 of file PriorityQueue.cs.

Member Function Documentation

void Satsuma.PriorityQueue< TElement, TPriority >.Clear ( )

Reverts the object to its default state.

Implements Satsuma.IClearable.

Definition at line 74 of file PriorityQueue.cs.

bool Satsuma.PriorityQueue< TElement, TPriority >.Contains ( TElement  element)

Returns whether the specified element is in the priority queue.

Implements Satsuma.IReadOnlyPriorityQueue< TElement, TPriority >.

Definition at line 124 of file PriorityQueue.cs.

TElement Satsuma.PriorityQueue< TElement, TPriority >.Peek ( )

Returns the most prioritized element (that is, which has the lowest priority).

Implements Satsuma.IReadOnlyPriorityQueue< TElement, TPriority >.

Definition at line 177 of file PriorityQueue.cs.

TElement Satsuma.PriorityQueue< TElement, TPriority >.Peek ( out TPriority  priority)

Returns the most prioritized element (that is, which has the lowest priority) and its priority.

Implements Satsuma.IReadOnlyPriorityQueue< TElement, TPriority >.

Definition at line 182 of file PriorityQueue.cs.

bool Satsuma.PriorityQueue< TElement, TPriority >.Pop ( )

Removes the most prioritized element from the queue, if it is not empty.

Returns
true if an element could be removed, i.e. the queue was not empty.

Implements Satsuma.IPriorityQueue< TElement, TPriority >.

Definition at line 188 of file PriorityQueue.cs.

bool Satsuma.PriorityQueue< TElement, TPriority >.Remove ( TElement  element)

Removes a certain element from the queue, if present.

Returns
true if the given element was present in the queue.

Implements Satsuma.IPriorityQueue< TElement, TPriority >.

Definition at line 169 of file PriorityQueue.cs.

bool Satsuma.PriorityQueue< TElement, TPriority >.TryGetPriority ( TElement  element,
out TPriority  priority 
)

Gets the priority of an element without throwing an exception.

Parameters
priorityBecomes default(P) if the element is not in the queue, and the priority of the element otherwise.
Returns
true if the specified element is in the priority queue.

Implements Satsuma.IReadOnlyPriorityQueue< TElement, TPriority >.

Definition at line 129 of file PriorityQueue.cs.

Property Documentation

int Satsuma.PriorityQueue< TElement, TPriority >.Count
get

Definition at line 82 of file PriorityQueue.cs.

IEnumerable<KeyValuePair<TElement, TPriority> > Satsuma.PriorityQueue< TElement, TPriority >.Items
get

Definition at line 87 of file PriorityQueue.cs.

TPriority Satsuma.PriorityQueue< TElement, TPriority >.this[TElement element]
getset

Definition at line 96 of file PriorityQueue.cs.


The documentation for this class was generated from the following file: