smlm_hawk_core/config/
algorithm_config.rs1use super::{OutputStyle, NegativeHandling};
2
3const DEFAULT_LEVELS: u64 = 3;
4
5#[derive(Debug, PartialEq, Clone, Copy)]
6pub struct AlgorithmConfig
7{
8 n_levels: u64,
9 output_style: OutputStyle,
10 negative_handling : NegativeHandling
11}
12
13impl AlgorithmConfig
14{
15
16 pub fn new(n_levels: u64, output_style: OutputStyle, negative_handling: NegativeHandling) -> Self
17 {
18 Self
19 {
20 n_levels,
21 output_style,
22 negative_handling
23 }
24 }
25
26 pub fn with_n_levels(mut self, n_levels: u64) -> Self
27 {
28 self.n_levels = n_levels;
29 self
30 }
31
32 pub fn with_negative_handling(mut self, negative_handling: NegativeHandling) -> Self
33 {
34 self.negative_handling = negative_handling;
35 self
36 }
37
38 pub fn with_output_style(mut self, output_style: OutputStyle) -> Self
39 {
40 self.output_style = output_style;
41 self
42 }
43
44 pub fn n_levels(&self) -> u64
45 {
46 self.n_levels
47 }
48
49 pub fn output_style(&self) -> OutputStyle
50 {
51 self.output_style
52 }
53
54 pub fn negative_handling(&self) -> NegativeHandling
55 {
56 self.negative_handling
57 }
58}
59
60impl Default for AlgorithmConfig
61{
62 fn default() -> Self
63 {
64 Self::new(DEFAULT_LEVELS, OutputStyle::Sequential, NegativeHandling::Absolute)
65 }
66}
67
68
69#[cfg(test)]
70mod tests
71{
72 use super::*;
73
74 #[test]
75 fn algorithm_config_default_test()
76 {
77 assert_eq!(AlgorithmConfig::default(), AlgorithmConfig::new(3, OutputStyle::Sequential, NegativeHandling::Absolute))
78 }
79}