ResourceAnimationEmitter

An AllocationListenerIfc that animates a Resource: on each allocation it emits an AnimationEvent.SeizeAllocated (which entity got how many units), on each deallocation an AnimationEvent.Released, and after either it emits an AnimationEvent.ResourceStateChanged reporting the resource's new state name, busy-unit count, and capacity. Register one with resource.addAllocationListener(ResourceAnimationEmitter(resource)); the resource is unchanged.

Per the design's division of responsibility (decision D4), this listener owns the resource's state and the canonical allocate/release events; the entity-experience events (SeizeQueued/SeizeWaiting) are emitted separately from the process coroutine, so there is no duplication. Because SResource (the station-package resource) is a different type that does not fire AllocationListenerIfc, it has its own emitter (Phase 2B) — this one is for the process-view Resource.

The resource notifies its listeners after applying the allocate/deallocate, so the state read here is already up to date.

Parameters

resource

the resource this emitter is attached to

Constructors

Link copied to clipboard
constructor(resource: Resource)

Functions

Link copied to clipboard
open override fun allocate(allocation: Allocation)
Link copied to clipboard
open override fun deallocate(allocation: Allocation)