use crate::Ontology;
use core::fmt::Debug;
pub mod group;
mod hpoterm;
mod hpotermid;
mod information_content;
pub(crate) mod internal;
pub use group::HpoGroup;
pub use hpoterm::HpoTerm;
pub use hpotermid::HpoTermId;
pub use information_content::{InformationContent, InformationContentKind};
pub struct Iter<'a> {
group_iter: group::Iter<'a>,
ontology: &'a Ontology,
}
impl<'a> Iter<'a> {
pub(crate) fn new(group_iter: group::Iter<'a>, ontology: &'a Ontology) -> Self {
Self {
group_iter,
ontology,
}
}
}
impl<'a> Iterator for Iter<'a> {
type Item = HpoTerm<'a>;
fn next(&mut self) -> Option<Self::Item> {
match self.group_iter.next() {
Some(term) => {
let term = self
.ontology
.get(term)
.unwrap_or_else(|| panic!("Invalid HPO-Term: {term}"));
Some(HpoTerm::new(self.ontology, term))
}
None => None,
}
}
}
impl Debug for Iter<'_> {
fn fmt(&self, f: &mut std::fmt::Formatter<'_>) -> std::fmt::Result {
write!(f, "Iter<HpoTerm>")
}
}