generalized_suffix_tree/suffix_node/
node.rs1#[cfg(feature = "non_crypto_hash")]
2use fxhash::FxHashMap as HashMap;
3#[cfg(not(feature = "non_crypto_hash"))]
4use std::collections::HashMap;
5
6use crate::data::tree_item::Character;
7use core::fmt::{Debug, Display};
8
9pub type NodeID = usize;
10pub type StringID = usize;
11
12pub trait SuffixNode<T>
13where
14 T: PartialEq + Display + Debug + PartialOrd
15{
16 fn set_parent(&mut self, parent: NodeID);
17 fn get_parent(&self)->Option<&NodeID>;
18 fn get_child(&self, child:&Character<T>)->Option<&NodeID>;
19 fn get_child_mut(&mut self, child:&Character<T>)->Option<&mut NodeID>;
20 fn set_child(&mut self, edge:Character<T>, child:NodeID);
21 fn set_edge_length(&mut self, edge_length:usize);
22 fn get_end(&self)->usize;
23 fn get_edge_length(&self)-> usize;
24 fn get_string_id(&self)->Option<&StringID>;
25 fn set_string_id(&mut self, string_id:StringID);
26 fn get_start(&self)->&usize;
27 fn set_start(&mut self, new_start:usize);
28 fn has_children(&self)->bool;
29 fn get_children(&self)->&HashMap<Character<T>, NodeID>;
30 fn is_leaf(&self)->bool;
31}