BoundedQueueNode

class BoundedQueueNode<T>(label: String, source: PushInputChannel<T>, destination: PullOutputChannel<T>, val capacity: Int, policy: QueuePolicy<T> = FIFOQueuePolicy()) : ContainerNode<T> , Queue<T> , BoundedContainer<T>

A queue with a maximum capacity. Receives entities through a push channel and outputs through a pull channel.

When the queue reaches capacity, the input channel closes to prevent further arrivals.

Uses the provided QueuePolicy to order entities (defaults to FIFO).

Parameters

T

the type of entities in the queue

label

the name of this node

source

the input channel from which entities are received

destination

the output channel where entities are sent

capacity

the maximum number of entities the queue can hold

policy

the QueuePolicy that determines entity ordering (defaults to FIFO)

Constructors

Link copied to clipboard
constructor(label: String, source: PushInputChannel<T>, destination: PullOutputChannel<T>, capacity: Int, policy: QueuePolicy<T> = FIFOQueuePolicy())

Properties

Link copied to clipboard
open override val capacity: Int
Link copied to clipboard
override val incoming: List<InputChannel<*, *>>
Link copied to clipboard
open val isFull: Boolean

Whether the container is at max occupancy

Link copied to clipboard
Link copied to clipboard
open override val occupants: Int

Returns the current number of entities in the queue.

Link copied to clipboard
override val outgoing: List<OutputChannel<*, *>>
Link copied to clipboard
Link copied to clipboard
Link copied to clipboard

Percentage of how much of the container's max capacity is used at the moment

Functions

Link copied to clipboard
open override fun onEnter(callback: context(Simulator) (T) -> Unit)

Registers a callback to be invoked when an entity enters this container.

Link copied to clipboard
open override fun onLeave(callback: context(Simulator) (T) -> Unit)

Registers a callback to be invoked when an entity leaves this container.

Link copied to clipboard
context(_: Simulator)
open override fun onStart()

Initializes the queue, marking destination ready if there are initial occupants.

Link copied to clipboard
Link copied to clipboard
open override fun supportsResidenceTime(): Boolean

Checks if the QueuePolicy supports residence time tracking.

Link copied to clipboard
open override fun toString(): String