Interface IPriorityQueue<T>

A generic collection of items prioritized by a comparison (order) relation. Supports adding items and reporting or removing extremal elements.

When adding an item, the user may choose to have a handle allocated for this item in the queue. The resulting handle may be used for deleting the item even if not extremal, and for replacing the item. A priority queue typically only holds numeric priorities associated with some objects maintained separately in other collection objects.

Implements

IEnumerable<T>, System.Collections.IEnumerable, System.IFormattable, System.ICloneable, ICollectionValue<T>, IExtensible<T>, IShowable

Implemented by

IntervalHeap<T>

Property overview

Comparer ,
this[IPriorityQueueHandle<T> handle]

Method overview

Add(ref IPriorityQueueHandle<T> handle, T item) ,
Delete(IPriorityQueueHandle<T> handle) ,
DeleteMax() ,
DeleteMax(out IPriorityQueueHandle<T> handle) ,
DeleteMin() ,
DeleteMin(out IPriorityQueueHandle<T> handle) ,
Find(IPriorityQueueHandle<T> handle, out T item) ,
FindMax() ,
FindMax(out IPriorityQueueHandle<T> handle) ,
FindMin() ,
FindMin(out IPriorityQueueHandle<T> handle) ,
Replace(IPriorityQueueHandle<T> handle, T item)

Property details

A System.Collections.Generic.IComparer<T> ComparerAccess: Read-Only

Value:The comparer

The comparer object supplied at creation time for this collection
A T this[IPriorityQueueHandle<T> handle]Access: Read-Write
Get or set the item corresponding to a handle. Throws exceptions on invalid handles.
Parameters:
handle:

Method details

A bool Add(ref IPriorityQueueHandle<T> handle, T item) Add an item to the priority queue, receiving a handle for the item in the queue, or reusing an existing unused handle.
Returns:
Parameters:
handle:On output: a handle for the added item. On input: null for allocating a new handle, or a currently unused handle for reuse. A handle for reuse must be compatible with this priority queue, by being created by a priority queue of the same runtime type, but not necessarily the same priority queue object.
item:
A T Delete(IPriorityQueueHandle<T> handle) Delete an item with a handle from a priority queue
Returns:The deleted item
Parameters:
handle:The handle for the item. The handle will be invalidated, but reusable.
A T DeleteMax() Remove the largest item from this priority queue.
Returns:The removed item.
A T DeleteMax(out IPriorityQueueHandle<T> handle) Remove the largest item from this priority queue.
Returns:The removed item.
Parameters:
handle:On return: the handle of the removed item.
A T DeleteMin() Remove the least item from this priority queue.
Returns:The removed item.
A T DeleteMin(out IPriorityQueueHandle<T> handle) Remove the least item from this priority queue.
Returns:The removed item.
Parameters:
handle:On return: the handle of the removed item.
A bool Find(IPriorityQueueHandle<T> handle, out T item) Check if the entry corresponding to a handle is in the priority queue.
Returns:
Parameters:
handle:
item:
A T FindMax() Find the current largest item of this priority queue.
Returns:The largest item.
A T FindMax(out IPriorityQueueHandle<T> handle) Find the current largest item of this priority queue.
Returns:The largest item.
Parameters:
handle:On return: the handle of the item.
A T FindMin() Find the current least item of this priority queue.
Returns:The least item.
A T FindMin(out IPriorityQueueHandle<T> handle) Find the current least item of this priority queue.
Returns:The least item.
Parameters:
handle:On return: the handle of the item.
A T Replace(IPriorityQueueHandle<T> handle, T item) Replace an item with a handle in a priority queue with a new item. Typically used for changing the priority of some queued object.
Returns:The old item
Parameters:
handle:The handle for the old item
item:The new item