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§
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§
Sourcefn current_marking(&self) -> &Self::Marking
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.
Sourcefn current_step(&self) -> Step
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.
Sourcefn step(&mut self) -> Result<(), Error>
fn step(&mut self) -> Result<(), Error>
Advance the simulation by one step returning the marking after the step has been taken.
Sourcefn steps(&mut self, steps: Duration) -> Result<(), Error>
fn steps(&mut self, steps: Duration) -> Result<(), Error>
Advance the simulation by steps returning the marking after all steps were taken.
Sourcefn enabled(&self) -> Vec<NodeId>
fn enabled(&self) -> Vec<NodeId>
Return a list of node identifiers corresponding to all the enabled transitions at this step.
Sourcefn is_enabled(&self, transition: &Self::Transition) -> bool
fn is_enabled(&self, transition: &Self::Transition) -> bool
Return true if transition is enabled at this step, else false.
Provided Methods§
Sourcefn is_complete(&self) -> Option<bool>
fn is_complete(&self) -> Option<bool>
Not all nets can determine termination, if it is possible to determine termination return
Some(...), else None.