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>
impl<F: Symbol, Q: State, L: Label> Automaton<F, Q, L>
pub fn states(&self) -> States<'_, F, Q, L>
Sourcepub fn final_states(&self) -> Iter<'_, Q> ⓘ
pub fn final_states(&self) -> Iter<'_, Q> ⓘ
Return an iterator to the final states of the automaton.
Sourcepub fn set_final(&mut self, q: Q) -> bool
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.
Sourcepub fn includes(&self, q: &Q) -> bool
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.
pub fn transitions(&self) -> Transifions<'_, F, Q, L> ⓘ
Sourcepub fn configurations_for_state(&self, q: &Q) -> Configurations<'_, F, Q, L>
pub fn configurations_for_state(&self, q: &Q) -> Configurations<'_, F, Q, L>
Return an iterator over the configurations connected to the given state.
Sourcepub fn states_for_configuration(
&self,
conf: &Configuration<F, Q>,
) -> Iter<'_, Labeled<Q, L>> ⓘ
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.
Sourcepub fn add(&mut self, conf: Configuration<F, Q>, label: L, state: Q)
pub fn add(&mut self, conf: Configuration<F, Q>, label: L, state: Q)
Add a new transition to the automaton.
Sourcepub fn add_normalized<P: PatternLike<F, Q>, N>(
&mut self,
pattern: &P,
normalizer: &mut N,
) -> Q
pub fn add_normalized<P: PatternLike<F, Q>, N>( &mut self, pattern: &P, normalizer: &mut N, ) -> Q
Add new transitions in the automaton by adding and normalizing the given configuration, label and state.
Sourcepub fn common_configurations<'a>(
automata: &'a [&'a Automaton<F, Q, L>],
positions: &'a [Q],
) -> CommonConfigurations<'a, F, Q, L> ⓘ
pub fn common_configurations<'a>( automata: &'a [&'a Automaton<F, Q, L>], positions: &'a [Q], ) -> CommonConfigurations<'a, F, Q, L> ⓘ
Automata common configurations.
Sourcepub fn representatives(&self) -> Representatives<'_, F, Q, L> ⓘ
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.
Sourcepub fn complement(&mut self)
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.