This commit is contained in:
elvis
2025-11-12 17:33:36 +01:00
parent 0e49dfa4fb
commit b8d885f774
7 changed files with 30 additions and 14 deletions

View File

@ -727,8 +727,10 @@ pub fn dot(
let graph = Arc::new(graph.to_owned()); let graph = Arc::new(graph.to_owned());
let node_formatter = node_color let node_formatter = node_color.generate(
.generate(Arc::clone(&graph), system.translator.encode_not_mut("*")); Arc::clone(&graph),
system.translator.encode_not_mut("*"),
);
let edge_formatter = edge_color.generate(Arc::clone(&graph)); let edge_formatter = edge_color.generate(Arc::clone(&graph));
let dot = dot::Dot::with_attr_getters( let dot = dot::Dot::with_attr_getters(

View File

@ -714,8 +714,10 @@ impl EdgeDisplay {
Box::new(move |i, n| { Box::new(move |i, n| {
let mut accumulator = String::new(); let mut accumulator = String::new();
for b in &self.base { for b in &self.base {
let f = b let f = b.match_edge_display(
.match_edge_display(Arc::clone(&translator), common.clone()); Arc::clone(&translator),
common.clone(),
);
accumulator.push_str(&(f)(i, n)); accumulator.push_str(&(f)(i, n));
} }
accumulator accumulator
@ -862,7 +864,11 @@ impl NodeColorConditional {
use super::format_helpers::node_formatter::*; use super::format_helpers::node_formatter::*;
match self { match self {
| Self::ContextConditional(ContextColorConditional::Nill) => | Self::ContextConditional(ContextColorConditional::Nill) =>
format_nill(Arc::clone(&original_graph), color.to_string(), star), format_nill(
Arc::clone(&original_graph),
color.to_string(),
star,
),
| Self::ContextConditional( | Self::ContextConditional(
ContextColorConditional::RecursiveIdentifier(s), ContextColorConditional::RecursiveIdentifier(s),
) => format_recursive_identifier( ) => format_recursive_identifier(
@ -920,7 +926,11 @@ impl NodeColorConditional {
use super::format_helpers::positive_node_formatter::*; use super::format_helpers::positive_node_formatter::*;
match self { match self {
| Self::ContextConditional(ContextColorConditional::Nill) => | Self::ContextConditional(ContextColorConditional::Nill) =>
format_nill(Arc::clone(&original_graph), color.to_string(), star), format_nill(
Arc::clone(&original_graph),
color.to_string(),
star,
),
| Self::ContextConditional( | Self::ContextConditional(
ContextColorConditional::RecursiveIdentifier(s), ContextColorConditional::RecursiveIdentifier(s),
) => format_recursive_identifier( ) => format_recursive_identifier(

View File

@ -32,7 +32,9 @@ where
// ----------------------------------------------------------------------------- // -----------------------------------------------------------------------------
#[derive(Clone, Debug, PartialEq, Eq, Hash, Serialize, Deserialize, Default)] #[derive(
Clone, Debug, PartialEq, Eq, Hash, Serialize, Deserialize, Default,
)]
pub enum Process { pub enum Process {
#[default] #[default]
Nill, Nill,
@ -242,7 +244,9 @@ impl PrintableWithTranslator for Process {
// ----------------------------------------------------------------------------- // -----------------------------------------------------------------------------
#[derive(Clone, Debug, PartialEq, Eq, Hash, Serialize, Deserialize, Default)] #[derive(
Clone, Debug, PartialEq, Eq, Hash, Serialize, Deserialize, Default,
)]
pub enum PositiveProcess { pub enum PositiveProcess {
#[default] #[default]
Nill, Nill,

View File

@ -316,8 +316,8 @@ impl Reaction {
pub fn into_positive_reactions( pub fn into_positive_reactions(
reactions: &[Self], reactions: &[Self],
) -> Vec<PositiveReaction> { ) -> Vec<PositiveReaction> {
let reactions = let reactions = reactions
reactions.iter() .iter()
.filter(|r| !r.reactants.is_empty() || !r.inhibitors.is_empty()) .filter(|r| !r.reactants.is_empty() || !r.inhibitors.is_empty())
.cloned() .cloned()
.collect::<Vec<Self>>(); .collect::<Vec<Self>>();
@ -325,7 +325,6 @@ impl Reaction {
let mut res = vec![]; let mut res = vec![];
let old_reactions = &reactions; let old_reactions = &reactions;
let all_products = Reaction::all_products(old_reactions); let all_products = Reaction::all_products(old_reactions);
for el in all_products { for el in all_products {
let p = Reaction::all_reactions_with_product(old_reactions, &el); let p = Reaction::all_reactions_with_product(old_reactions, &el);

View File

@ -237,7 +237,7 @@ impl Set {
inhibitors: &[Set], inhibitors: &[Set],
) -> Result<Vec<PositiveSet>, String> { ) -> Result<Vec<PositiveSet>, String> {
if reactants.is_empty() && inhibitors.is_empty() { if reactants.is_empty() && inhibitors.is_empty() {
return Ok(vec![]) return Ok(vec![]);
} }
if reactants.len() != inhibitors.len() { if reactants.len() != inhibitors.len() {
return Err(format!( return Err(format!(

View File

@ -1,7 +1,8 @@
use std::sync::Arc;
use super::set::PositiveSet; use super::set::PositiveSet;
use super::system::BasicSystem; use super::system::BasicSystem;
use crate::system::ExtensionsSystem; use crate::system::ExtensionsSystem;
use std::sync::Arc;
#[test] #[test]
fn one_transition() { fn one_transition() {

View File

@ -1,7 +1,7 @@
use std::fmt::Debug; use std::fmt::Debug;
use std::ops::{Index, IndexMut}; use std::ops::{Index, IndexMut};
use std::sync::Arc;
use std::slice::SliceIndex; use std::slice::SliceIndex;
use std::sync::Arc;
use serde::{Deserialize, Serialize}; use serde::{Deserialize, Serialize};