ServiceNode

class ServiceNode<T>(label: String, source: PushInputChannel<T>, destination: PushOutputChannel<T>, delayProvider: DelayProvider, numServers: Int) : ContainerNode<T> , Service<T> , HasProgressBars

Processes entities through parallel servers, each introducing a delay. When all servers are busy, the input channel closes to prevent additional arrivals. Reopens when a server becomes available.

Parameters

T

the type of entities being served

label

the name of this node

source

the input channel from which entities arrive

destination

the output channel where processed entities are sent

delayProvider

the DelayProvider that determines service duration for each entity

numServers

the number of parallel servers

Constructors

Link copied to clipboard
constructor(label: String, source: PushInputChannel<T>, destination: PushOutputChannel<T>, delayProvider: DelayProvider, numServers: Int)

Properties

Link copied to clipboard
open override val capacity: Int

The total number of parallel servers in this service node.

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
open override val isServing: Boolean

Whether at least one server is currently busy serving an entity.

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

The current number of entities being served.

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 onCreateProgressBar(callback: context(Simulator) (label: String, delay: Duration) -> Unit)

Registers a callback to be invoked when a progress bar should be displayed.

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 fun onStart()
Link copied to clipboard
open override fun properties(): List<DisplayProperty>

Provides display properties from the DelayProvider.

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