pub fn look_up(&self, paths: &[(usize, Vec<usize>)]) -> Option<(RangeInfo, Vec<IndexedPath>)> {
        let min_nb_digits = self.oracle_numeric_infos.get_min_nb_digits();
        // Take all the paths that have a max value of base^min_nb_digits - 1, and
        // shorten them to min_nb_digits.
        let stripped_paths = paths
            .iter()
            .filter_map(|x| {
                let extra_len = x.1.len().checked_sub(min_nb_digits)?;
                if extra_len == 0 {
                    Some((x.0, x.1.clone()))
                } else if x.1.iter().take(extra_len).all(|x| *x == 0) {
                    let mut cloned = x.1.clone();
                    cloned.drain(..extra_len);
                    Some((x.0, cloned))
                } else {
                    None
                }
            })
            .collect::<Vec<_>>();
        // Try to get the combinations of at least threshold oracles that agree on the outcome.
        let agreeing_combinations = self.get_agreeing_oracles(&stripped_paths);
        if let Some(sufficient_combinations) = agreeing_combinations {
            for (path, combination) in sufficient_combinations {
                debug_assert_eq!(
                    path.len(),
                    min_nb_digits,
                    "Expected length {} got length {}",
                    min_nb_digits,
                    path.len()
                );

                if let Some(res) = self.digit_trie.look_up(&path) {
                    let sufficient_combination: Vec<_> =
                        combination.into_iter().take(self.threshold).collect();
                    if let Some(position) = CombinationIterator::new(
                        self.oracle_numeric_infos.nb_digits.len(),
                        self.threshold,
                    )
                    .get_index_for_combination(&sufficient_combination)
                    {
                        return Some((
                            res[0].value[position].clone(),
                            sufficient_combination
                                .iter()
                                .map(|x| {
                                    let actual_len = res[0].path.len()
                                        + self.oracle_numeric_infos.nb_digits[*x]
                                        - min_nb_digits;
                                    (*x, pre_pad_vec(res[0].path.clone(), actual_len))
                                })
                                .collect::<Vec<_>>(),
                        ));
                    }
                }
            }
        }

        if let Some(extra_cover_trie) = &self.extra_cover_trie {
            if let Some(res) = extra_cover_trie.look_up(paths) {
                return Some((res.0.clone(), res.1));
            }
        }

        None
    }
/// Lookup for nodes whose path is either equal or a prefix of `path`.
Lookup for nodes whose path is either equal or a prefix of `path`.
Lookup for nodes whose path is either equal or a prefix of ` path ` .
pub fn look_up(&self, paths: &[(usize, Vec<usize>)]) -> Option<(RangeInfo, Vec<IndexedPath>)> {
        let min_nb_digits = self.oracle_numeric_infos.get_min_nb_digits();
        // Take all the paths that have a max value of base^min_nb_digits - 1, and
        // shorten them to min_nb_digits.
        let stripped_paths = paths
            .iter()
            .filter_map(|x| {
                let extra_len = x.1.len().checked_sub(min_nb_digits)?;
                if extra_len == 0 {
                    Some((x.0, x.1.clone()))
                } else if x.1.iter().take(extra_len).all(|x| *x == 0) {
                    let mut cloned = x.1.clone();
                    cloned.drain(..extra_len);
                    Some((x.0, cloned))
                } else {
                    None
                }
            })
            .collect::<Vec<_>>();
        // Try to get the combinations of at least threshold oracles that agree on the outcome.
        let agreeing_combinations = self.get_agreeing_oracles(&stripped_paths);
        if let Some(sufficient_combinations) = agreeing_combinations {
            for (path, combination) in sufficient_combinations {
                debug_assert_eq!(
                    path.len(),
                    min_nb_digits,
                    "Expected length {} got length {}",
                    min_nb_digits,
                    path.len()
                );
                if let Some(res) = self.digit_trie.look_up(&path) {
                    let sufficient_combination: Vec<_> =
                        combination.into_iter().take(self.threshold).collect();
                    if let Some(position) = CombinationIterator::new(
                        self.oracle_numeric_infos.nb_digits.len(),
                        self.threshold,
                    )
                    .get_index_for_combination(&sufficient_combination)
                    {
                        return Some((
                            res[0].value[position].clone(),
                            sufficient_combination
                                .iter()
                                .map(|x| {
                                    let actual_len = res[0].path.len()
                                        + self.oracle_numeric_infos.nb_digits[*x]
                                        - min_nb_digits;
                                    (*x, pre_pad_vec(res[0].path.clone(), actual_len))
                                })
                                .collect::<Vec<_>>(),
                        ));
                    }
                }
            }
        }
        if let Some(extra_cover_trie) = &self.extra_cover_trie {
            if let Some(res) = extra_cover_trie.look_up(paths) {
                return Some((res.0.clone(), res.1));
            }
        }
        None
    }
pub fn look_up ( & self , paths : & [ ( usize , Vec < usize > ) ] ) -> Option < ( RangeInfo , Vec < IndexedPath > ) > { let min_nb_digits = self . oracle_numeric_infos . get_min_nb_digits ( ) ; // Take all the paths that have a max value of base^min_nb_digits - 1, and // shorten them to min_nb_digits. let stripped_paths = paths . iter ( ) . filter_map ( | x | { let extra_len = x . 1 . len ( ) . checked_sub ( min_nb_digits ) ? ; if extra_len == 0 { Some ( ( x . 0 , x . 1 . clone ( ) ) ) } else if x . 1 . iter ( ) . take ( extra_len ) . all ( | x | * x == 0 ) { let mut cloned = x . 1 . clone ( ) ; cloned . drain ( .. extra_len ) ; Some ( ( x . 0 , cloned ) ) } else { None } } ) . collect :: < Vec < _ > > ( ) ; // Try to get the combinations of at least threshold oracles that agree on the outcome. let agreeing_combinations = self . get_agreeing_oracles ( & stripped_paths ) ; if let Some ( sufficient_combinations ) = agreeing_combinations { for ( path , combination ) in sufficient_combinations { debug_assert_eq ! ( path len ( ) min_nb_digits " " min_nb_digits path len ( ) ) ; if let Some ( res ) = self . digit_trie . look_up ( & path ) { let sufficient_combination : Vec < _ > = combination . into_iter ( ) . take ( self . threshold ) . collect ( ) ; if let Some ( position ) = CombinationIterator :: new ( self . oracle_numeric_infos . nb_digits . len ( ) , self . threshold , ) . get_index_for_combination ( & sufficient_combination ) { return Some ( ( res [ 0 ] . value [ position ] . clone ( ) , sufficient_combination . iter ( ) . map ( | x | { let actual_len = res [ 0 ] . path . len ( ) + self . oracle_numeric_infos . nb_digits [ * x ] - min_nb_digits ; ( * x , pre_pad_vec ( res [ 0 ] . path . clone ( ) , actual_len ) ) } ) . collect :: < Vec < _ > > ( ) , ) ) ; } } } } if let Some ( extra_cover_trie ) = & self . extra_cover_trie { if let Some ( res ) = extra_cover_trie . look_up ( paths ) { return Some ( ( res . 0 . clone ( ) , res . 1 ) ) ; } } None }
Lookup for nodes whose path is either equal or a prefix of `path`.
Lookup for nodes whose path is either equal or a prefix of ` path ` .
&self
paths
&[(usize, Vec<usize>)]