Simple process reaction
This commit is contained in:
13
src/rsprocess/classical.rs
Normal file
13
src/rsprocess/classical.rs
Normal file
@ -0,0 +1,13 @@
|
||||
use super::structure::{RSset, RSreaction};
|
||||
|
||||
pub fn compute_step<'a>(current_state: &RSset<'a>, reaction: &RSreaction<'a>) -> RSset<'a> {
|
||||
if reaction.enabled(current_state) {
|
||||
reaction.products_clone()
|
||||
} else {
|
||||
RSset::new()
|
||||
}
|
||||
}
|
||||
|
||||
pub fn compute_all<'a>(current_state: &RSset<'a>, reactions: Vec<&RSreaction<'a>>) -> RSset<'a> {
|
||||
reactions.iter().fold(RSset::new(), |acc, r| acc.union(&compute_step(current_state, r)))
|
||||
}
|
||||
Reference in New Issue
Block a user