SplitNode

Splits entities into two outputs: a main output and a side output. Each incoming entity is processed by the splitter function to produce both outputs. The node remains ready only when the side destination is open.

Parameters

InputT

the type of incoming entities

MainOutputT

the type of entities sent to the main output

SideOutputT

the type of entities sent to the side output

ChannelT

the channel type (Push or Pull)

label

the name of this node

source

the input channel from which entities are received

mainDestination

the output channel for main entities

sideDestination

the output channel for side entities

splitter

the function that splits an entity into main and side outputs

Constructors

Link copied to clipboard
constructor(label: String, source: InputChannel<InputT, ChannelT>, mainDestination: OutputChannel<MainOutputT, ChannelT>, sideDestination: PushOutputChannel<SideOutputT>, splitter: (InputT) -> Pair<MainOutputT, SideOutputT>)

Properties

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

Functions

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

The node is ready only when the side destination is open.

Link copied to clipboard
open override fun onSplit(callback: context(Simulator) (InputT, MainOutputT, SideOutputT) -> Unit)

Registers a callback to be invoked when an entity is split.

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

Initializes readiness state on simulation start.

Link copied to clipboard
context(_: Simulator)
open override fun process(input: InputT): MainOutputT

Splits an input entity into main and side outputs using the provided splitter function.

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