Added guarded context

This commit is contained in:
elvis
2025-08-20 13:51:48 +02:00
parent 331635981a
commit d4ade0d921
4 changed files with 53 additions and 42 deletions

View File

@ -143,7 +143,7 @@ impl IntoIterator for RSset {
// -----------------------------------------------------------------------------
/// Basic structure for a reaction.
#[derive(Clone, Debug, Serialize, Deserialize)]
#[derive(Clone, Debug, Serialize, Deserialize, PartialEq, Eq, Hash)]
pub struct RSreaction {
pub reactants: RSset,
pub inhibitors: RSset,
@ -195,6 +195,10 @@ pub enum RSprocess {
entities: RSset,
next_process: Rc<RSprocess>,
},
Guarded {
reaction: RSreaction,
next_process: Rc<RSprocess>,
},
WaitEntity {
repeat: i64,
repeated_process: Rc<RSprocess>,
@ -248,6 +252,12 @@ impl RSprocess {
elements.push(entities);
queue.push_back(next_process);
}
Self::Guarded { reaction, next_process } => {
elements.push(&reaction.reactants);
elements.push(&reaction.inhibitors);
elements.push(&reaction.products);
queue.push_back(next_process);
}
Self::WaitEntity {
repeat: _,
repeated_process,