30 #ifndef __CLAW_AUTOMATON_HPP__
31 #define __CLAW_AUTOMATON_HPP__
55 template<
class State,
class Edge,
class StateComp = std::less<State>,
56 class EdgeComp = std::less<Edge> >
77 typedef std::map<state_type, neighbours_list, state_compare>
adjacent_list;
104 template<
class InputIterator>
105 bool match(InputIterator
first, InputIterator last)
const;
120 template<
class InputIterator>
122 InputIterator last)
const;
145 #endif // __CLAW_AUTOMATON_HPP__
Implementation of the claw::automaton class.
void edges(const state_type &s1, const state_type &s2, result_edge_list &l) const
Get all the edges between two states.
void add_initial_state(const state_type &s)
Add an initial state.
void states(result_state_list &v) const
Get the states in the automaton.
std::multimap< edge_type, state_type, edge_compare > neighbours_list
The neighbours list associates states to edge symbols.
void remove_edge(const state_type &s1, const state_type &s2, const edge_type &e)
Remove an edge from the atomaton.
EdgeComp edge_compare
The type of the operator used to compare edge symbols.
bool state_is_initial(const state_type &s) const
Tell if a state is an initial state.
bool state_is_final(const state_type &s) const
Tell if a state is final.
Edge edge_type
The type of the symbols on the edges.
bool match(InputIterator first, InputIterator last) const
Tell if the automaton recognizes a given pattern.
unsigned int states_count() const
Get the number of states.
std::map< state_type, neighbours_list, state_compare > adjacent_list
Each state is given a set of reachable states with a neighbours list.
StateComp state_compare
The type of the operator used to compare states.
Fuction object to get the first element of a std::pair.
bool state_exists(const state_type &s) const
Tell of the automaton contains a given state.
std::vector< state_type > result_state_list
The return type of the methods returning states.
void final_states(result_state_list &v) const
Get the final states.
void initial_states(result_state_list &v) const
Get the final states.
Basic automaton structure.
State state_type
The type of the states.
void add_edge(const state_type &s1, const state_type &s2, const edge_type &e)
Add an edge in the automaton.
void add_final_state(const state_type &s)
Add a final state.
void reachables(const state_type &s, const edge_type &e, result_state_list &l) const
Get the states that can be reached from a given state with a given symbol.
void alphabet(result_edge_list &v) const
Get all symbols in the alphabet.
std::vector< edge_type > result_edge_list
The return type of the methods returning edges.
void add_state(const state_type &s)
Add a state in the automaton.