SResourceAnimationEmitter

Emits an AnimationEvent.ResourceStateChanged whenever the station-package SResource changes state. This is the station counterpart to ksl.animation.emitters.ResourceAnimationEmitter (Phase 2.2): SResource is a different type that does not fire AllocationListenerIfc, so it needs its own emitter.

It observes the resource's busy-count response — incremented on seize, decremented on release — so every busy/idle transition produces an event; and it listens for failures via ResourceFailureListenerIfc so the failed state is captured too. Register with both:

val emitter = SResourceAnimationEmitter(resource)
(resource.numBusyUnits as ModelElement).attachModelElementObserver(emitter)
resource.attachResourceFailureListener(emitter)

The reported state is one of "Failed", "Busy", "Idle", or "Inactive"; busy units are capacity - numAvailableUnits. The resource is unchanged.

Parameters

resource

the station resource to animate

Constructors

Link copied to clipboard
constructor(resource: SResource)

Functions

Link copied to clipboard
open override fun resourceFailed(resource: StationResourceIfc)

Fired when the resource fails.

Link copied to clipboard
protected open override fun update(modelElement: ModelElement)

Fired when the busy-count response changes (seize/release).