Simple process reaction

This commit is contained in:
elvis
2025-05-19 00:10:23 +02:00
parent f3d2644aff
commit d9e6f0981b
5 changed files with 241 additions and 129 deletions

View 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)))
}