pub trait AgentType<StateId: IndexLike, Payload: DataLike>: AgentInstances<StateId, Payload> {
// Required methods
fn reaction(
&self,
instance: usize,
state_ids: &[StateId],
payload: &Payload,
) -> Reaction<StateId, Payload>;
fn activity(
&self,
instance: usize,
state_ids: &[StateId],
) -> Activity<Payload>;
fn state_is_deferring(&self, instance: usize, state_ids: &[StateId]) -> bool;
fn state_invalid_because(
&self,
instance: usize,
state_ids: &[StateId],
) -> Option<&'static str>;
fn state_max_in_flight_messages(
&self,
instance: usize,
state_ids: &[StateId],
) -> Option<usize>;
fn states_count(&self) -> usize;
fn compute_terse(&self);
}
Expand description
A trait fully describing some agent instances of the same type.
Required Methods§
Sourcefn reaction(
&self,
instance: usize,
state_ids: &[StateId],
payload: &Payload,
) -> Reaction<StateId, Payload>
fn reaction( &self, instance: usize, state_ids: &[StateId], payload: &Payload, ) -> Reaction<StateId, Payload>
Return the actions that may be taken by an agent instance with some state when receiving a payload.
Sourcefn activity(&self, instance: usize, state_ids: &[StateId]) -> Activity<Payload>
fn activity(&self, instance: usize, state_ids: &[StateId]) -> Activity<Payload>
Return the actions that may be taken by an agent with some state when time passes.
Sourcefn state_is_deferring(&self, instance: usize, state_ids: &[StateId]) -> bool
fn state_is_deferring(&self, instance: usize, state_ids: &[StateId]) -> bool
Whether any agent in the state is deferring messages.
Sourcefn state_invalid_because(
&self,
instance: usize,
state_ids: &[StateId],
) -> Option<&'static str>
fn state_invalid_because( &self, instance: usize, state_ids: &[StateId], ) -> Option<&'static str>
Return a reason that a state is invalid (unless it is valid).
Sourcefn state_max_in_flight_messages(
&self,
instance: usize,
state_ids: &[StateId],
) -> Option<usize>
fn state_max_in_flight_messages( &self, instance: usize, state_ids: &[StateId], ) -> Option<usize>
The maximal number of messages sent by an agent which may be in-flight when it is in the state.
Sourcefn states_count(&self) -> usize
fn states_count(&self) -> usize
The total number of states seen so far.
Sourcefn compute_terse(&self)
fn compute_terse(&self)
Compute mapping from full states to terse states (name only).