mirror of
https://github.com/bitcoinresearchkit/brk.git
synced 2026-04-26 23:59:58 -07:00
parser: add 0 and 1 constant datasets
This commit is contained in:
@@ -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]
|
||||
}
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user