ConcurrentPriorityQueue<'TKey, 'TValue> Type

Implements a heap based priority queue that hold only keys. The key with the minimum value can then retrieved from the queue. This class is not thread safe.

Constructors

Constructor Description

ConcurrentPriorityQueue()

Full Usage: ConcurrentPriorityQueue()

Initializes a new instance of the ConcurrentPriorityQueue class.

ConcurrentPriorityQueue(capacity)

Full Usage: ConcurrentPriorityQueue(capacity)

Parameters:
    capacity : int - The initial capacity.

Initializes a new instance of the ConcurrentPriorityQueue class with a specified initial capacity.

capacity : int

The initial capacity.

Instance members

Instance member Description

this.Count

Full Usage: this.Count

Returns: int

Gets the number of elements in the queue.

Returns: int

this.Enqueue

Full Usage: this.Enqueue

Parameters:
    key : 'TKey - The key value.
    value : 'TValue - The value.

Adds the specified key to the queue.

key : 'TKey

The key value.

value : 'TValue

The value.

this.IsEmpty

Full Usage: this.IsEmpty

Returns: bool

Gets a value indicating whether the queue is empty.

Returns: bool

this.TryDequeue

Full Usage: this.TryDequeue

Parameters:
    key : byref<'TKey>
    value : byref<'TValue>

Returns: bool Minimum key value.

Dequeues the minimum key value. An exception is thrown if the queue is empty.

key : byref<'TKey>
value : byref<'TValue>
Returns: bool

Minimum key value.

InvalidOperationException Queue is empty

this.TryDequeueIf

Full Usage: this.TryDequeueIf

Parameters:
    predicate : Func<'TKey, bool>
    key : byref<'TKey>
    value : byref<'TValue>

Returns: bool True if the item was dequeued; otherwise, false.

Dequeues the minimum key value. Two conditions are neccessary in order to dequeue an item: i) at least one item needs to be in the queue, and ii) the predicate given in the argument, applied to the minimum key value item, must return true.

predicate : Func<'TKey, bool>
key : byref<'TKey>
value : byref<'TValue>
Returns: bool

True if the item was dequeued; otherwise, false.

this.TryDequeueIf

Full Usage: this.TryDequeueIf

Parameters:
    predicate : Func<'TKey, 'TValue, bool>
    key : byref<'TKey>
    value : byref<'TValue>

Returns: bool True if the item was dequeued; otherwise, false.

Dequeues the minimum key value. Two conditions are neccessary in order to dequeue an item: i) at least one item needs to be in the queue, and ii) the predicate given in the argument, applied to the minimum key value item, must return true.

predicate : Func<'TKey, 'TValue, bool>
key : byref<'TKey>
value : byref<'TValue>
Returns: bool

True if the item was dequeued; otherwise, false.

this.TryPeek

Full Usage: this.TryPeek

Parameters:
    key : byref<'TKey>
    value : byref<'TValue>

Returns: bool Minimum key value.

Peeks the element with the minimum key value. An exception is thrown if the queue is empty.

key : byref<'TKey>
value : byref<'TValue>
Returns: bool

Minimum key value.

InvalidOperationException Queue is empty.