<commit_before>/// Sample implementation of the Tree interface.
use super::{Altitude, Frontier, Hashable, Recording, Tree};

#[derive(Clone)]
pub struct CompleteTree<H: Hashable> {
    leaves: Vec<H>,
    current_position: usize,
    witnesses: Vec<(usize, H)>,
    checkpoints: Vec<usize>,
    depth: usize,
    max_checkpoints: usize,
}

impl<H: Hashable + Clone> CompleteTree<H> {
    /// Creates a new, empty binary tree of specified depth.
    pub fn new(depth: usize, max_checkpoints: usize) -> Self {
        CompleteTree {
            leaves: vec![H::empty_leaf(); 1 << depth],
            current_position: 0,
            witnesses: vec![],
            checkpoints: vec![],
            depth,
            max_checkpoints,
        }
    }
}

impl<H: Hashable + PartialEq + Clone> CompleteTree<H> {
    /// Removes the oldest checkpoint. Returns true if successful and false if
    /// there are no checkpoints.
    fn drop_oldest_checkpoint(&mut self) -> bool {<commit_msg>Expose new() only in tests.<commit_after>/// Sample implementation of the Tree interface.
use super::{Altitude, Frontier, Hashable, Recording, Tree};

#[derive(Clone)]
pub struct CompleteTree<H: Hashable> {
    leaves: Vec<H>,
    current_position: usize,
    witnesses: Vec<(usize, H)>,
    checkpoints: Vec<usize>,
    depth: usize,
    max_checkpoints: usize,
}

impl<H: Hashable + Clone> CompleteTree<H> {
    /// Creates a new, empty binary tree of specified depth.
    #[cfg(test)]
    pub fn new(depth: usize, max_checkpoints: usize) -> Self {
        CompleteTree {
            leaves: vec![H::empty_leaf(); 1 << depth],
            current_position: 0,
            witnesses: vec![],
            checkpoints: vec![],
            depth,
            max_checkpoints,
        }
    }
}

impl<H: Hashable + PartialEq + Clone> CompleteTree<H> {
    /// Removes the oldest checkpoint. Returns true if successful and false if
    /// there are no checkpoints.
    fn drop_oldest_checkpoint(&mut self) -> bool {
{'fraction_non_alphanumeric': 0.12343201204214752, 'fraction_numerical': 0.002007024586051179, 'mean_word_length': 2.713221601489758, 'pattern_counts': {'":': 0, '<': 23, '<?xml version=': 0, '>': 23, 'https://': 0, 'lorem ipsum': 0, 'www.': 0, 'xml': 0}, 'pii_count': 0, 'substrings_counts': 0, 'word_list_counts': {'cursed_substrings.json': 0, 'profanity_word_list.json': 0, 'sexual_word_list.json': 0, 'zh_pornsignals.json': 0}}
{'dir': 'git-commits-cleaned', 'id': '2916805', 'n_tokens_mistral': 594, 'n_tokens_neox': 612, 'n_words': 181}