Adding documentation for classical.rs, modifying compute_step with pointers

This commit is contained in:
elvis
2025-05-19 13:10:05 +02:00
parent 6d5be8c36c
commit 32c2fc2701
3 changed files with 35 additions and 6 deletions

View File

@ -40,12 +40,24 @@ impl<'a> RSset<'a> {
self.identifiers.is_disjoint(&b.identifiers)
}
#[allow(dead_code)]
pub fn union(&self, b: &RSset<'a>) -> RSset<'a> {
// TODO maybe find more efficient way
let mut ret: RSset = b.clone();
ret.identifiers.extend(self.identifiers.iter());
ret
}
pub fn union_option(&self, b: Option<&RSset<'a>>) -> RSset<'a> {
if let Some(b) = b {
// TODO maybe find more efficient way
let mut ret: RSset = b.clone();
ret.identifiers.extend(self.identifiers.iter());
ret
} else {
self.clone()
}
}
}
@ -61,6 +73,7 @@ pub struct RSreaction<'a> {
}
impl<'a> RSreaction<'a> {
#[allow(dead_code)]
pub fn new() -> Self {
RSreaction{ reactants: RSset::new(),
inihibitors: RSset::new(),
@ -78,9 +91,14 @@ impl<'a> RSreaction<'a> {
&& self.inihibitors.is_disjoint(current_state)
}
#[allow(dead_code)]
pub fn products_clone(&self) -> RSset<'a> {
self.products.clone()
}
pub fn products(&self) -> &RSset<'a> {
&self.products
}
}