Click or drag to resize

PriorityQueue<T> Class

Provides a queue where the element with the lowest value is always at the front of the queue.
Inheritance Hierarchy
System.Object
  Ookii.Jumbo.PriorityQueue<T>

Namespace: Ookii.Jumbo
Assembly: Ookii.Jumbo (in Ookii.Jumbo.dll) Version: 0.3.0+dc1307f20e065bb638e0b73a34cd216f57e486f1
Syntax
public sealed class PriorityQueue<T> : IEnumerable<T>, 
	IEnumerable, ICollection<T>, ICollection

Type Parameters

T
The type of elements in the priority queue.

The PriorityQueue<T> type exposes the following members.

Constructors
 NameDescription
Public methodPriorityQueue<T>() Initializes a new instance of the PriorityQueue<T> class that is empty, has the default initial capacity, and uses the default IComparer<T> implementation for the element type.
Public methodPriorityQueue<T>(IComparer<T>) Initializes a new instance of the PriorityQueue<T> class that is empty, has the default initial capacity, and uses the specified IComparer<T> implementation to compare elements.
Public methodPriorityQueue<T>(IEnumerable<T>) Initializes a new instance of the PriorityQueue<T> that contains elements copied from the specified IEnumerable<T> and uses the default IComparer<T> implementation for the element type.
Public methodPriorityQueue<T>(IEnumerable<T>, IComparer<T>) Initializes a new instance of the PriorityQueue<T> that contains elements copied from the specified IEnumerable<T> and that uses the specified IComparer<T> implementation to compare keys.
Public methodPriorityQueue<T>(Int32, IComparer<T>) Initializes a new instance of the PriorityQueue<T> class that is empty, has the specified initial capacity, and uses the specified IComparer<T> implementation to compare elements.
Top
Properties
 NameDescription
Public propertyCapacity Gets or sets the total number of elements the internal data structure can hold without resizing.
Public propertyComparer Gets the IComparer<T> that is used to compare the elements of the priority queue.
Public propertyCount Gets the number of elements contained in the PriorityQueue<T>.
Top
Methods
 NameDescription
Public methodAdjustFirstItem Indicates that the current first item of the PriorityQueue<T> was modified and its priority has to be re-evaluated.
Public methodCheckHeap Checks the heap. Used for debug purposes.
Public methodClear Removes all objects from the PriorityQueue<T>.
Public methodContains Determines whether an element is in the PriorityQueue<T>.
Public methodCopyTo Copies the PriorityQueue<T> elements to an existing one-dimensional Array, starting at the specified array index.
Public methodDequeue Removes and return the element with the lowest value from the PriorityQueue<T>.
Public methodEnqueue Adds an object to the PriorityQueue<T>.
Public methodEqualsDetermines whether the specified object is equal to the current object.
(Inherited from Object)
Public methodGetEnumerator Returns an enumerator that iterates through the values in the PriorityQueue<T>.
Public methodGetHashCodeServes as the default hash function.
(Inherited from Object)
Public methodGetTypeGets the Type of the current instance.
(Inherited from Object)
Public methodPeek Return the object with the lowest value in the PriorityQueue<T> without removing it.
Public methodRemove Removes the specified item from the PriorityQueue<T>.
Public methodToArray Copies the PriorityQueue<T> elements to a new array.
Public methodToStringReturns a string that represents the current object.
(Inherited from Object)
Public methodTrimExcess Sets the capacity to the actual number of elements in the PriorityQueue<T>, if that number is less than a threshold value.
Top
Extension Methods
 NameDescription
Public Extension MethodGetSequenceHashCode<T> Gets the hash code for the specified sequence of elements.
(Defined by ListExtensions)
Public Extension MethodOrderBy<T, TKey> Sorts the elements of a sequence in ascending or descending order according to a key.
(Defined by ListExtensions)
Public Extension MethodToDelimitedString<T> Creates a string with the items of a list separated by a comma.
(Defined by ListExtensions)
Public Extension MethodToDelimitedString<T> Creates a string with the items of a list separated by the specified delimiter.
(Defined by ListExtensions)
Top
Remarks

The items must be immutable as long as they are in the PriorityQueue<T>. The only exception is the first item, which you may modify if you call AdjustFirstItem() immediately afterward.

Thread Safety
Any public static (Shared in Visual Basic) members of this type are thread safe. Any instance members are not guaranteed to be thread safe.
See Also