Dungeon Architect  17.0.0
SharpNav.Collections.Generic.PriorityQueue< T > Class Template Reference

Use a priority queue (heap) to determine which node is more important. More...

Inheritance diagram for SharpNav.Collections.Generic.PriorityQueue< T >:

Public Member Functions

 PriorityQueue (int n)
 Initializes a new instance of the PriorityQueue<T> class with a given capacity of size n. More...
 
void Clear ()
 Remove all the elements from the priority queue. More...
 
bool Empty ()
 Determines whether the priority queue is empty More...
 
Top ()
 Return the node at the top of the heap. More...
 
Pop ()
 Remove the node at the top of the heap. Then, move the bottommost node to the top and trickle down until the nodes are in order. More...
 
void Push (T node)
 Add the node at the bottom of the heap and move it up until the nodes ae in order. More...
 
bool Contains (T item)
 Returns whether the given item exists in the heap. More...
 
void Modify (T node)
 Change the value of the node, which may involve some swapping of elements to maintain heap order. More...
 
void CopyTo (T[] array, int arrayIndex)
 Copies the contents of the PriorityQueue<T> to an array. More...
 
IEnumerator< T > GetEnumerator ()
 Gets the PriorityQueue's enumerator. More...
 

Properties

int Count [get]
 Gets the number of elements in the priority queue. More...
 

Detailed Description

Use a priority queue (heap) to determine which node is more important.

Template Parameters
TA type that has a cost for each instance via the IValueWithCost interface.
Type Constraints
T :class 
T :IValueWithCost 

Definition at line 15 of file PriorityQueue.cs.

Constructor & Destructor Documentation

◆ PriorityQueue()

Initializes a new instance of the PriorityQueue<T> class with a given capacity of size n.

Parameters
nThe maximum number of nodes that can be stored.

Definition at line 26 of file PriorityQueue.cs.

Member Function Documentation

◆ Clear()

Remove all the elements from the priority queue.

Definition at line 59 of file PriorityQueue.cs.

◆ Contains()

bool SharpNav.Collections.Generic.PriorityQueue< T >.Contains ( item)

Returns whether the given item exists in the heap.

Parameters
itemItem to look for
Returns
True or False

Definition at line 113 of file PriorityQueue.cs.

◆ CopyTo()

void SharpNav.Collections.Generic.PriorityQueue< T >.CopyTo ( T[]  array,
int  arrayIndex 
)

Copies the contents of the PriorityQueue<T> to an array.

Parameters
arrayThe array to copy to.
arrayIndexThe index within the array to start copying to.

Definition at line 143 of file PriorityQueue.cs.

◆ Empty()

Determines whether the priority queue is empty

Returns
True if empty, false if not

Definition at line 68 of file PriorityQueue.cs.

◆ GetEnumerator()

IEnumerator<T> SharpNav.Collections.Generic.PriorityQueue< T >.GetEnumerator ( )

Gets the PriorityQueue's enumerator.

Returns
The enumerator.

Definition at line 155 of file PriorityQueue.cs.

◆ Modify()

void SharpNav.Collections.Generic.PriorityQueue< T >.Modify ( node)

Change the value of the node, which may involve some swapping of elements to maintain heap order.

Parameters
nodeThe node to modify

Definition at line 126 of file PriorityQueue.cs.

◆ Pop()

Remove the node at the top of the heap. Then, move the bottommost node to the top and trickle down until the nodes are in order.

Returns
Node with lowest value in heap

Definition at line 87 of file PriorityQueue.cs.

◆ Push()

void SharpNav.Collections.Generic.PriorityQueue< T >.Push ( node)

Add the node at the bottom of the heap and move it up until the nodes ae in order.

Parameters
nodeThe node to add

Definition at line 102 of file PriorityQueue.cs.

◆ Top()

Return the node at the top of the heap.

Returns
Top node in heap

Definition at line 77 of file PriorityQueue.cs.

Property Documentation

◆ Count

Gets the number of elements in the priority queue.

Definition at line 36 of file PriorityQueue.cs.


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