Empirical
Public Types | Public Member Functions | List of all members
emp::tDFA< NUM_SYMBOLS, STOP_TYPE > Class Template Reference

#include <DFA.h>

Public Types

using stop_t = STOP_TYPE
 

Public Member Functions

 tDFA (size_t num_states=0)
 
 tDFA (const tDFA< NUM_SYMBOLS, STOP_TYPE > &)=default
 
 ~tDFA ()
 
tDFA< NUM_SYMBOLS, STOP_TYPE > & operator= (const tDFA< NUM_SYMBOLS, STOP_TYPE > &)=default
 
size_t GetSize () const
 How many states is this DFA using? More...
 
void Resize (size_t new_size)
 Add Additional empty states. More...
 
const emp::array< int, NUM_SYMBOLS > & GetTransitions (size_t from) const
 Return an array of all transitions associated with a specified state. More...
 
void SetTransition (size_t from, size_t to, size_t sym)
 Add a specific transition associated with an input symbol. More...
 
void SetStop (size_t state, stop_t stop_val=1)
 Set the stop value (no matter what it currently is) More...
 
void AddStop (size_t state, stop_t stop_val=1)
 Set the stop value only if it's higher than the current stop value. More...
 
stop_t GetStop (int state) const
 Get the stop value associated with a state. More...
 
bool IsActive (int state) const
 Test if a state is still valid. More...
 
bool IsStop (int state) const
 Test if a state has a stop. More...
 
stop_t GetStop (size_t state) const
 
bool IsActive (size_t state) const
 
bool IsStop (size_t state) const
 
int Next (int state, size_t sym) const
 Return the new state after a symbol occurs. More...
 
int Next (int state, std::string sym_set) const
 Return the new state after a series of symbols. More...
 
stop_t Test (const std::string &str) const
 Determine if an entire series of symbols is valid. More...
 
void Print (std::ostream &os=std::cout)
 Print details about this DFA. More...
 

Member Typedef Documentation

template<int NUM_SYMBOLS = 128, typename STOP_TYPE = uint8_t>
using emp::tDFA< NUM_SYMBOLS, STOP_TYPE >::stop_t = STOP_TYPE

Constructor & Destructor Documentation

template<int NUM_SYMBOLS = 128, typename STOP_TYPE = uint8_t>
emp::tDFA< NUM_SYMBOLS, STOP_TYPE >::tDFA ( size_t  num_states = 0)
inline
template<int NUM_SYMBOLS = 128, typename STOP_TYPE = uint8_t>
emp::tDFA< NUM_SYMBOLS, STOP_TYPE >::tDFA ( const tDFA< NUM_SYMBOLS, STOP_TYPE > &  )
default
template<int NUM_SYMBOLS = 128, typename STOP_TYPE = uint8_t>
emp::tDFA< NUM_SYMBOLS, STOP_TYPE >::~tDFA ( )
inline

Member Function Documentation

template<int NUM_SYMBOLS = 128, typename STOP_TYPE = uint8_t>
void emp::tDFA< NUM_SYMBOLS, STOP_TYPE >::AddStop ( size_t  state,
stop_t  stop_val = 1 
)
inline

Set the stop value only if it's higher than the current stop value.

template<int NUM_SYMBOLS = 128, typename STOP_TYPE = uint8_t>
size_t emp::tDFA< NUM_SYMBOLS, STOP_TYPE >::GetSize ( ) const
inline

How many states is this DFA using?

template<int NUM_SYMBOLS = 128, typename STOP_TYPE = uint8_t>
stop_t emp::tDFA< NUM_SYMBOLS, STOP_TYPE >::GetStop ( int  state) const
inline

Get the stop value associated with a state.

template<int NUM_SYMBOLS = 128, typename STOP_TYPE = uint8_t>
stop_t emp::tDFA< NUM_SYMBOLS, STOP_TYPE >::GetStop ( size_t  state) const
inline
template<int NUM_SYMBOLS = 128, typename STOP_TYPE = uint8_t>
const emp::array<int, NUM_SYMBOLS>& emp::tDFA< NUM_SYMBOLS, STOP_TYPE >::GetTransitions ( size_t  from) const
inline

Return an array of all transitions associated with a specified state.

template<int NUM_SYMBOLS = 128, typename STOP_TYPE = uint8_t>
bool emp::tDFA< NUM_SYMBOLS, STOP_TYPE >::IsActive ( int  state) const
inline

Test if a state is still valid.

template<int NUM_SYMBOLS = 128, typename STOP_TYPE = uint8_t>
bool emp::tDFA< NUM_SYMBOLS, STOP_TYPE >::IsActive ( size_t  state) const
inline
template<int NUM_SYMBOLS = 128, typename STOP_TYPE = uint8_t>
bool emp::tDFA< NUM_SYMBOLS, STOP_TYPE >::IsStop ( int  state) const
inline

Test if a state has a stop.

template<int NUM_SYMBOLS = 128, typename STOP_TYPE = uint8_t>
bool emp::tDFA< NUM_SYMBOLS, STOP_TYPE >::IsStop ( size_t  state) const
inline
template<int NUM_SYMBOLS = 128, typename STOP_TYPE = uint8_t>
int emp::tDFA< NUM_SYMBOLS, STOP_TYPE >::Next ( int  state,
size_t  sym 
) const
inline

Return the new state after a symbol occurs.

template<int NUM_SYMBOLS = 128, typename STOP_TYPE = uint8_t>
int emp::tDFA< NUM_SYMBOLS, STOP_TYPE >::Next ( int  state,
std::string  sym_set 
) const
inline

Return the new state after a series of symbols.

template<int NUM_SYMBOLS = 128, typename STOP_TYPE = uint8_t>
tDFA<NUM_SYMBOLS, STOP_TYPE>& emp::tDFA< NUM_SYMBOLS, STOP_TYPE >::operator= ( const tDFA< NUM_SYMBOLS, STOP_TYPE > &  )
default
template<int NUM_SYMBOLS = 128, typename STOP_TYPE = uint8_t>
void emp::tDFA< NUM_SYMBOLS, STOP_TYPE >::Print ( std::ostream &  os = std::cout)
inline

Print details about this DFA.

template<int NUM_SYMBOLS = 128, typename STOP_TYPE = uint8_t>
void emp::tDFA< NUM_SYMBOLS, STOP_TYPE >::Resize ( size_t  new_size)
inline

Add Additional empty states.

template<int NUM_SYMBOLS = 128, typename STOP_TYPE = uint8_t>
void emp::tDFA< NUM_SYMBOLS, STOP_TYPE >::SetStop ( size_t  state,
stop_t  stop_val = 1 
)
inline

Set the stop value (no matter what it currently is)

template<int NUM_SYMBOLS = 128, typename STOP_TYPE = uint8_t>
void emp::tDFA< NUM_SYMBOLS, STOP_TYPE >::SetTransition ( size_t  from,
size_t  to,
size_t  sym 
)
inline

Add a specific transition associated with an input symbol.

template<int NUM_SYMBOLS = 128, typename STOP_TYPE = uint8_t>
stop_t emp::tDFA< NUM_SYMBOLS, STOP_TYPE >::Test ( const std::string &  str) const
inline

Determine if an entire series of symbols is valid.


The documentation for this class was generated from the following file: