Class mata::nfa::StatePost

class StatePost : private OrdVector<SymbolPost>

A data structure representing possible transitions over different symbols from a source state.

It is an ordered vector containing possible SymbolPost (i.e., pair of symbol and target states). SymbolPosts in the vector are ordered by symbols in SymbolPosts.

Public Functions

const_iterator first_epsilon_it(Symbol first_epsilon) const

returns an iterator to the smallest epsilon, or end() if there is no epsilon

StateSet get_successors() const

Get the set of all target states in the StatePost.

Returns:

Set of all target states in the StatePost.

const StateSet &get_successors(Symbol symbol) const

Returns a reference to target states for a given symbol in the StatePost.

If there is no such symbol, a static empty set is returned.

Parameters:

symbolSymbol to get the successors for.

Returns:

Set of target states for the given symbol.

inline Moves moves() const

Iterator over all moves (over all labels) in StatePost represented as Move instances.

Moves moves(StatePost::const_iterator symbol_post_it, StatePost::const_iterator symbol_post_end) const

Iterator over specified moves in StatePost represented as Move instances.

Parameters:
  • symbol_post_it[in] First iterator over symbol posts to iterate over.

  • symbol_post_end[in] End iterator over symbol posts (which functions as an sentinel, is not iterated over).

Moves moves_epsilons(Symbol first_epsilon = EPSILON) const

Iterator over epsilon moves in StatePost represented as Move instances.

Moves moves_symbols(Symbol last_symbol = EPSILON - 1) const

Iterator over alphabet (normal) symbols (not over epsilons) in StatePost represented as Move instances.

size_t num_of_moves() const

Count the number of all moves in StatePost.

inline virtual reference back()

Get reference to the last element in the vector.

Modifying the underlying value in the reference could break sortedness.

inline size_t erase(const SymbolPost &k)

Remove k from sorted vector.

This function expects the vector to be sorted.

Private Functions

inline OrdVector difference(const OrdVector &rhs) const

Compute set difference as this minus rhs.

Parameters:

rhs – Other vector with symbols to be excluded.

Returns:

this minus rhs.

inline bool contains(const SymbolPost &key) const

Check whether key exists in the ordered vector.

Private Static Functions

static inline OrdVector with_reserved(const size_t capacity)

Create OrdVector with reserved capacity.

Parameters:

capacity[in] Capacity of OrdVector to reserve.

Returns:

Newly create OrdVector.

class Moves

Iterator over moves represented as Move instances.

It iterates over pairs (symbol, target) for the given StatePost.

Public Functions

Moves(const StatePost &state_post, StatePost::const_iterator symbol_post_it, StatePost::const_iterator symbol_post_end)

construct moves iterating over a range symbol_post_it (including) to symbol_post_end (excluding).

Parameters:
  • state_post[in] State post to iterate over.

  • symbol_post_it[in] First iterator over symbol posts to iterate over.

  • symbol_post_end[in] End iterator over symbol posts (which functions as an sentinel; is not iterated over).

class const_iterator

Iterator over moves.

Public Functions

inline const_iterator()

Construct end iterator.

const_iterator(const StatePost &state_post)

Const all moves iterator.

const_iterator(const StatePost &state_post, StatePost::const_iterator symbol_post_it, StatePost::const_iterator symbol_post_it_end)

Construct iterator from symbol_post_it (including) to symbol_post_it_end (excluding).