Struct Automaton

Source
pub struct Automaton<F, Q: State, L: Label> { /* private fields */ }
Expand description

Tree automaton.

Implementations§

Source§

impl<F: Symbol, Q: State, L: Label> Automaton<F, Q, L>

Source

pub fn new() -> Automaton<F, Q, L>

Create a new empty automaton.

Source

pub fn len(&self) -> usize

Return the number of states in the automaton.

Source

pub fn states(&self) -> States<'_, F, Q, L>

Source

pub fn final_states(&self) -> Iter<'_, Q>

Return an iterator to the final states of the automaton.

Source

pub fn set_final(&mut self, q: Q) -> bool

Set the given state a final state. Return true if the state was not already final. Return false if the state was already a final state.

Source

pub fn includes(&self, q: &Q) -> bool

Checks if the given state is in the automaton. Return true if at least one configuration is attached to the state in the automaton.

Source

pub fn transitions(&self) -> Transifions<'_, F, Q, L>

Source

pub fn configurations_for_state(&self, q: &Q) -> Configurations<'_, F, Q, L>

Return an iterator over the configurations connected to the given state.

Source

pub fn states_for_configuration( &self, conf: &Configuration<F, Q>, ) -> Iter<'_, Labeled<Q, L>>

Return an iterator over the states connected to the given configuration.

Source

pub fn add(&mut self, conf: Configuration<F, Q>, label: L, state: Q)

Add a new transition to the automaton.

Source

pub fn add_normalized<P: PatternLike<F, Q>, N>( &mut self, pattern: &P, normalizer: &mut N, ) -> Q
where N: FnMut(&Configuration<F, Q>) -> Labeled<Q, L>,

Add new transitions in the automaton by adding and normalizing the given configuration, label and state.

Source

pub fn common_configurations<'a>( automata: &'a [&'a Automaton<F, Q, L>], positions: &'a [Q], ) -> CommonConfigurations<'a, F, Q, L>

Automata common configurations.

Source

pub fn representatives(&self) -> Representatives<'_, F, Q, L>

Return an iterator over the representative terms of the automaton. The representatives terms are all the terms recognized by the automaton without cycle. Together they trigger every transition of the automaton.

Source

pub fn complement(&mut self)

Complement the automaton. This will invert the set of final and non-final states. If the automaton is complete, then self becomes its own complement.

Source

pub fn alphabet(&self) -> HashSet<F>

Return the alphabet on which this automaton is defined.

Source

pub fn map_states<R: State, M>(&self, g: M) -> Automaton<F, R, L>
where M: Fn(&Q) -> R,

Source§

impl<F: Symbol, Q: State> Automaton<F, Q, NoLabel>

Source

pub fn complete_with<'a, A: Iterator<Item = &'a F>, R>( &mut self, alphabet: A, lang: &Automaton<F, R, NoLabel>, )
where F: 'a + Ranked, R: From<Q> + State, Q: From<R>,

Complete the language with the given automaton. Each state of self must be mappable into a state of lang, and each state of lang must be transformed into a dead state of self.

Trait Implementations§

Source§

impl<F: Clone, Q: Clone + State, L: Clone + Label> Clone for Automaton<F, Q, L>

Source§

fn clone(&self) -> Automaton<F, Q, L>

Returns a copy of the value. Read more
1.0.0 · Source§

fn clone_from(&mut self, source: &Self)

Performs copy-assignment from source. Read more
Source§

impl<F: Symbol + Display, Q: State + Display, L: Label + Display> Display for Automaton<F, Q, L>

Source§

fn fmt(&self, f: &mut Formatter<'_>) -> Result

Formats the value using the given formatter. Read more
Source§

impl<'a, F: Symbol, Q: State, L: Label> From<&'a Automaton<F, Q, L>> for Automaton<F, Q, u32>

Source§

fn from(bottom_up: &'a Automaton<F, Q, L>) -> Automaton<F, Q, u32>

Converts to this type from the input type.
Source§

impl<'a, F: Symbol, E, Q: LanguageState<F, E>> From<(Q, &'a E)> for Automaton<F, Q, NoLabel>

Source§

fn from((q, env): (Q, &'a E)) -> Automaton<F, Q, NoLabel>

Converts to this type from the input type.
Source§

impl<'a, F: Symbol, Q: LanguageState<F, ()>> From<Q> for Automaton<F, Q, NoLabel>

Source§

fn from(q: Q) -> Automaton<F, Q, NoLabel>

Converts to this type from the input type.
Source§

impl<F: Symbol, Q: State, L: Label> Language<F> for Automaton<F, Q, L>

Auto Trait Implementations§

§

impl<F, Q, L> Freeze for Automaton<F, Q, L>

§

impl<F, Q, L> RefUnwindSafe for Automaton<F, Q, L>

§

impl<F, Q, L> Send for Automaton<F, Q, L>
where Q: Send, F: Send, L: Send,

§

impl<F, Q, L> Sync for Automaton<F, Q, L>
where Q: Sync, F: Sync, L: Sync,

§

impl<F, Q, L> Unpin for Automaton<F, Q, L>
where Q: Unpin, F: Unpin, L: Unpin,

§

impl<F, Q, L> UnwindSafe for Automaton<F, Q, L>
where Q: UnwindSafe, F: UnwindSafe, L: UnwindSafe,

Blanket Implementations§

Source§

impl<T> Any for T
where T: 'static + ?Sized,

Source§

fn type_id(&self) -> TypeId

Gets the TypeId of self. Read more
Source§

impl<T> Borrow<T> for T
where T: ?Sized,

Source§

fn borrow(&self) -> &T

Immutably borrows from an owned value. Read more
Source§

impl<T> BorrowMut<T> for T
where T: ?Sized,

Source§

fn borrow_mut(&mut self) -> &mut T

Mutably borrows from an owned value. Read more
Source§

impl<T> CloneToUninit for T
where T: Clone,

Source§

unsafe fn clone_to_uninit(&self, dest: *mut u8)

🔬This is a nightly-only experimental API. (clone_to_uninit)
Performs copy-assignment from self to dest. Read more
Source§

impl<T> From<T> for T

Source§

fn from(t: T) -> T

Returns the argument unchanged.

Source§

impl<T, U> Into<U> for T
where U: From<T>,

Source§

fn into(self) -> U

Calls U::from(self).

That is, this conversion is whatever the implementation of From<T> for U chooses to do.

Source§

impl<F, Q> LanguageState<F, Automaton<F, Q, NoLabel>> for Q
where F: Symbol, Q: State,

Source§

fn configurations<'a>( &self, aut: &'a Automaton<F, Q, NoLabel>, ) -> Box<dyn Iterator<Item = Configuration<F, Q>> + 'a>

Source§

impl<T> ToOwned for T
where T: Clone,

Source§

type Owned = T

The resulting type after obtaining ownership.
Source§

fn to_owned(&self) -> T

Creates owned data from borrowed data, usually by cloning. Read more
Source§

fn clone_into(&self, target: &mut T)

Uses borrowed data to replace owned data, usually by cloning. Read more
Source§

impl<T> ToString for T
where T: Display + ?Sized,

Source§

fn to_string(&self) -> String

Converts the given value to a String. Read more
Source§

impl<T, U> TryFrom<U> for T
where U: Into<T>,

Source§

type Error = Infallible

The type returned in the event of a conversion error.
Source§

fn try_from(value: U) -> Result<T, <T as TryFrom<U>>::Error>

Performs the conversion.
Source§

impl<T, U> TryInto<U> for T
where U: TryFrom<T>,

Source§

type Error = <U as TryFrom<T>>::Error

The type returned in the event of a conversion error.
Source§

fn try_into(self) -> Result<U, <U as TryFrom<T>>::Error>

Performs the conversion.
Source§

impl<V, T> VZip<V> for T
where V: MultiLane<T>,

Source§

fn vzip(self) -> V