Agent
Properties
Default mailbox for receiving AgentMessage traffic. A send to this agent delivers into it directly, in the sender's call.
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
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).
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.
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.
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.
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.