Get the value for a node. Returns None if missing.
(&self, node_id: u32)
| 147 | |
| 148 | /// Get the value for a node. Returns None if missing. |
| 149 | pub fn get(&self, node_id: u32) -> Option<f64> { |
| 150 | let idx = node_id as usize; |
| 151 | if idx < self.values.len() && (self.present[idx / 64] & (1u64 << (idx % 64))) != 0 { |
| 152 | Some(self.values[idx]) |
| 153 | } else { |
| 154 | None |
| 155 | } |
| 156 | } |
| 157 | |
| 158 | /// Get the value or a default. |
| 159 | pub fn get_or(&self, node_id: u32, default: f64) -> f64 { |