A purely functional Priority Queue implementation based on a binomial heap (Okasaki)
Assumes an Order
instance is in scope for A
Attributes
- Companion:
- object
- Source:
- PQueue.scala
- Graph
- Supertypes
- Self type
Members list
Value members
Concrete methods
Modifies the context in which this PQueue is executed using the natural transformation f
.
Modifies the context in which this PQueue is executed using the natural transformation f
.
O(1)
Attributes
- Returns:
a PQueue in the new context obtained by mapping the current one using
f
- Source:
- PQueue.scala
Inherited methods
Enqueues the given element, possibly fiber blocking until sufficient capacity becomes available.
Enqueues the given element, possibly fiber blocking until sufficient capacity becomes available.
O(log(n))
Attributes
- a
the element to be put in the PQueue
- Inherited from:
- PQueueSink
- Source:
- PQueue.scala
Attributes
- Inherited from:
- PQueueSource
- Source:
- PQueue.scala
Dequeues the least element from the PQueue, possibly fiber blocking until an element becomes available.
Dequeues the least element from the PQueue, possibly fiber blocking until an element becomes available.
O(log(n))
Note: If there are multiple elements with least priority, the order in which they are
dequeued is undefined. If you want to break ties with FIFO order you will need an
additional Ref[F, Long]
to track insertion, and embed that information into your instance
for Order[A]
.
Attributes
- Inherited from:
- PQueueSource
- Source:
- PQueue.scala
Attempts to enqueue the given element without fiber blocking.
Attempts to enqueue the given element without fiber blocking.
O(log(n))
Attributes
- a
the element to be put in the PQueue
- Returns:
an effect that describes whether the enqueuing of the given element succeeded without blocking
- Inherited from:
- PQueueSink
- Source:
- PQueue.scala
Attempts to enqueue the given elements without semantically blocking. If an item in the
list cannot be enqueued, the remaining elements will be returned. This is a convenience
method that recursively runs tryOffer
and does not offer any additional performance
benefits.
Attempts to enqueue the given elements without semantically blocking. If an item in the
list cannot be enqueued, the remaining elements will be returned. This is a convenience
method that recursively runs tryOffer
and does not offer any additional performance
benefits.
Attributes
- list
the elements to be put in the PQueue
- Returns:
an effect that contains the remaining valus that could not be offered.
- Inherited from:
- PQueueSink
- Source:
- PQueue.scala
Attempts to dequeue the least element from the PQueue, if one is available without fiber blocking.
Attempts to dequeue the least element from the PQueue, if one is available without fiber blocking.
O(log(n))
Attributes
- Returns:
an effect that describes whether the dequeueing of an element from the PQueue succeeded without blocking, with
None
denoting that no element was available Note: If there are multiple elements with least priority, the order in which they are dequeued is undefined. If you want to break ties with FIFO order you will need an additionalRef[F, Long]
to track insertion, and embed that information into your instance forOrder[A]
.- Inherited from:
- PQueueSource
- Source:
- PQueue.scala
Attempts to dequeue elements from the PQueue, if they are available without semantically
blocking. This is a convenience method that recursively runs tryTake
. It does not provide
any additional performance benefits.
Attempts to dequeue elements from the PQueue, if they are available without semantically
blocking. This is a convenience method that recursively runs tryTake
. It does not provide
any additional performance benefits.
Attributes
- maxN
The max elements to dequeue. Passing
None
will try to dequeue the whole queue.- Returns:
an effect that contains the dequeued elements from the PQueue Note: If there are multiple elements with least priority, the order in which they are dequeued is undefined.
- Inherited from:
- PQueueSource
- Source:
- PQueue.scala