Sanity checks if functional dependencies are valid. For example, if there are 10 fields, we cannot receive any index further than 9.
(&self, n_field: usize)
| 244 | /// Sanity checks if functional dependencies are valid. For example, if |
| 245 | /// there are 10 fields, we cannot receive any index further than 9. |
| 246 | pub fn is_valid(&self, n_field: usize) -> bool { |
| 247 | self.deps.iter().all( |
| 248 | |FunctionalDependence { |
| 249 | source_indices, |
| 250 | target_indices, |
| 251 | .. |
| 252 | }| { |
| 253 | source_indices |
| 254 | .iter() |
| 255 | .max() |
| 256 | .map(|&max_index| max_index < n_field) |
| 257 | .unwrap_or(true) |
| 258 | && target_indices |
| 259 | .iter() |
| 260 | .max() |
| 261 | .map(|&max_index| max_index < n_field) |
| 262 | .unwrap_or(true) |
| 263 | }, |
| 264 | ) |
| 265 | } |
| 266 | |
| 267 | /// Adds the `offset` value to `source_indices` and `target_indices` for |
| 268 | /// each functional dependency. |
no test coverage detected