Simulation

Trait Simulation 

Source
pub trait Simulation: Debug {
    type Place: Place;
    type Transition: Transition;
    type Arc: Arc;
    type Net: Net<Place = Self::Place, Transition = Self::Transition, Arc = Self::Arc>;
    type Tokens: Tokens;
    type Marking: Marking<Tokens = Self::Tokens>;

    // Required methods
    fn net(&self) -> Rc<Self::Net>;
    fn current_marking(&self) -> &Self::Marking;
    fn current_step(&self) -> Step;
    fn step(&mut self) -> Result<(), Error>;
    fn steps(&mut self, steps: Duration) -> Result<(), Error>;
    fn enabled(&self) -> Vec<NodeId>;
    fn is_enabled(&self, transition: &Self::Transition) -> bool;

    // Provided method
    fn is_complete(&self) -> Option<bool> { ... }
}
Expand description

Required Associated Types§

Source

type Place: Place

Source

type Transition: Transition

Source

type Arc: Arc

Source

type Net: Net<Place = Self::Place, Transition = Self::Transition, Arc = Self::Arc>

Source

type Tokens: Tokens

Source

type Marking: Marking<Tokens = Self::Tokens>

Required Methods§

Source

fn net(&self) -> Rc<Self::Net>

Return a reference to the net that is being executed.

Source

fn current_marking(&self) -> &Self::Marking

Return a reference to the current marking of the net. If the simulation has not been advanced by calling step or steps this is the initial marking.

Source

fn current_step(&self) -> Step

Return the current step in the simulation. If the simulation has not been advanced by calling step or steps this is Step::ZERO.

Source

fn step(&mut self) -> Result<(), Error>

Advance the simulation by one step returning the marking after the step has been taken.

Source

fn steps(&mut self, steps: Duration) -> Result<(), Error>

Advance the simulation by steps returning the marking after all steps were taken.

Source

fn enabled(&self) -> Vec<NodeId>

Return a list of node identifiers corresponding to all the enabled transitions at this step.

Source

fn is_enabled(&self, transition: &Self::Transition) -> bool

Return true if transition is enabled at this step, else false.

Provided Methods§

Source

fn is_complete(&self) -> Option<bool>

Not all nets can determine termination, if it is possible to determine termination return Some(...), else None.

Implementors§