AgentPositionSampler

class AgentPositionSampler<A : AgentLike>(parent: ModelElement, projection: ContinuousProjection<A>, samplingInterval: Double, name: String? = null) : ModelElement(source)

The non-invasive, opt-in agent-position capture (decision D6 option b): a model element that, every samplingInterval simulated time units, reads each agent's position in projection and emits an AnimationEvent.AgentPositionSampled. It does not touch the agent package; it only reads positions.

This is coarser than the projection placeAt/moveTo hook (the default, decision D6 option a / Phase 3A.1): it samples on a fixed clock, so sub-interval motion is aliased. Use it when an engine touch is undesirable; use the hook for full fidelity.

Parameters

parent

the model element to attach to (e.g. the agent model)

projection

the continuous projection whose agents' positions to sample

samplingInterval

the time between samples (> 0)

name

optional element name

Constructors

Link copied to clipboard
constructor(parent: ModelElement, projection: ContinuousProjection<A>, samplingInterval: Double, name: String? = null)

Functions

Link copied to clipboard
protected open override fun initialize()

This method should be overridden by subclasses that need actions performed to initialize prior to a replication. It is called once before each replication occurs if the model element wants initialization. It is called after beforeReplication() is called