sbml_rs/structs/
initial_assignments.rs

1use crate::{MathTag, Model, Tag, TagIndex};
2
3#[derive(Clone, Debug, Default)]
4pub struct ListOfInitialAssignments {
5    pub initial_assignments: Vec<TagIndex>,
6    pub parent: Option<TagIndex>,
7}
8
9#[derive(Debug, Default, Clone)]
10pub struct InitialAssignment {
11    pub id: Option<String>,
12    pub symbol: Option<String>,
13    pub sbo_term: Option<String>,
14    pub math: Option<TagIndex>,
15    pub parent: Option<TagIndex>,
16}
17
18impl InitialAssignment {
19    pub fn math_tag(&self, model: &Model) -> Option<MathTag> {
20        let mut result = None;
21        if let Some(math_tag_idx) = self.math {
22            if let Tag::MathTag(math_tag) = &model.nodes[math_tag_idx] {
23                result = Some(math_tag.clone());
24            }
25        }
26        result
27    }
28}