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.
Inherited Members
Namespace: Lucene.Net.Support.C5
Assembly: Lucene.Net.dll
Syntax
public interface IPriorityQueue<T> : IExtensible<T>, ICollectionValue<T>, IEnumerable<T>, IEnumerable, IShowable, IFormattable
Type Parameters
Name | Description |
---|---|
T |
Properties
| Improve this Doc View SourceComparer
The comparer object supplied at creation time for this collection
Declaration
IComparer<T> Comparer { get; }
Property Value
Type | Description |
---|---|
System.Collections.Generic.IComparer<T> | The comparer |
Item[IPriorityQueueHandle<T>]
Get or set the item corresponding to a handle. Throws exceptions on invalid handles.
Declaration
T this[IPriorityQueueHandle<T> handle] { get; set; }
Parameters
Type | Name | Description |
---|---|---|
IPriorityQueueHandle<T> | handle |
Property Value
Type | Description |
---|---|
T |
Methods
| Improve this Doc View SourceAdd(ref IPriorityQueueHandle<T>, T)
Add an item to the priority queue, receiving a handle for the item in the queue, or reusing an existing unused handle.
Declaration
bool Add(ref IPriorityQueueHandle<T> handle, T item)
Parameters
Type | Name | Description |
---|---|---|
IPriorityQueueHandle<T> | 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. |
T | item |
Returns
Type | Description |
---|---|
System.Boolean |
Delete(IPriorityQueueHandle<T>)
Delete an item with a handle from a priority queue
Declaration
T Delete(IPriorityQueueHandle<T> handle)
Parameters
Type | Name | Description |
---|---|---|
IPriorityQueueHandle<T> | handle | The handle for the item. The handle will be invalidated, but reusable. |
Returns
Type | Description |
---|---|
T | The deleted item |
DeleteMax()
Remove the largest item from this priority queue.
Declaration
T DeleteMax()
Returns
Type | Description |
---|---|
T | The removed item. |
DeleteMax(out IPriorityQueueHandle<T>)
Remove the largest item from this priority queue.
Declaration
T DeleteMax(out IPriorityQueueHandle<T> handle)
Parameters
Type | Name | Description |
---|---|---|
IPriorityQueueHandle<T> | handle | On return: the handle of the removed item. |
Returns
Type | Description |
---|---|
T | The removed item. |
DeleteMin()
Remove the least item from this priority queue.
Declaration
T DeleteMin()
Returns
Type | Description |
---|---|
T | The removed item. |
DeleteMin(out IPriorityQueueHandle<T>)
Remove the least item from this priority queue.
Declaration
T DeleteMin(out IPriorityQueueHandle<T> handle)
Parameters
Type | Name | Description |
---|---|---|
IPriorityQueueHandle<T> | handle | On return: the handle of the removed item. |
Returns
Type | Description |
---|---|
T | The removed item. |
Find(IPriorityQueueHandle<T>, out T)
Check if the entry corresponding to a handle is in the priority queue.
Declaration
bool Find(IPriorityQueueHandle<T> handle, out T item)
Parameters
Type | Name | Description |
---|---|---|
IPriorityQueueHandle<T> | handle | |
T | item |
Returns
Type | Description |
---|---|
System.Boolean |
FindMax()
Find the current largest item of this priority queue.
Declaration
T FindMax()
Returns
Type | Description |
---|---|
T | The largest item. |
FindMax(out IPriorityQueueHandle<T>)
Find the current largest item of this priority queue.
Declaration
T FindMax(out IPriorityQueueHandle<T> handle)
Parameters
Type | Name | Description |
---|---|---|
IPriorityQueueHandle<T> | handle | On return: the handle of the item. |
Returns
Type | Description |
---|---|
T | The largest item. |
FindMin()
Find the current least item of this priority queue.
Declaration
T FindMin()
Returns
Type | Description |
---|---|
T | The least item. |
FindMin(out IPriorityQueueHandle<T>)
Find the current least item of this priority queue.
Declaration
T FindMin(out IPriorityQueueHandle<T> handle)
Parameters
Type | Name | Description |
---|---|---|
IPriorityQueueHandle<T> | handle | On return: the handle of the item. |
Returns
Type | Description |
---|---|
T | The least item. |
Replace(IPriorityQueueHandle<T>, T)
Replace an item with a handle in a priority queue with a new item. Typically used for changing the priority of some queued object.
Declaration
T Replace(IPriorityQueueHandle<T> handle, T item)
Parameters
Type | Name | Description |
---|---|---|
IPriorityQueueHandle<T> | handle | The handle for the old item |
T | item | The new item |
Returns
Type | Description |
---|---|
T | The old item |