Refactoring names of structures, removing useless functions
This commit is contained in:
@ -13,7 +13,7 @@ impl<'a> TransitionsIterator<'a> {
|
||||
pub fn from(
|
||||
system: &'a RSsystem
|
||||
) -> Result<TransitionsIterator<'a>, String> {
|
||||
match unfold(system.get_delta(), system.get_context_process()) {
|
||||
match unfold(&system.delta, &system.context_process) {
|
||||
Ok(o) => Ok(TransitionsIterator {
|
||||
choices_iterator: o.into_iter(),
|
||||
system,
|
||||
@ -28,9 +28,9 @@ impl<'a> Iterator for TransitionsIterator<'a> {
|
||||
|
||||
fn next(&mut self) -> Option<(RSlabel, RSsystem)> {
|
||||
let (c, k) = self.choices_iterator.next()?;
|
||||
let t = self.system.get_available_entities().union(c.as_ref());
|
||||
let t = self.system.available_entities.union(c.as_ref());
|
||||
let (reactants, reactantsi, inihibitors, ireactants, products) =
|
||||
self.system.get_reaction_rules().iter().fold(
|
||||
self.system.reaction_rules.iter().fold(
|
||||
(
|
||||
RSset::new(), // reactants
|
||||
RSset::new(), // reactantsi
|
||||
@ -41,18 +41,18 @@ impl<'a> Iterator for TransitionsIterator<'a> {
|
||||
|acc, reaction| {
|
||||
if reaction.enabled(&t) {
|
||||
(
|
||||
acc.0.union(reaction.reactants()),
|
||||
acc.0.union(&reaction.reactants),
|
||||
acc.1,
|
||||
acc.2.union(reaction.inihibitors()),
|
||||
acc.2.union(&reaction.inihibitors),
|
||||
acc.3,
|
||||
acc.4.union(reaction.products()),
|
||||
acc.4.union(&reaction.products),
|
||||
)
|
||||
} else {
|
||||
(
|
||||
acc.0,
|
||||
acc.1.union(&reaction.inihibitors().intersection(&t)),
|
||||
acc.1.union(&reaction.inihibitors.intersection(&t)),
|
||||
acc.2,
|
||||
acc.3.union(&reaction.reactants().subtraction(&t)),
|
||||
acc.3.union(&reaction.reactants.subtraction(&t)),
|
||||
acc.4,
|
||||
)
|
||||
}
|
||||
@ -60,7 +60,7 @@ impl<'a> Iterator for TransitionsIterator<'a> {
|
||||
);
|
||||
|
||||
let label = RSlabel::from(
|
||||
self.system.get_available_entities().clone(),
|
||||
self.system.available_entities.clone(),
|
||||
(*c).clone(),
|
||||
t,
|
||||
reactants,
|
||||
@ -70,10 +70,10 @@ impl<'a> Iterator for TransitionsIterator<'a> {
|
||||
products.clone(),
|
||||
);
|
||||
let new_system = RSsystem::from(
|
||||
Rc::clone(self.system.get_delta()),
|
||||
Rc::clone(&self.system.delta),
|
||||
products,
|
||||
(*k).clone(),
|
||||
Rc::clone(self.system.get_reaction_rules()),
|
||||
Rc::clone(&self.system.reaction_rules),
|
||||
);
|
||||
Some((label, new_system))
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user