Class StableListPriorityQueue
Priority queue implemented using a simple list with binary search for inserts. This specific implementation is cheap in terms of memory but weak in terms of performance. See http://visualstudiomagazine.com/articles/2012/11/01/priority-queues-with-c.aspx for original implementation This specific version is adapted for Envelopes only and calculates a priority of envelope.Message
Inherited Members
Namespace: Akka.Util
Assembly: Akka.dll
Syntax
public sealed class StableListPriorityQueue
Constructors
| Improve this Doc View SourceStableListPriorityQueue(Int32, Func<Object, Int32>)
Creates a new priority queue.
Declaration
public StableListPriorityQueue(int initialCapacity, Func<object, int> priorityCalculator)
Parameters
Type | Name | Description |
---|---|---|
Int32 | initialCapacity | The initial capacity of the queue. |
Func<Object, Int32> | priorityCalculator | The calculator function for assigning message priorities. |
Methods
| Improve this Doc View SourceCount()
Counts the number of items in the priority queue.
Declaration
public int Count()
Returns
Type | Description |
---|---|
Int32 | The total number of items in the queue. |
Dequeue()
Dequeues the highest priority message at the front of the priority queue.
Declaration
public Envelope Dequeue()
Returns
Type | Description |
---|---|
Envelope | The highest priority message Envelope. |
Enqueue(Envelope)
Enqueues a message into the priority queue.
Declaration
public void Enqueue(Envelope item)
Parameters
Type | Name | Description |
---|---|---|
Envelope | item | The item to enqueue. |
IsConsistent()
Checks the integrity of the StableListPriorityQueue.
Declaration
public bool IsConsistent()
Returns
Type | Description |
---|---|
Boolean |
|
Remarks
WARNING: high performance impact. Call during testing only.
Peek()
Peek at the message at the front of the priority queue.
Declaration
public Envelope Peek()
Returns
Type | Description |
---|---|
Envelope | The highest priority message Envelope. |
ToString()
Converts the queue to a string representation.
Declaration
public override string ToString()
Returns
Type | Description |
---|---|
String | A string representation of the queue. |