ForkStation

class ForkStation(parent: ModelElement, join: JoinStation, childCount: ChildCountIfc, childFactory: ChildFactoryIfc? = null, childReceiver: QObjectReceiverIfc = NotImplementedReceiver, nextReceiver: QObjectReceiverIfc = NotImplementedReceiver, name: String? = null) : ModelElement, QObjectReceiverIfc, RoutingOutletsIfc, ForkStationCIfc(source)

The send-side of a fork-join pair: receives a parent QObject, spawns a variable number of children, and routes the parent onward concurrently with the children. Children are created by childFactory and registered with the paired join so it can reunite them with the parent.

Spawning is synchronous (event-graph): the children are emitted to childReceiver and the parent is emitted to its onward receiver within the same receive call. The two paths can include any number of stations before the join's parent and child inputs.

Children are internal to the network — they are not counted in the owning network's number-in-system (they are not received at an ingress) and they are absorbed at the join (they never reach a sink). The parent carries the network's NS and completion accounting.

The child QObjects are created by the fork (since QObject is an inner class of ModelElement); childFactory only configures each freshly created child (set type, attach value object, etc.) — same idiom as a source station's marking action. Supply null for a default child.

Parameters

parent

the model element serving as this station's parent

join

the paired JoinStation that will reunite the children with the parent

childCount

how many children to spawn for a given parent (must return >= 1)

childFactory

optional per-child configuration applied to each freshly created child; null means an unconfigured QObject

childReceiver

where each newly created child is first sent

nextReceiver

where the parent continues

name

the name of the station

Constructors

Link copied to clipboard
constructor(parent: ModelElement, join: JoinStation, childCount: ChildCountIfc, childFactory: ChildFactoryIfc? = null, childReceiver: QObjectReceiverIfc = NotImplementedReceiver, nextReceiver: QObjectReceiverIfc = NotImplementedReceiver, name: String? = null)

Properties

Link copied to clipboard
open override val hasOnwardRouting: Boolean

True if this node has any onward routing configured (a static next receiver, a station-level sender, or a class route). A non-terminal node for which this is false — and which is not a non-terminal step of a registered route — is a dangling node and fails validation.

Link copied to clipboard
open override val numChildrenCreated: CounterCIfc

The total number of children spawned.

Link copied to clipboard
open override val numForked: CounterCIfc

The number of parents that have entered (forked).

Functions

Link copied to clipboard

Sets the receiver that newly spawned children are sent to.

Link copied to clipboard

Sets the receiver the parent continues to.

Link copied to clipboard
open override fun outlets(): List<QObjectReceiverIfc>

The statically known receivers this node may route to. Best-effort: empty when the node has no static link or when its routing is opaque (for example, a probabilistic sender whose destinations are not introspectable).

Link copied to clipboard
open override fun receive(arrivingQObject: ModelElement.QObject)