Agent

open inner class Agent(aName: String? = null) : ProcessModel.Entity, AgentLike(source)

Constructors

Link copied to clipboard
constructor(aName: String? = null)

Properties

Link copied to clipboard

Default mailbox for receiving AgentMessage traffic. Routes through the enclosing AgentModel's shared message bus.

Link copied to clipboard
open override var statechart: AgentModel.Statechart?

Optional statechart governing this agent's reactive behavior. Default null for AgentLike implementations that don't provide a statechart abstraction. The concrete agent types (AgentModel.Agent, AgentModel.PermanentAgent, AgentResource) each override this with their own backing field.

Functions

Link copied to clipboard

Build a statechart without installing it. Use to define alternative behaviors that can be selected via useStatechart — at construction time (e.g., per-instance design variants) or between runs (e.g., a Controls-package parameter that selects which design the next simulate() exercises).

Link copied to clipboard

Reports a state change for animation (8I.2). For a plain-field agent (no statechart), call this whenever the agent's state changes to drive state-based coloring (agentStateColor). A no-op when no animation sink is installed.

Link copied to clipboard

Declare and install this agent's statechart in one step. May be called at most once per agent (use buildStatechart + useStatechart for the multi-variant case). If the simulation is already running (runtime creation), the chart starts immediately; otherwise AgentModel.initialize starts it at the beginning of each replication.

Link copied to clipboard

Gracefully stop the agent's active statechart, if any. Tears down its triggers and subscriptions and deregisters it. The agent persists; a different chart may be selected via useStatechart and started. Idempotent.

Link copied to clipboard

Select the agent's active statechart. Allowed only when the current chart (if any) is not started — between runs, before activation, or after the current chart has stopped / reached a final state. Throws otherwise. If the model is running when this is called, the new chart starts immediately; otherwise AgentModel.initialize starts it at the next replication.