Struct total_space::Model[][src]

pub struct Model<StateId: IndexLike, MessageId: IndexLike, InvalidId: IndexLike, ConfigurationId: IndexLike, Payload: DataLike, const MAX_AGENTS: usize, const MAX_MESSAGES: usize> { /* fields omitted */ }

A complete model.

Implementations

impl<StateId: IndexLike, MessageId: IndexLike, InvalidId: IndexLike, ConfigurationId: IndexLike, Payload: DataLike, const MAX_AGENTS: usize, const MAX_MESSAGES: usize> Model<StateId, MessageId, InvalidId, ConfigurationId, Payload, MAX_AGENTS, MAX_MESSAGES>[src]

pub fn with_validator(
    size: usize,
    last_agent_type: Rc<dyn AgentType<StateId, Payload>>,
    validator: Self::Validator
) -> Self
[src]

Create a new model, without computing anything yet, with a validation function.

pub fn new(
    size: usize,
    last_agent_type: Rc<dyn AgentType<StateId, Payload>>
) -> Self
[src]

Create a new model, without a validation function.

This allows querying the model for the agent_index of all the agents to use the results as a target for messages.

impl<StateId: IndexLike, MessageId: IndexLike, InvalidId: IndexLike, ConfigurationId: IndexLike, Payload: DataLike, const MAX_AGENTS: usize, const MAX_MESSAGES: usize> Model<StateId, MessageId, InvalidId, ConfigurationId, Payload, MAX_AGENTS, MAX_MESSAGES>[src]

pub fn add_condition(
    &mut self,
    name: &'static str,
    condition: Self::Condition,
    help: &'static str
)
[src]

Add a named condition for defining paths through the configuration space.

pub fn agents_count(&self) -> usize[src]

Return the total number of agents.

pub fn agent_label_index(&self, agent_label: &str) -> Option<usize>[src]

Return the index of the agent with the specified label.

pub fn agent_instance(&self, agent_index: usize) -> usize[src]

Return the index of the agent instance within its type.

pub fn agent_label(&self, agent_index: usize) -> &str[src]

Return the label (short name) of an agent.

pub fn is_valid(&self) -> bool[src]

Return whether all the reachable configurations are valid.

pub fn get_configuration(
    &self,
    configuration_id: ConfigurationId
) -> Self::Configuration
[src]

Access a configuration by its identifier.

pub fn get_message(&self, message_id: MessageId) -> Self::Message[src]

Access a message by its identifier.

impl<StateId: IndexLike, MessageId: IndexLike, InvalidId: IndexLike, ConfigurationId: IndexLike, Payload: DataLike, const MAX_AGENTS: usize, const MAX_MESSAGES: usize> Model<StateId, MessageId, InvalidId, ConfigurationId, Payload, MAX_AGENTS, MAX_MESSAGES>[src]

pub fn display_message_id(&self, message_id: MessageId) -> &str[src]

Display a message by its identifier.

pub fn display_message(&self, message: &Self::Message) -> String[src]

Display a message.

pub fn display_configuration_id(
    &self,
    configuration_id: ConfigurationId
) -> String
[src]

Display a configuration by its identifier.

Trait Implementations

impl<StateId: IndexLike, MessageId: IndexLike, InvalidId: IndexLike, ConfigurationId: IndexLike, Payload: DataLike, const MAX_AGENTS: usize, const MAX_MESSAGES: usize> ClapModel for Model<StateId, MessageId, InvalidId, ConfigurationId, Payload, MAX_AGENTS, MAX_MESSAGES>[src]

impl<StateId: IndexLike, MessageId: IndexLike, InvalidId: IndexLike, ConfigurationId: IndexLike, Payload: DataLike, const MAX_AGENTS: usize, const MAX_MESSAGES: usize> MetaModel for Model<StateId, MessageId, InvalidId, ConfigurationId, Payload, MAX_AGENTS, MAX_MESSAGES>[src]

type StateId = StateId

The type of state identifiers.

type MessageId = MessageId

The type of message identifiers.

type InvalidId = InvalidId

The type of invalid condition identifiers.

type ConfigurationId = ConfigurationId

The type of configuration identifiers.

type Payload = Payload

The type of message payloads.

type AgentTypeRc = Rc<dyn AgentType<StateId, Payload>>

The type of boxed agent type.

type Message = Message<Payload>

The type of in-flight messages.

type Reaction = Reaction<StateId, Payload>

The type of a event handling by an agent.

type Action = Action<StateId, Payload>

The type of an action from an agent.

type Emit = Emit<Payload>

The type of an emitted messages.

type Invalid = Invalid<MessageId>

The type of invalid conditions.

type Configuration = Configuration<StateId, MessageId, InvalidId, MAX_AGENTS, MAX_MESSAGES>

The type of the included configurations.

type ConfigurationHashEntry = (Configuration<StateId, MessageId, InvalidId, MAX_AGENTS, MAX_MESSAGES>, ConfigurationId)

The type of a hash table entry for the configurations (should be cache-friendly).

type Validator = fn(_: &Self, _: &Configuration<StateId, MessageId, InvalidId, MAX_AGENTS, MAX_MESSAGES>) -> Option<&'static str>

The type of a configuration validation function.

type Condition = fn(_: &Self, _: &Configuration<StateId, MessageId, InvalidId, MAX_AGENTS, MAX_MESSAGES>) -> bool

A condition on model configurations.

Auto Trait Implementations

impl<StateId, MessageId, InvalidId, ConfigurationId, Payload, const MAX_AGENTS: usize, const MAX_MESSAGES: usize> !RefUnwindSafe for Model<StateId, MessageId, InvalidId, ConfigurationId, Payload, MAX_AGENTS, MAX_MESSAGES>

impl<StateId, MessageId, InvalidId, ConfigurationId, Payload, const MAX_AGENTS: usize, const MAX_MESSAGES: usize> !Send for Model<StateId, MessageId, InvalidId, ConfigurationId, Payload, MAX_AGENTS, MAX_MESSAGES>

impl<StateId, MessageId, InvalidId, ConfigurationId, Payload, const MAX_AGENTS: usize, const MAX_MESSAGES: usize> !Sync for Model<StateId, MessageId, InvalidId, ConfigurationId, Payload, MAX_AGENTS, MAX_MESSAGES>

impl<StateId, MessageId, InvalidId, ConfigurationId, Payload, const MAX_AGENTS: usize, const MAX_MESSAGES: usize> Unpin for Model<StateId, MessageId, InvalidId, ConfigurationId, Payload, MAX_AGENTS, MAX_MESSAGES> where
    ConfigurationId: Unpin,
    InvalidId: Unpin,
    MessageId: Unpin,
    Payload: Unpin,
    StateId: Unpin

impl<StateId, MessageId, InvalidId, ConfigurationId, Payload, const MAX_AGENTS: usize, const MAX_MESSAGES: usize> !UnwindSafe for Model<StateId, MessageId, InvalidId, ConfigurationId, Payload, MAX_AGENTS, MAX_MESSAGES>

Blanket Implementations

impl<T> Any for T where
    T: 'static + ?Sized
[src]

impl<T> Borrow<T> for T where
    T: ?Sized
[src]

impl<T> BorrowMut<T> for T where
    T: ?Sized
[src]

impl<T> From<T> for T[src]

impl<T, U> Into<U> for T where
    U: From<T>, 
[src]

impl<T, U> TryFrom<U> for T where
    U: Into<T>, 
[src]

type Error = Infallible

The type returned in the event of a conversion error.

impl<T, U> TryInto<U> for T where
    U: TryFrom<T>, 
[src]

type Error = <U as TryFrom<T>>::Error

The type returned in the event of a conversion error.