C5  2.4
The C5 Generic Collection Library for C# and CLI is a comprehensive collection library supporting lists, sets, bags, dictionaries, priority queues, (FIFO) queues, and (LIFO) stacks. C5 runs on .NET 3.5+, Silverlight 5, Windows Phone 8, Xamarin.iOS, Xamarin.Android, and Mono.
C5.IPriorityQueue< T > Interface Template Reference

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

Inheritance diagram for C5.IPriorityQueue< T >:
C5.IExtensible< T > C5.ICollectionValue< T > C5.IShowable C5.IntervalHeap< T >

Public Member Functions

FindMin ()
 Find the current least item of this priority queue. More...
 
DeleteMin ()
 Remove the least item from this priority queue. More...
 
FindMax ()
 Find the current largest item of this priority queue. More...
 
DeleteMax ()
 Remove the largest item from this priority queue. More...
 
bool Find (IPriorityQueueHandle< T > handle, out T item)
 Check if the entry corresponding to a handle is in the priority queue. More...
 
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. More...
 
Delete (IPriorityQueueHandle< T > handle)
 Delete an item with a handle from a priority queue More...
 
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. More...
 
FindMin (out IPriorityQueueHandle< T > handle)
 Find the current least item of this priority queue. More...
 
FindMax (out IPriorityQueueHandle< T > handle)
 Find the current largest item of this priority queue. More...
 
DeleteMin (out IPriorityQueueHandle< T > handle)
 Remove the least item from this priority queue. More...
 
DeleteMax (out IPriorityQueueHandle< T > handle)
 Remove the largest item from this priority queue. More...
 
- Public Member Functions inherited from C5.IExtensible< T >
bool Add (T item)
 Add an item to this collection if possible. If this collection has set semantics, the item will be added if not already in the collection. If bag semantics, the item will always be added. More...
 
void AddAll (SCG.IEnumerable< T > items)
 Add the elements from another collection with a more specialized item type to this collection. If this collection has set semantics, only items not already in the collection will be added. More...
 
bool Check ()
 Check the integrity of the internal data structures of this collection. This is only relevant for developers of the library More...
 
- Public Member Functions inherited from C5.ICollectionValue< T >
void CopyTo (T[] array, int index)
 Copy the items of this collection to a contiguous part of an array. More...
 
T[] ToArray ()
 Create an array with the items of this collection (in the same order as an enumerator would output them). More...
 
void Apply (Action< T > action)
 Apply a delegate to all items of this collection. More...
 
bool Exists (Func< T, bool > predicate)
 Check if there exists an item that satisfies a specific predicate in this collection. More...
 
bool Find (Func< T, bool > predicate, out T item)
 Check if there exists an item that satisfies a specific predicate in this collection and return the first one in enumeration order. More...
 
bool All (Func< T, bool > predicate)
 Check if all items in this collection satisfies a specific predicate. More...
 
Choose ()
 Choose some item of this collection. More...
 
SCG.IEnumerable< T > Filter (Func< T, bool > filter)
 Create an enumerable, enumerating the items of this collection that satisfies a certain condition. More...
 
- Public Member Functions inherited from C5.IShowable
bool Show (StringBuilder stringbuilder, ref int rest, IFormatProvider formatProvider)
 Format More...
 

Properties

SCG.IComparer< T > Comparer [get]
 The comparer object supplied at creation time for this collection More...
 
this[IPriorityQueueHandle< T > handle] [get, set]
 Get or set the item corresponding to a handle. Throws exceptions on invalid handles. More...
 
- Properties inherited from C5.IExtensible< T >
bool IsReadOnly [get]
 If true any call of an updating operation will throw an More...
 
bool AllowsDuplicates [get]
 
SCG.IEqualityComparer< T > EqualityComparer [get]
 (Here should be a discussion of the role of equalityComparers. Any ). More...
 
bool DuplicatesByCounting [get]
 By convention this is true for any collection with set semantics. More...
 
- Properties inherited from C5.ICollectionValue< T >
EventTypeEnum ListenableEvents [get]
 A flag bitmap of the events subscribable to by this collection. More...
 
EventTypeEnum ActiveEvents [get]
 A flag bitmap of the events currently subscribed to by this collection. More...
 
bool IsEmpty [get]
 
int Count [get]
 
Speed CountSpeed [get]
 The value is symbolic indicating the type of asymptotic complexity in terms of the size of this collection (worst-case or amortized as relevant). More...
 

Additional Inherited Members

- Events inherited from C5.ICollectionValue< T >
CollectionChangedHandler< T > CollectionChanged
 The change event. Will be raised for every change operation on the collection. More...
 
CollectionClearedHandler< T > CollectionCleared
 The change event. Will be raised for every clear operation on the collection. More...
 
ItemsAddedHandler< T > ItemsAdded
 The item added event. Will be raised for every individual addition to the collection. More...
 
ItemInsertedHandler< T > ItemInserted
 The item inserted event. Will be raised for every individual insertion to the collection. More...
 
ItemsRemovedHandler< T > ItemsRemoved
 The item removed event. Will be raised for every individual removal from the collection. More...
 
ItemRemovedAtHandler< T > ItemRemovedAt
 The item removed at event. Will be raised for every individual removal at from the collection. More...
 

Detailed Description

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.

Member Function Documentation

bool C5.IPriorityQueue< T >.Add ( ref IPriorityQueueHandle< T >  handle,
item 
)

Add an item to the priority queue, receiving a handle for the item in the queue, or reusing an existing unused handle.

Parameters
handleOn 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
Returns

Implemented in C5.IntervalHeap< T >.

T C5.IPriorityQueue< T >.Delete ( IPriorityQueueHandle< T >  handle)

Delete an item with a handle from a priority queue

Parameters
handleThe handle for the item. The handle will be invalidated, but reusable.
Returns
The deleted item

Implemented in C5.IntervalHeap< T >.

T C5.IPriorityQueue< T >.DeleteMax ( )

Remove the largest item from this priority queue.

Returns
The removed item.

Implemented in C5.IntervalHeap< T >.

T C5.IPriorityQueue< T >.DeleteMax ( out IPriorityQueueHandle< T >  handle)

Remove the largest item from this priority queue.

Parameters
handleOn return: the handle of the removed item.
Returns
The removed item.

Implemented in C5.IntervalHeap< T >.

T C5.IPriorityQueue< T >.DeleteMin ( )

Remove the least item from this priority queue.

Returns
The removed item.

Implemented in C5.IntervalHeap< T >.

T C5.IPriorityQueue< T >.DeleteMin ( out IPriorityQueueHandle< T >  handle)

Remove the least item from this priority queue.

Parameters
handleOn return: the handle of the removed item.
Returns
The removed item.

Implemented in C5.IntervalHeap< T >.

bool C5.IPriorityQueue< T >.Find ( IPriorityQueueHandle< T >  handle,
out T  item 
)

Check if the entry corresponding to a handle is in the priority queue.

Parameters
handle
item
Returns

Implemented in C5.IntervalHeap< T >.

T C5.IPriorityQueue< T >.FindMax ( )

Find the current largest item of this priority queue.

Returns
The largest item.

Implemented in C5.IntervalHeap< T >.

T C5.IPriorityQueue< T >.FindMax ( out IPriorityQueueHandle< T >  handle)

Find the current largest item of this priority queue.

Parameters
handleOn return: the handle of the item.
Returns
The largest item.

Implemented in C5.IntervalHeap< T >.

T C5.IPriorityQueue< T >.FindMin ( )

Find the current least item of this priority queue.

Returns
The least item.

Implemented in C5.IntervalHeap< T >.

T C5.IPriorityQueue< T >.FindMin ( out IPriorityQueueHandle< T >  handle)

Find the current least item of this priority queue.

Parameters
handleOn return: the handle of the item.
Returns
The least item.

Implemented in C5.IntervalHeap< T >.

T C5.IPriorityQueue< T >.Replace ( IPriorityQueueHandle< T >  handle,
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.

Parameters
handleThe handle for the old item
itemThe new item
Returns
The old item

Implemented in C5.IntervalHeap< T >.

Property Documentation

SCG.IComparer<T> C5.IPriorityQueue< T >.Comparer
get

The comparer object supplied at creation time for this collection

The comparer

T C5.IPriorityQueue< T >.this[IPriorityQueueHandle< T > handle]
getset

Get or set the item corresponding to a handle. Throws exceptions on invalid handles.

Parameters
handle
Returns

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