Click or drag to resize

ConcurrentTokenizedPriorityQueueTKey, TValue, TToken Class

Represents an tokenized concurrent priority queue. Inserted items are associated with a token that can later be used to modify the item in the queue. There are two function sets to add queue items, depending on whether or not the queue is generating tokens by itself. Use Enqueue... functions, if the tokens are generated by the queue itself, or use Add.. functions if you provide the token.
Inheritance Hierarchy
SystemObject
  Altaxo.CollectionsConcurrentTokenizedPriorityQueueTKey, TValue, TToken

Namespace: Altaxo.Collections
Assembly: AltaxoCore (in AltaxoCore.dll) Version: 4.8.3179.0 (4.8.3179.0)
Syntax
C#
public class ConcurrentTokenizedPriorityQueue<TKey, TValue, TToken>
where TKey : Object, IComparable<TKey>

Type Parameters

TKey
The type of the key.
TValue
The type of the value.
TToken
The type of the token.

The ConcurrentTokenizedPriorityQueueTKey, TValue, TToken type exposes the following members.

Constructors
 NameDescription
Public methodConcurrentTokenizedPriorityQueueTKey, TValue, TToken Initializes a new instance of the ConcurrentTokenizedPriorityQueueTKey, TValue, TToken class. This instance is not configured to generate tokens by itself, thus you must use the TryAdd(..) functions to enqueue items.
Public methodConcurrentTokenizedPriorityQueueTKey, TValue, TToken(Int32) Initializes a new instance of the ConcurrentTokenizedPriorityQueueTKey, TValue, TToken class. This instance is not configured to generate tokens by itself, thus you must use the TryAdd(..) functions to enqueue items.
Public methodConcurrentTokenizedPriorityQueueTKey, TValue, TToken(TToken, FuncTToken, TToken) Initializes a new instance of the ConcurrentTokenizedPriorityQueueTKey, TValue, TToken class. When argument GetNextToken is not null, the priority queue is generating new tokens by itself. In this case you should only use the Enqueue functions to enqueue items. In contrast, when GetNextToken is null, the priority queue is not generating tokens by itself, and you have to use the TryAdd(..) functions to enqueue items.
Public methodConcurrentTokenizedPriorityQueueTKey, TValue, TToken(Int32, TToken, FuncTToken, TToken) Initializes a new instance of the ConcurrentTokenizedPriorityQueueTKey, TValue, TToken class. When argument GetNextToken is not null, the priority queue is generating new tokens by itself. In this case you should only use the Enqueue functions to enqueue items. In contrast, when GetNextToken is null, the priority queue is not generating tokens by itself, and you have to use the Add functions to enqueue items.
Top
Properties
 NameDescription
Public propertyCount Gets the number of elements in the priority queue.
Public propertyIsEmpty Gets a value indicating whether the priority queue is empty.
Top
Methods
 NameDescription
Public methodAddOrUpdate(TToken, TKey, TValue) Adds a key/value pair associated with a token to the queue (if no such token is already present), or updates the already present key/value pair associated with the provided token.
Public methodAddOrUpdate(TToken, KeyValuePairTKey, TValue, FuncTToken, KeyValuePairTKey, TValue, KeyValuePairTKey, TValue) Adds a key/value pair associated with a token to the queue (if no such token is already present), or updates the already present key/value pair associated with the provided token.
Public methodClear Removes all elements from this queue, resulting in an empty queue.
Public methodContainsToken Determines whether an item with the specified associated token exists in the queue.
Public methodDequeue Dequeues the item with minimum key. If the queue is empty, an exception will be thrown.
Public methodEnqueue Enqueues an item consisting of a key and a value. The priority queue has to be constructed to generate tokens by itself in order to use this function. Otherwise an exception is thrown.
Public methodEnqueueOrUpdate(TKey, TValue, TToken) Adds a key/value pair associated with a token to the queue (if no such token is already present), or updates the already present key/value pair associated with the provided token.
Public methodEnqueueOrUpdate(KeyValuePairTKey, TValue, TToken, FuncTToken, KeyValuePairTKey, TValue, KeyValuePairTKey, TValue) Adds a key/value pair associated with a token to the queue (if no such token is already present), or updates the already present key/value pair associated with the provided token.
Public methodEqualsDetermines whether the specified object is equal to the current object.
(Inherited from Object)
Protected methodFinalizeAllows an object to try to free resources and perform other cleanup operations before it is reclaimed by garbage collection.
(Inherited from Object)
Public methodGetHashCodeServes as the default hash function.
(Inherited from Object)
Public methodGetTypeGets the Type of the current instance.
(Inherited from Object)
Protected methodMemberwiseCloneCreates a shallow copy of the current Object.
(Inherited from Object)
Public methodToStringReturns a string that represents the current object.
(Inherited from Object)
Public methodTryAdd Tries to add the key/value pair associated with the provided token to the queue. The queue must not be configured to generate tokens by itself.
Public methodTryDecreaseKey Tries to change the key associated with the provided token. The new key value has to be less than the existing one; otherwise an exception is thrown.
Public methodTryDequeue Tries to dequeue the item with minimum key.
Public methodTryGet(TToken, TKey) Tries to get the key/value pair that is associated with the provided token.
Public methodTryGet(TToken, TKey, TValue) Tries to get the key/value pair that is associated with the provided token.
Public methodTryIncreaseKey Tries to change the key associated with the provided token. The new key value has to be greater than the existing one; otherwise an exception is thrown.
Public methodTryPeek(TKey) Tries to retrieve the element with minimum key.
Public methodTryPeek(TKey, TValue) Tries to retrieve the element with minimum key.
Public methodTryPeek(TKey, TValue, TToken) Tries to retrieve the element with minimum key.
Public methodTryPeekKey 
Public methodTryRemove(TToken) Tries to remove the key/value pair associated with the provided token from the queue (independently on the current position of the key/value pair in the queue).
Public methodTryRemove(TToken, TKey) Tries to remove the key/value pair associated with the provided token from the queue (independently on the current position of the key/value pair in the queue).
Public methodTryRemove(TToken, TKey, TValue) Tries to remove the key/value pair associated with the provided token from the queue (independently on the current position of the key/value pair in the queue).
Public methodTryUpdateKey Tries to update the key associated with the provided token. The value is left as is.
Top
See Also