Animation Sink
The destination for AnimationEvents produced during a simulation run.
The model holds a single sink (reached as model.animationSink, decision D1). When animation is not configured the sink is NullAnimationSink, whose isActive is false.
Every emission site in the simulation follows the same guarded pattern so that no event object is constructed when animation is off (requirement F4):
val sink = model.animationSink
if (sink.isActive) sink.emit(AnimationEvent.DelayStarted(time, id, duration, arrival))Because NullAnimationSink.isActive is a constant false, the JIT can elide the guarded block entirely, making disabled animation effectively free.
The lifecycle callbacks (onReplicationStart, onReplicationEnd, onExperimentEnd) let a sink manage per-run resources — for example, MemoryBufferedAnimationSink flushes accumulated events on onReplicationEnd, and an asynchronous sink closes its writer on onExperimentEnd (requirement F12). They default to no-ops so simple sinks need not implement them.
Threading note: emit is called on the simulation thread. Implementations that hand work to another thread are responsible for their own safe publication.
Inheritors
Properties
Functions
Called once after the final replication of the experiment.
Called at the end of replication replicationNumber (1-based).
Called at the start of replication replicationNumber (1-based).