Class/Object

scalaz

PrioritySearchQueue

Related Docs: object PrioritySearchQueue | package scalaz

Permalink

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

Value Members

  1. final def !=(arg0: Any): Boolean

    Permalink
    Definition Classes
    AnyRef → Any
  2. final def ##(): Int

    Permalink
    Definition Classes
    AnyRef → Any
  3. final def ==(arg0: Any): Boolean

    Permalink
    Definition Classes
    AnyRef → Any
  4. final def asInstanceOf[T0]: T0

    Permalink
    Definition Classes
    Any
  5. def clone(): AnyRef

    Permalink
    Attributes
    protected[java.lang]
    Definition Classes
    AnyRef
    Annotations
    @throws( ... )
  6. def containsKey(key: K)(implicit K: Order[K]): Boolean

    Permalink
  7. def deleteLt(p: P)(implicit P: Order[P]): PrioritySearchQueue[A, P, K]

    Permalink

    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]

    Permalink

    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]

    Permalink

    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

    Permalink
    Definition Classes
    AnyRef
  11. def equals(arg0: Any): Boolean

    Permalink
    Definition Classes
    AnyRef → Any
  12. def finalize(): Unit

    Permalink
    Attributes
    protected[java.lang]
    Definition Classes
    AnyRef
    Annotations
    @throws( classOf[java.lang.Throwable] )
  13. def get(key: K)(implicit K: Order[K]): Maybe[A]

    Permalink

    Looks up an element by key.

  14. final def getClass(): Class[_]

    Permalink
    Definition Classes
    AnyRef → Any
  15. def hashCode(): Int

    Permalink
    Definition Classes
    AnyRef → Any
  16. def insert(elem: A)(implicit K: Order[K]): (PrioritySearchQueue[A, P, K], Maybe[A])

    Permalink

    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

    Permalink
  18. final def isInstanceOf[T0]: Boolean

    Permalink
    Definition Classes
    Any
  19. def minimum: Maybe[A]

    Permalink

    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]

    Permalink
  21. final def ne(arg0: AnyRef): Boolean

    Permalink
    Definition Classes
    AnyRef
  22. def nonEmpty: Boolean

    Permalink
  23. final def notify(): Unit

    Permalink
    Definition Classes
    AnyRef
  24. final def notifyAll(): Unit

    Permalink
    Definition Classes
    AnyRef
  25. def removeByKey(key: K)(implicit K: Order[K]): (PrioritySearchQueue[A, P, K], Maybe[A])

    Permalink

    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

    Permalink
  27. def splitAfterPrio(p: P)(implicit P: Order[P]): (PrioritySearchQueue[A, P, K], PrioritySearchQueue[A, P, K])

    Permalink

    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])

    Permalink

    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

    Permalink
    Definition Classes
    AnyRef
  30. def toString(): String

    Permalink
    Definition Classes
    AnyRef → Any
  31. def toUnsortedIList: IList[A]

    Permalink
  32. def toUnsortedList: List[A]

    Permalink
  33. final def wait(): Unit

    Permalink
    Definition Classes
    AnyRef
    Annotations
    @throws( ... )
  34. final def wait(arg0: Long, arg1: Int): Unit

    Permalink
    Definition Classes
    AnyRef
    Annotations
    @throws( ... )
  35. final def wait(arg0: Long): Unit

    Permalink
    Definition Classes
    AnyRef
    Annotations
    @throws( ... )

Inherited from AnyRef

Inherited from Any

Ungrouped