RandomQueuePolicy

class RandomQueuePolicy<T>(initialContents: Collection<T> = emptyList()) : QueuePolicy<T>

Random queue policy. Entities are dequeued randomly from the queue.

Parameters

T

the type of entities in the queue

initialContents

the initial entities in the queue

Constructors

Link copied to clipboard
constructor(initialContents: Collection<T> = emptyList())

Properties

Link copied to clipboard
open override val contents: Sequence<T>

A sequence of all entities currently in the queue, in their stored order.

Functions

Link copied to clipboard
open override fun dequeue(): T

Removes and returns an entity from the queue according to the policy.

Link copied to clipboard
open override fun enqueue(obj: T)

Adds an entity to the queue according to the policy.

Link copied to clipboard
open override fun reportOccupancy(): Int

Reports the current number of entities in the queue.

Link copied to clipboard

Indicates whether this policy supports residence time tracking for entities.