Packages

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.

Source
PrioritySearchQueue.scala
Linear Supertypes
Ordering
  1. Alphabetic
  2. By Inheritance
Inherited
  1. PrioritySearchQueue
  2. AnyRef
  3. Any
  1. Hide All
  2. Show All
Visibility
  1. Public
  2. Protected

Value Members

  1. final def !=(arg0: Any): Boolean
    Definition Classes
    AnyRef → Any
  2. final def ##: Int
    Definition Classes
    AnyRef → Any
  3. final def ==(arg0: Any): Boolean
    Definition Classes
    AnyRef → Any
  4. final def asInstanceOf[T0]: T0
    Definition Classes
    Any
  5. def clone(): AnyRef
    Attributes
    protected[lang]
    Definition Classes
    AnyRef
    Annotations
    @throws(classOf[java.lang.CloneNotSupportedException]) @native()
  6. def containsKey(key: K)(implicit K: Order[K]): Boolean
  7. 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.

  8. 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.

  9. 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.

  10. final def eq(arg0: AnyRef): Boolean
    Definition Classes
    AnyRef
  11. def equals(arg0: AnyRef): Boolean
    Definition Classes
    AnyRef → Any
  12. def finalize(): Unit
    Attributes
    protected[lang]
    Definition Classes
    AnyRef
    Annotations
    @throws(classOf[java.lang.Throwable])
  13. def get(key: K)(implicit K: Order[K]): Maybe[A]

    Looks up an element by key.

  14. final def getClass(): Class[_ <: AnyRef]
    Definition Classes
    AnyRef → Any
    Annotations
    @native()
  15. def hashCode(): Int
    Definition Classes
    AnyRef → Any
    Annotations
    @native()
  16. 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.

  17. def isEmpty: Boolean
  18. final def isInstanceOf[T0]: Boolean
    Definition Classes
    Any
  19. 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.

  20. def minimumPriority: Maybe[P]
  21. final def ne(arg0: AnyRef): Boolean
    Definition Classes
    AnyRef
  22. def nonEmpty: Boolean
  23. final def notify(): Unit
    Definition Classes
    AnyRef
    Annotations
    @native()
  24. final def notifyAll(): Unit
    Definition Classes
    AnyRef
    Annotations
    @native()
  25. 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.

  26. def size: Int
  27. 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 than p.

  28. 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 to p.

  29. final def synchronized[T0](arg0: => T0): T0
    Definition Classes
    AnyRef
  30. def toString(): String
    Definition Classes
    AnyRef → Any
  31. def toUnsortedIList: IList[A]
  32. def toUnsortedList: List[A]
  33. final def wait(): Unit
    Definition Classes
    AnyRef
    Annotations
    @throws(classOf[java.lang.InterruptedException])
  34. final def wait(arg0: Long, arg1: Int): Unit
    Definition Classes
    AnyRef
    Annotations
    @throws(classOf[java.lang.InterruptedException])
  35. final def wait(arg0: Long): Unit
    Definition Classes
    AnyRef
    Annotations
    @throws(classOf[java.lang.InterruptedException]) @native()

Inherited from AnyRef

Inherited from Any

Ungrouped