parser: add 0 and 1 constant datasets

This commit is contained in:
k
2024-07-12 12:55:46 +02:00
parent 46f8e3bafd
commit 68700925b0
3 changed files with 19 additions and 11 deletions

View File

@@ -9,6 +9,8 @@ pub struct ConstantDataset {
min_initial_states: MinInitialStates,
// Computed
pub _0: BiMap<u16>,
pub _1: BiMap<u16>,
pub _50: BiMap<u16>,
pub _100: BiMap<u16>,
}
@@ -20,6 +22,8 @@ impl ConstantDataset {
let mut s = Self {
min_initial_states: MinInitialStates::default(),
_0: BiMap::new_bin(1, &f("0")),
_1: BiMap::new_bin(1, &f("1")),
_50: BiMap::new_bin(1, &f("50")),
_100: BiMap::new_bin(1, &f("100")),
};
@@ -31,8 +35,9 @@ impl ConstantDataset {
}
pub fn compute(&mut self, &ComputeData { heights, dates }: &ComputeData) {
self._0.multi_insert_const(heights, dates, 0);
self._1.multi_insert_const(heights, dates, 1);
self._50.multi_insert_const(heights, dates, 50);
self._100.multi_insert_const(heights, dates, 100);
}
}
@@ -43,10 +48,10 @@ impl AnyDataset for ConstantDataset {
}
fn to_computed_bi_map_vec(&self) -> Vec<&(dyn AnyBiMap + Send + Sync)> {
vec![&self._50, &self._100]
vec![&self._0, &self._1, &self._50, &self._100]
}
fn to_computed_mut_bi_map_vec(&mut self) -> Vec<&mut dyn AnyBiMap> {
vec![&mut self._50, &mut self._100]
vec![&mut self._0, &mut self._1, &mut self._50, &mut self._100]
}
}