Skip to content
Snippets Groups Projects
Unverified Commit 97fb9a6c authored by Tomáš Pecka's avatar Tomáš Pecka
Browse files

[nomerge] UTPMZ benchmarking preprocessor definition to change datastructure of ZAutomaton

parent 212d3576
No related branches found
No related tags found
No related merge requests found
......@@ -20,7 +20,12 @@
 
#include <ostream>
 
#ifndef UTPMZ
#include <alib/map>
#else
#include <alib/unordered_map>
#endif
#include <alib/set>
#include <alib/vector>
 
......@@ -64,11 +69,17 @@ public:
typedef SymbolTypeT SymbolType;
typedef StateTypeT StateType;
 
#ifndef UTPMZ
using Transitions = ext::map < ext::variant < SymbolType, ext::pair < StateType, StateType > >, StateType >;
#else
using Transitions = ext::unordered_map < ext::variant < SymbolType, ext::pair < StateType, StateType > >, StateType >;
#endif
private:
/**
* Transition function as mapping from a list of states times an input symbol on the left hand side to a state.
*/
ext::map < ext::variant < SymbolType, ext::pair < StateType, StateType > >, StateType > transitions;
Transitions transitions;
 
public:
/**
......@@ -278,7 +289,7 @@ public:
*
* \returns transition function of the automaton
*/
const ext::map < ext::variant < SymbolType, ext::pair < StateType, StateType > >, StateType > & getTransitions ( ) const & {
const Transitions & getTransitions ( ) const & {
return transitions;
}
 
......@@ -287,19 +298,19 @@ public:
*
* \returns transition function of the automaton
*/
ext::map < ext::variant < SymbolType, ext::pair < StateType, StateType > >, StateType > && getTransitions ( ) && {
Transitions && getTransitions ( ) && {
return std::move ( transitions );
}
 
/**
* \returns transitions to state @p q
*/
ext::map < ext::variant < SymbolType, ext::pair < StateType, StateType > >, StateType > getTransitionsToState ( const StateType & q ) const;
Transitions getTransitionsToState ( const StateType & q ) const;
 
/**
* \returns transitions from state @p q
*/
ext::map < ext::variant < SymbolType, ext::pair < StateType, StateType > >, StateType > getTransitionsFromState ( const StateType & q ) const;
Transitions getTransitionsFromState ( const StateType & q ) const;
 
/**
* The three way comparison implementation
......@@ -431,8 +442,8 @@ bool ArcFactoredDeterministicZAutomaton < SymbolType, StateType >::removeTransit
}
 
template<class SymbolType, class StateType >
ext::map < ext::variant < SymbolType, ext::pair < StateType, StateType > >, StateType > ArcFactoredDeterministicZAutomaton < SymbolType, StateType >::getTransitionsToState ( const StateType & q ) const {
ext::map < ext::variant < SymbolType, ext::pair < StateType, StateType > >, StateType > res;
typename ArcFactoredDeterministicZAutomaton < SymbolType, StateType >::Transitions ArcFactoredDeterministicZAutomaton < SymbolType, StateType >::getTransitionsToState ( const StateType & q ) const {
Transitions res;
 
for ( const auto & transition : getTransitions ( ) ) {
if ( transition.second == q )
......@@ -443,8 +454,8 @@ ext::map < ext::variant < SymbolType, ext::pair < StateType, StateType > >, Stat
}
 
template<class SymbolType, class StateType >
ext::map < ext::variant < SymbolType, ext::pair < StateType, StateType > >, StateType > ArcFactoredDeterministicZAutomaton < SymbolType, StateType >::getTransitionsFromState ( const StateType & q ) const {
ext::map < ext::variant < SymbolType, ext::pair < StateType, StateType > >, StateType > res;
typename ArcFactoredDeterministicZAutomaton < SymbolType, StateType >::Transitions ArcFactoredDeterministicZAutomaton < SymbolType, StateType >::getTransitionsFromState ( const StateType & q ) const {
Transitions res;
 
for ( const auto & transition : getTransitions ( ) ) {
if ( transition.first.template is < ext::pair < StateType, StateType > > ( ) && transition.first.template get < ext::pair < StateType, StateType > > ( ).second == q )
......
0% Loading or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment