traits.rs 992 Bytes
Newer Older
1
2
3
4
5
6
7
8
9
10
11
12
13
14
use crate::automatadefs::mealy::{InputSymbol, OutputSymbol};

/// Ads "Error" types:
/// 1. Done ⇒ we've hit a leaf,
/// 2. Unexpected ⇒ the prev output was unexpected.
pub enum AdsStatus {
    /// End of inputs of the ADS
    Done,
    /// Previous output was unexpected in the ADS
    Unexpected,
}
pub trait AdaptiveDistinguishingSequence {
    /// Given the previous output, returns the next input, or an [`AdsStatus`].
    ///
Bharat Garhewal's avatar
Cleanup    
Bharat Garhewal committed
15
    /// Initially, `prev_output` will be ``None``, but after that, it is
16
17
18
19
    /// required to provide the previous output, wrapped in a ``Some``.
    /// ## [`AdsStatus`]
    /// 1. DONE ⇒ No more inputs to send, and
    /// 2. UNEXPECTED ⇒ Previous output was not expected.
Bharat Garhewal's avatar
Cleanup    
Bharat Garhewal committed
20
21
    /// # Errors
    /// None.
22
23
24
25
26
27
28
29
    fn next_input(&mut self, prev_output: Option<OutputSymbol>) -> Result<InputSymbol, AdsStatus>;

    fn get_print_tree(&self) -> Box<[u8]>;

    fn identification_power(&self) -> f32;

    fn reset_to_root(&mut self);
}