class PrioritySearchQueue[A, P, K] extends AnyRef
Container whose elements have two different orders: by priority and by lookup key.
Supports efficient implementation of the following operations: - insertion (O(log n)), - lookup by key (O(log n)), - deletion by key (O(log n)), - access to minimal-by-priority element (O(1)), - deletion of minimal-by-priority element (O(log n)).
Implemented using FingerTree.
- A
element type
- P
priority of an element. Multiple elements can have the same priority.
- K
lookup key. Unique—the queue holds at most one element with any given key.
- Alphabetic
- By Inheritance
- PrioritySearchQueue
- AnyRef
- Any
- Hide All
- Show All
- Public
- Protected
Value Members
- final def !=(arg0: Any): Boolean
- Definition Classes
- AnyRef → Any
- final def ##: Int
- Definition Classes
- AnyRef → Any
- final def ==(arg0: Any): Boolean
- Definition Classes
- AnyRef → Any
- final def asInstanceOf[T0]: T0
- Definition Classes
- Any
- def clone(): AnyRef
- Attributes
- protected[lang]
- Definition Classes
- AnyRef
- Annotations
- @throws(classOf[java.lang.CloneNotSupportedException]) @native()
- def containsKey(key: K)(implicit K: Order[K]): Boolean
- def deleteLt(p: P)(implicit P: Order[P]): PrioritySearchQueue[A, P, K]
Removes elements with priority less than
p
.Removes elements with priority less than
p
.O(min(k*log(n), (n-k)*log(n), n)), where k is the number of actually removed elements. For large k, this method is more efficient than iterated deleteMin.
To also return the removed elements, use splitBeforePrio.
- def deleteLte(p: P)(implicit P: Order[P]): PrioritySearchQueue[A, P, K]
Removes elements with priority less than or equal to
p
.Removes elements with priority less than or equal to
p
.O(min(k*log(n), (n-k)*log(n), n)), where k is the number of actually removed elements. For large k, this method is more efficient than iterated deleteMin.
To also return the removed elements, use splitAfterPrio.
- def deleteMin(implicit P: Order[P]): PrioritySearchQueue[A, P, K]
Removes an element with minimum priority.
Removes an element with minimum priority.
If there are multiple elements with the same minimum priority, it is guaranteed to remove the one returned by minimum.
O(log(n)).
If this queue is empty, returns
this
. - final def eq(arg0: AnyRef): Boolean
- Definition Classes
- AnyRef
- def equals(arg0: AnyRef): Boolean
- Definition Classes
- AnyRef → Any
- def finalize(): Unit
- Attributes
- protected[lang]
- Definition Classes
- AnyRef
- Annotations
- @throws(classOf[java.lang.Throwable])
- def get(key: K)(implicit K: Order[K]): Maybe[A]
Looks up an element by key.
- final def getClass(): Class[_ <: AnyRef]
- Definition Classes
- AnyRef → Any
- Annotations
- @native()
- def hashCode(): Int
- Definition Classes
- AnyRef → Any
- Annotations
- @native()
- def insert(elem: A)(implicit K: Order[K]): (PrioritySearchQueue[A, P, K], Maybe[A])
Inserts the given element into this queue.
Inserts the given element into this queue.
If an element with the same key is already present in this queue, it is replaced by
elem
and the replaced element is returned in the second part of the returned pair. - def isEmpty: Boolean
- final def isInstanceOf[T0]: Boolean
- Definition Classes
- Any
- def minimum: Maybe[A]
Returns an element with minimum priority, or Maybe.Empty if this queue is empty.
Returns an element with minimum priority, or Maybe.Empty if this queue is empty.
If there are multiple elements with the same minimum priority, it is unspecified which of them is returned.
- def minimumPriority: Maybe[P]
- final def ne(arg0: AnyRef): Boolean
- Definition Classes
- AnyRef
- def nonEmpty: Boolean
- final def notify(): Unit
- Definition Classes
- AnyRef
- Annotations
- @native()
- final def notifyAll(): Unit
- Definition Classes
- AnyRef
- Annotations
- @native()
- def removeByKey(key: K)(implicit K: Order[K]): (PrioritySearchQueue[A, P, K], Maybe[A])
Removes an element by key.
Removes an element by key.
Returns the removed element, if any, in the second part of the returned pair.
- def size: Int
- def splitAfterPrio(p: P)(implicit P: Order[P]): (PrioritySearchQueue[A, P, K], PrioritySearchQueue[A, P, K])
Splits this queue into elements with priority less than or equal to
p
and elements with priority greater thanp
. - def splitBeforePrio(p: P)(implicit P: Order[P]): (PrioritySearchQueue[A, P, K], PrioritySearchQueue[A, P, K])
Splits this queue into elements with priority less than
p
and elements with priority greater than or equal top
. - final def synchronized[T0](arg0: => T0): T0
- Definition Classes
- AnyRef
- def toString(): String
- Definition Classes
- AnyRef → Any
- def toUnsortedIList: IList[A]
- def toUnsortedList: List[A]
- final def wait(): Unit
- Definition Classes
- AnyRef
- Annotations
- @throws(classOf[java.lang.InterruptedException])
- final def wait(arg0: Long, arg1: Int): Unit
- Definition Classes
- AnyRef
- Annotations
- @throws(classOf[java.lang.InterruptedException])
- final def wait(arg0: Long): Unit
- Definition Classes
- AnyRef
- Annotations
- @throws(classOf[java.lang.InterruptedException]) @native()