PriorityQueueT Class |
Namespace: DigitalRune.Collections
public class PriorityQueue<T> : ICollection<T>, IEnumerable<T>, IEnumerable, ICollection
The PriorityQueueT type exposes the following members.
Name | Description | |
---|---|---|
PriorityQueueT |
Initializes a new instance of the PriorityQueueT class.
| |
PriorityQueueT(IComparerT) |
Initializes a new instance of the PriorityQueueT class.
| |
PriorityQueueT(ComparisonT) |
Initializes a new instance of the PriorityQueueT class.
|
Name | Description | |
---|---|---|
Clear |
Clears this queue.
| |
Contains |
Determines whether the queue contains the specified item.
| |
CopyTo | ||
Dequeue |
Gets the greatest item in the queue and removes the item.
| |
Enqueue |
Adds the specified item to the queue
| |
Equals | (Inherited from Object.) | |
Finalize | Allows an object to try to free resources and perform other cleanup operations before it is reclaimed by garbage collection. (Inherited from Object.) | |
GetEnumerator |
Returns an enumerator that iterates through a collection.
| |
GetHashCode | Serves as a hash function for a particular type. (Inherited from Object.) | |
GetType | Gets the Type of the current instance. (Inherited from Object.) | |
MemberwiseClone | Creates a shallow copy of the current Object. (Inherited from Object.) | |
Peek |
Gets the greatest item in the queue without removing the item.
| |
Remove |
Removes the specified item.
| |
ToString | Returns a string that represents the current object. (Inherited from Object.) | |
TrimExcess |
Sets the capacity of the PriorityQueueT to a value suitable for the current
number of elements in the set.
|
Name | Description | |
---|---|---|
AddRangeT |
Adds the specified items to the ICollectionT.
(Defined by CollectionHelper.) | |
DoT(ActionT) | Overloaded.
Performs the given action on each element in a sequence when it is enumerated.
(Defined by LinqHelper.) | |
DoT(ActionT, Int32) | Overloaded.
Performs the given action on each element (incorporating its index) in a sequence when it is
enumerated.
(Defined by LinqHelper.) | |
ForEachT(ActionT) | Overloaded.
Immediately performs the given action on each element in a sequence.
(Defined by LinqHelper.) | |
ForEachT(ActionT, Int32) | Overloaded.
Immediately performs the given action on each element (incorporating its index) in a
sequence.
(Defined by LinqHelper.) | |
IndexOfT |
Returns the index of the first element in a sequence that satisfies the specified condition.
(Defined by LinqHelper.) |
Name | Description | |
---|---|---|
Comparer |
Gets the IComparerT used for comparing items type T.
| |
Count |
Gets the number of items contained in the PriorityQueueT.
|
Name | Description | |
---|---|---|
ICollectionTAdd |
Adds the specified item. (Same as Enqueue(T).)
| |
ICollectionCopyTo | ||
IEnumerableTGetEnumerator |
Returns an enumerator that iterates through a collection.
| |
IEnumerableGetEnumerator |
Returns an enumerator that iterates through a collection.
| |
ICollectionTIsReadOnly |
Gets a value indicating whether the ICollectionT is read-only.
| |
ICollectionIsSynchronized |
Gets a value indicating whether access to the ICollection is synchronized
(thread safe).
| |
ICollectionSyncRoot |
Gets an object that can be used to synchronize access to the PriorityQueueT.
|
This class implements a heap-based priority queue. Items can be added with Enqueue(T) (runtime complexity O(log n)). Peek can be used to return the greatest item in the queue without removing the item (runtime complexity O(1)). Dequeue returns the greatest item and also removes it from the queue (runtime complexity O(log n)).
Important: The enumerator (see GetEnumerator) returns the items in an arbitrary order - not sorted by priority!