Skip to content
Snippets Groups Projects
Commit 2b235b23 authored by Jan Trávníček's avatar Jan Trávníček
Browse files

templated base class of automata

parent 6184d7b7
No related branches found
No related tags found
No related merge requests found
Showing
with 181 additions and 104 deletions
/*
* AutomatonBase.cpp
*
* Created on: Apr 16, 2013
* Author: Jan Travnicek
*/
#include "AutomatonBase.h"
namespace automaton {
AutomatonBase::~AutomatonBase() {
}
bool AutomatonBase::operator!=(const AutomatonBase& other) const {
return !(*this == other);
}
bool AutomatonBase::operator==(const UnknownAutomaton&) const {
return false;
}
bool AutomatonBase::operator==(const DFA&) const {
return false;
}
bool AutomatonBase::operator==(const NFA&) const {
return false;
}
bool AutomatonBase::operator==(const EpsilonNFA&) const{
return false;
}
bool AutomatonBase::operator==(const CompactNFA&) const{
return false;
}
bool AutomatonBase::operator==(const ExtendedNFA&) const {
return false;
}
bool AutomatonBase::operator==(const NPDA&) const {
return false;
}
bool AutomatonBase::operator==(const SinglePopNPDA&) const {
return false;
}
bool AutomatonBase::operator==(const OneTapeDTM&) const {
return false;
}
bool AutomatonBase::operator==(const AutomatonBase&) const {
return false;
}
std::ostream& operator<<(std::ostream& os, const AutomatonBase& automaton) {
automaton >> os;
return os;
}
} /* namespace automaton */
...@@ -9,7 +9,7 @@ ...@@ -9,7 +9,7 @@
#define AUTOMATON_BASE_H_ #define AUTOMATON_BASE_H_
   
#include "../std/visitor.hpp" #include "../std/visitor.hpp"
#include <iostream> #include "../common/base.hpp"
   
namespace automaton { namespace automaton {
   
...@@ -26,41 +26,7 @@ class OneTapeDTM; ...@@ -26,41 +26,7 @@ class OneTapeDTM;
/** /**
* Abstract base class for all automata. * Abstract base class for all automata.
*/ */
class AutomatonBase : public std::elementBase<UnknownAutomaton, DFA, NFA, EpsilonNFA, CompactNFA, ExtendedNFA, NPDA, SinglePopNPDA, OneTapeDTM> { class AutomatonBase : public alib::base<AutomatonBase, UnknownAutomaton, DFA, NFA, EpsilonNFA, CompactNFA, ExtendedNFA, NPDA, SinglePopNPDA, OneTapeDTM>, public std::elementBase<UnknownAutomaton, DFA, NFA, EpsilonNFA, CompactNFA, ExtendedNFA, NPDA, SinglePopNPDA, OneTapeDTM> {
public:
virtual AutomatonBase* clone() const = 0;
virtual AutomatonBase* plunder() && = 0;
virtual ~AutomatonBase() noexcept;
virtual bool operator!=(const AutomatonBase& other) const;
virtual bool operator==(const UnknownAutomaton& other) const;
virtual bool operator==(const DFA& other) const;
virtual bool operator==(const NFA& other) const;
virtual bool operator==(const EpsilonNFA& other) const;
virtual bool operator==(const CompactNFA& other) const;
virtual bool operator==(const ExtendedNFA& other) const;
virtual bool operator==(const NPDA& other) const;
virtual bool operator==(const SinglePopNPDA& other) const;
virtual bool operator==(const OneTapeDTM& other) const;
virtual bool operator==(const AutomatonBase& other) const = 0;
friend std::ostream& operator<<(std::ostream& os, const AutomatonBase& automaton);
virtual void operator>>(std::ostream&) const = 0;
virtual operator std::string () const = 0;
}; };
   
} /* namespace automaton */ } /* namespace automaton */
......
...@@ -113,10 +113,22 @@ bool CompactNFA::operator==(const AutomatonBase& other) const { ...@@ -113,10 +113,22 @@ bool CompactNFA::operator==(const AutomatonBase& other) const {
return other == *this; return other == *this;
} }
   
bool CompactNFA::operator<(const AutomatonBase& other) const {
return other > *this;
}
bool CompactNFA::operator>(const AutomatonBase& other) const {
return other < *this;
}
bool CompactNFA::operator==(const CompactNFA& other) const { bool CompactNFA::operator==(const CompactNFA& other) const {
return states == other.states && inputAlphabet == other.inputAlphabet && initialStates == other.initialStates && finalStates == other.finalStates && transitions == other.transitions; return states == other.states && inputAlphabet == other.inputAlphabet && initialStates == other.initialStates && finalStates == other.finalStates && transitions == other.transitions;
} }
   
bool CompactNFA::operator<(const CompactNFA& other) const {
return std::tie(states, inputAlphabet, initialStates, finalStates, transitions) < std::tie(other.states, other.inputAlphabet, other.initialStates, other.finalStates, other.transitions);
}
void CompactNFA::operator>>(std::ostream& out) const { void CompactNFA::operator>>(std::ostream& out) const {
out << "(CompactNFA" out << "(CompactNFA"
<< "states = " << states << "states = " << states
......
...@@ -70,13 +70,20 @@ public: ...@@ -70,13 +70,20 @@ public:
*/ */
std::map<std::pair<State, string::String>, std::set<State>> getTransitionsToState(const State& from) const; std::map<std::pair<State, string::String>, std::set<State>> getTransitionsToState(const State& from) const;
   
virtual bool operator<(const AutomatonBase& other) const;
virtual bool operator==(const AutomatonBase& other) const; virtual bool operator==(const AutomatonBase& other) const;
virtual bool operator>(const AutomatonBase& other) const;
   
virtual bool operator==(const CompactNFA& other) const; virtual bool operator==(const CompactNFA& other) const;
virtual bool operator<(const CompactNFA& other) const;
   
virtual void operator>>(std::ostream& os) const; virtual void operator>>(std::ostream& os) const;
   
virtual operator std::string() const; virtual operator std::string() const;
virtual int selfTypeId() const {
return typeId(*this);
}
}; };
   
} /* namespace automaton */ } /* namespace automaton */
......
...@@ -136,10 +136,22 @@ bool DFA::operator==(const AutomatonBase& other) const { ...@@ -136,10 +136,22 @@ bool DFA::operator==(const AutomatonBase& other) const {
return other == *this; return other == *this;
} }
   
bool DFA::operator<(const AutomatonBase& other) const {
return other > *this;
}
bool DFA::operator>(const AutomatonBase& other) const {
return other < *this;
}
bool DFA::operator==(const DFA& other) const { bool DFA::operator==(const DFA& other) const {
return this->states == other.states && this->inputAlphabet == other.inputAlphabet && this->initialState == other.initialState && this->finalStates == other.finalStates && this->transitions == other.transitions; return this->states == other.states && this->inputAlphabet == other.inputAlphabet && this->initialState == other.initialState && this->finalStates == other.finalStates && this->transitions == other.transitions;
} }
   
bool DFA::operator<(const DFA& other) const {
return std::tie(states, inputAlphabet, initialState, finalStates, transitions) < std::tie(other.states, other.inputAlphabet, other.initialState, other.finalStates, other.transitions);
}
void DFA::operator>>(std::ostream& out) const { void DFA::operator>>(std::ostream& out) const {
out << "(DFA" out << "(DFA"
<< " states = " << states << " states = " << states
......
...@@ -80,13 +80,20 @@ public: ...@@ -80,13 +80,20 @@ public:
*/ */
bool isTotal() const; bool isTotal() const;
virtual bool operator<(const AutomatonBase& other) const;
virtual bool operator==(const AutomatonBase& other) const; virtual bool operator==(const AutomatonBase& other) const;
virtual bool operator>(const AutomatonBase& other) const;
   
virtual bool operator==(const DFA& other) const; virtual bool operator==(const DFA& other) const;
virtual bool operator<(const DFA& other) const;
virtual void operator>>(std::ostream& os) const; virtual void operator>>(std::ostream& os) const;
   
virtual operator std::string() const; virtual operator std::string() const;
virtual int selfTypeId() const {
return typeId(*this);
}
}; };
   
} /* namespace automaton */ } /* namespace automaton */
......
...@@ -236,10 +236,22 @@ bool EpsilonNFA::operator==(const AutomatonBase& other) const { ...@@ -236,10 +236,22 @@ bool EpsilonNFA::operator==(const AutomatonBase& other) const {
return other == *this; return other == *this;
} }
   
bool EpsilonNFA::operator<(const AutomatonBase& other) const {
return other > *this;
}
bool EpsilonNFA::operator>(const AutomatonBase& other) const {
return other < *this;
}
bool EpsilonNFA::operator==(const EpsilonNFA& other) const { bool EpsilonNFA::operator==(const EpsilonNFA& other) const {
return this->states == other.states && this->inputAlphabet == other.inputAlphabet && this->initialStates == other.initialStates && this->finalStates == other.finalStates && this->transitions == other.transitions; return this->states == other.states && this->inputAlphabet == other.inputAlphabet && this->initialStates == other.initialStates && this->finalStates == other.finalStates && this->transitions == other.transitions;
} }
   
bool EpsilonNFA::operator<(const EpsilonNFA& other) const {
return std::tie(states, inputAlphabet, initialStates, finalStates, transitions) < std::tie(other.states, other.inputAlphabet, other.initialStates, other.finalStates, other.transitions);
}
void EpsilonNFA::operator>>(std::ostream& out) const { void EpsilonNFA::operator>>(std::ostream& out) const {
out << "(EpsilonNFA" out << "(EpsilonNFA"
<< " states = " << states << " states = " << states
......
...@@ -151,13 +151,20 @@ public: ...@@ -151,13 +151,20 @@ public:
*/ */
bool isTotal() const; bool isTotal() const;
   
virtual bool operator<(const AutomatonBase& other) const;
virtual bool operator==(const AutomatonBase& other) const; virtual bool operator==(const AutomatonBase& other) const;
virtual bool operator>(const AutomatonBase& other) const;
   
virtual bool operator==(const EpsilonNFA& other) const; virtual bool operator==(const EpsilonNFA& other) const;
virtual bool operator<(const EpsilonNFA& other) const;
   
virtual void operator>>(std::ostream& os) const; virtual void operator>>(std::ostream& os) const;
   
virtual operator std::string() const; virtual operator std::string() const;
virtual int selfTypeId() const {
return typeId(*this);
}
}; };
   
} /* namespace automaton */ } /* namespace automaton */
......
...@@ -113,10 +113,22 @@ bool ExtendedNFA::operator==(const AutomatonBase& other) const { ...@@ -113,10 +113,22 @@ bool ExtendedNFA::operator==(const AutomatonBase& other) const {
return other == *this; return other == *this;
} }
   
bool ExtendedNFA::operator<(const AutomatonBase& other) const {
return other > *this;
}
bool ExtendedNFA::operator>(const AutomatonBase& other) const {
return other < *this;
}
bool ExtendedNFA::operator==(const ExtendedNFA& other) const { bool ExtendedNFA::operator==(const ExtendedNFA& other) const {
return this->states == other.states && this->inputAlphabet == other.inputAlphabet && this->initialStates == other.initialStates && this->finalStates == other.finalStates && this->transitions == other.transitions; return this->states == other.states && this->inputAlphabet == other.inputAlphabet && this->initialStates == other.initialStates && this->finalStates == other.finalStates && this->transitions == other.transitions;
} }
   
bool ExtendedNFA::operator<(const ExtendedNFA& other) const {
return std::tie(states, inputAlphabet, initialStates, finalStates, transitions) < std::tie(other.states, other.inputAlphabet, other.initialStates, other.finalStates, other.transitions);
}
void ExtendedNFA::operator>>(std::ostream& out) const { void ExtendedNFA::operator>>(std::ostream& out) const {
out << "(ExtendedNFA" out << "(ExtendedNFA"
<< " states = " << states << " states = " << states
......
...@@ -69,13 +69,20 @@ public: ...@@ -69,13 +69,20 @@ public:
*/ */
std::map<std::pair<State, regexp::RegExp>, std::set<State> > getTransitionsToState(const State& from) const; std::map<std::pair<State, regexp::RegExp>, std::set<State> > getTransitionsToState(const State& from) const;
   
virtual bool operator<(const AutomatonBase& other) const;
virtual bool operator==(const AutomatonBase& other) const; virtual bool operator==(const AutomatonBase& other) const;
virtual bool operator>(const AutomatonBase& other) const;
   
virtual bool operator==(const ExtendedNFA& other) const; virtual bool operator==(const ExtendedNFA& other) const;
virtual bool operator<(const ExtendedNFA& other) const;
   
virtual void operator>>(std::ostream& os) const; virtual void operator>>(std::ostream& os) const;
   
virtual operator std::string() const; virtual operator std::string() const;
virtual int selfTypeId() const {
return typeId(*this);
}
}; };
   
} /* namespace automaton */ } /* namespace automaton */
......
...@@ -125,10 +125,22 @@ bool NFA::operator==(const AutomatonBase& other) const { ...@@ -125,10 +125,22 @@ bool NFA::operator==(const AutomatonBase& other) const {
return other == *this; return other == *this;
} }
   
bool NFA::operator<(const AutomatonBase& other) const {
return other > *this;
}
bool NFA::operator>(const AutomatonBase& other) const {
return other < *this;
}
bool NFA::operator==(const NFA& other) const { bool NFA::operator==(const NFA& other) const {
return this->states == other.states && this->inputAlphabet == other.inputAlphabet && this->initialStates == other.initialStates && this->finalStates == other.finalStates && this->transitions == other.transitions; return this->states == other.states && this->inputAlphabet == other.inputAlphabet && this->initialStates == other.initialStates && this->finalStates == other.finalStates && this->transitions == other.transitions;
} }
   
bool NFA::operator<(const NFA& other) const {
return std::tie(states, inputAlphabet, initialStates, finalStates, transitions) < std::tie(other.states, other.inputAlphabet, other.initialStates, other.finalStates, other.transitions);
}
void NFA::operator>>(std::ostream& out) const { void NFA::operator>>(std::ostream& out) const {
out << "(NFA" out << "(NFA"
<< " states = " << states << " states = " << states
......
...@@ -89,13 +89,20 @@ public: ...@@ -89,13 +89,20 @@ public:
*/ */
bool isTotal() const; bool isTotal() const;
   
virtual bool operator<(const AutomatonBase& other) const;
virtual bool operator==(const AutomatonBase& other) const; virtual bool operator==(const AutomatonBase& other) const;
virtual bool operator>(const AutomatonBase& other) const;
   
virtual bool operator==(const NFA& other) const; virtual bool operator==(const NFA& other) const;
virtual bool operator<(const NFA& other) const;
   
virtual void operator>>(std::ostream& os) const; virtual void operator>>(std::ostream& os) const;
   
virtual operator std::string() const; virtual operator std::string() const;
virtual int selfTypeId() const {
return typeId(*this);
}
}; };
   
} /* namespace automaton */ } /* namespace automaton */
......
...@@ -137,10 +137,22 @@ bool NPDA::operator==(const AutomatonBase& other) const { ...@@ -137,10 +137,22 @@ bool NPDA::operator==(const AutomatonBase& other) const {
return other == *this; return other == *this;
} }
   
bool NPDA::operator<(const AutomatonBase& other) const {
return other > *this;
}
bool NPDA::operator>(const AutomatonBase& other) const {
return other < *this;
}
bool NPDA::operator==(const NPDA& other) const { bool NPDA::operator==(const NPDA& other) const {
return this->states == other.states && this->inputAlphabet == other.inputAlphabet && this->initialStates == other.initialStates && this->finalStates == other.finalStates && this->stackAlphabet == other.stackAlphabet && this->initialSymbols == other.initialSymbols && this->transitions == other.transitions; return this->states == other.states && this->inputAlphabet == other.inputAlphabet && this->initialStates == other.initialStates && this->finalStates == other.finalStates && this->stackAlphabet == other.stackAlphabet && this->initialSymbols == other.initialSymbols && this->transitions == other.transitions;
} }
   
bool NPDA::operator<(const NPDA& other) const {
return std::tie(states, inputAlphabet, initialStates, finalStates, stackAlphabet, initialSymbols, transitions) < std::tie(other.states, other.inputAlphabet, other.initialStates, other.finalStates, other.stackAlphabet, other.initialSymbols, other.transitions);
}
void NPDA::operator>>(std::ostream& out) const { void NPDA::operator>>(std::ostream& out) const {
out << "(NPDA" out << "(NPDA"
<< "states = " << states << "states = " << states
......
...@@ -75,13 +75,21 @@ public: ...@@ -75,13 +75,21 @@ public:
*/ */
const std::map<std::tuple<State, std::variant<string::Epsilon, alphabet::Symbol>, std::vector<alphabet::Symbol> >, std::set<std::pair<State, std::vector<alphabet::Symbol> > > >& getTransitions() const; const std::map<std::tuple<State, std::variant<string::Epsilon, alphabet::Symbol>, std::vector<alphabet::Symbol> >, std::set<std::pair<State, std::vector<alphabet::Symbol> > > >& getTransitions() const;
   
virtual bool operator<(const AutomatonBase& other) const;
virtual bool operator==(const AutomatonBase& other) const; virtual bool operator==(const AutomatonBase& other) const;
virtual bool operator>(const AutomatonBase& other) const;
   
virtual bool operator==(const NPDA& other) const; virtual bool operator==(const NPDA& other) const;
   
virtual bool operator<(const NPDA& other) const;
virtual void operator>>(std::ostream& os) const; virtual void operator>>(std::ostream& os) const;
   
virtual operator std::string() const; virtual operator std::string() const;
virtual int selfTypeId() const {
return typeId(*this);
}
}; };
   
} /* namespace automaton */ } /* namespace automaton */
......
...@@ -133,10 +133,22 @@ bool SinglePopNPDA::operator==(const AutomatonBase& other) const { ...@@ -133,10 +133,22 @@ bool SinglePopNPDA::operator==(const AutomatonBase& other) const {
return other == *this; return other == *this;
} }
   
bool SinglePopNPDA::operator<(const AutomatonBase& other) const {
return other > *this;
}
bool SinglePopNPDA::operator>(const AutomatonBase& other) const {
return other < *this;
}
bool SinglePopNPDA::operator==(const SinglePopNPDA& other) const { bool SinglePopNPDA::operator==(const SinglePopNPDA& other) const {
return this->states == other.states && this->inputAlphabet == other.inputAlphabet && this->initialStates == other.initialStates && this->finalStates == other.finalStates && this->stackAlphabet == other.stackAlphabet && this->initialSymbols == other.initialSymbols && this->transitions == other.transitions; return this->states == other.states && this->inputAlphabet == other.inputAlphabet && this->initialStates == other.initialStates && this->finalStates == other.finalStates && this->stackAlphabet == other.stackAlphabet && this->initialSymbols == other.initialSymbols && this->transitions == other.transitions;
} }
   
bool SinglePopNPDA::operator<(const SinglePopNPDA& other) const {
return std::tie(states, inputAlphabet, initialStates, finalStates, stackAlphabet, initialSymbols, transitions) < std::tie(other.states, other.inputAlphabet, other.initialStates, other.finalStates, other.stackAlphabet, other.initialSymbols, other.transitions);
}
void SinglePopNPDA::operator>>(std::ostream& out) const { void SinglePopNPDA::operator>>(std::ostream& out) const {
out << "(SinglePopNPDA" out << "(SinglePopNPDA"
<< "states = " << states << "states = " << states
......
...@@ -75,13 +75,20 @@ public: ...@@ -75,13 +75,20 @@ public:
*/ */
const std::map<std::tuple<State, std::variant<string::Epsilon, alphabet::Symbol>, alphabet::Symbol>, std::set<std::pair<State, std::vector<alphabet::Symbol> > > >& getTransitions() const; const std::map<std::tuple<State, std::variant<string::Epsilon, alphabet::Symbol>, alphabet::Symbol>, std::set<std::pair<State, std::vector<alphabet::Symbol> > > >& getTransitions() const;
   
virtual bool operator<(const AutomatonBase& other) const;
virtual bool operator==(const AutomatonBase& other) const; virtual bool operator==(const AutomatonBase& other) const;
virtual bool operator>(const AutomatonBase& other) const;
   
virtual bool operator==(const SinglePopNPDA& other) const; virtual bool operator==(const SinglePopNPDA& other) const;
virtual bool operator<(const SinglePopNPDA& other) const;
   
virtual void operator>>(std::ostream& os) const; virtual void operator>>(std::ostream& os) const;
   
virtual operator std::string() const; virtual operator std::string() const;
virtual int selfTypeId() const {
return typeId(*this);
}
}; };
   
} /* namespace automaton */ } /* namespace automaton */
......
...@@ -115,10 +115,22 @@ bool OneTapeDTM::operator==(const AutomatonBase& other) const { ...@@ -115,10 +115,22 @@ bool OneTapeDTM::operator==(const AutomatonBase& other) const {
return other == *this; return other == *this;
} }
   
bool OneTapeDTM::operator<(const AutomatonBase& other) const {
return other > *this;
}
bool OneTapeDTM::operator>(const AutomatonBase& other) const {
return other < *this;
}
bool OneTapeDTM::operator==(const OneTapeDTM& other) const { bool OneTapeDTM::operator==(const OneTapeDTM& other) const {
return this->states == other.states && this->inputAlphabet == other.inputAlphabet && this->initialState == other.initialState && this->finalStates == other.finalStates && this->tapeAlphabet == other.tapeAlphabet && this->blankSymbol == other.blankSymbol && this->transitions == other.transitions; return this->states == other.states && this->inputAlphabet == other.inputAlphabet && this->initialState == other.initialState && this->finalStates == other.finalStates && this->tapeAlphabet == other.tapeAlphabet && this->blankSymbol == other.blankSymbol && this->transitions == other.transitions;
} }
   
bool OneTapeDTM::operator<(const OneTapeDTM& other) const {
return std::tie(states, inputAlphabet, initialState, finalStates, tapeAlphabet, blankSymbol, transitions) < std::tie(other.states, other.inputAlphabet, other.initialState, other.finalStates, other.tapeAlphabet, other.blankSymbol, other.transitions);
}
void OneTapeDTM::operator>>(std::ostream& out) const { void OneTapeDTM::operator>>(std::ostream& out) const {
out << "(OneTapeDTM" out << "(OneTapeDTM"
<< "states = " << states << "states = " << states
......
...@@ -73,13 +73,21 @@ public: ...@@ -73,13 +73,21 @@ public:
*/ */
const std::map<std::pair<State, alphabet::Symbol>, std::tuple<State, alphabet::Symbol, Shift> >& getTransitions() const; const std::map<std::pair<State, alphabet::Symbol>, std::tuple<State, alphabet::Symbol, Shift> >& getTransitions() const;
   
virtual bool operator<(const AutomatonBase& other) const;
virtual bool operator==(const AutomatonBase& other) const; virtual bool operator==(const AutomatonBase& other) const;
virtual bool operator>(const AutomatonBase& other) const;
   
virtual bool operator==(const OneTapeDTM& other) const; virtual bool operator==(const OneTapeDTM& other) const;
   
virtual bool operator<(const OneTapeDTM& other) const;
virtual void operator>>(std::ostream& os) const; virtual void operator>>(std::ostream& os) const;
   
virtual operator std::string() const; virtual operator std::string() const;
virtual int selfTypeId() const {
return typeId(*this);
}
}; };
   
} /* namespace automaton */ } /* namespace automaton */
......
...@@ -8,6 +8,7 @@ ...@@ -8,6 +8,7 @@
#include "UnknownAutomaton.h" #include "UnknownAutomaton.h"
#include "../std/set.hpp" #include "../std/set.hpp"
#include <sstream> #include <sstream>
#include "../std/pointer.hpp"
   
#include "AutomatonException.h" #include "AutomatonException.h"
   
...@@ -184,6 +185,14 @@ bool UnknownAutomaton::operator==(const AutomatonBase& other) const { ...@@ -184,6 +185,14 @@ bool UnknownAutomaton::operator==(const AutomatonBase& other) const {
return other == *this; return other == *this;
} }
   
bool UnknownAutomaton::operator<(const AutomatonBase& other) const {
return other > *this;
}
bool UnknownAutomaton::operator>(const AutomatonBase& other) const {
return other < *this;
}
bool UnknownAutomaton::operator==(const UnknownAutomaton& other) const { bool UnknownAutomaton::operator==(const UnknownAutomaton& other) const {
return states == other.states return states == other.states
&& inputAlphabet == other.inputAlphabet && inputAlphabet == other.inputAlphabet
...@@ -196,6 +205,13 @@ bool UnknownAutomaton::operator==(const UnknownAutomaton& other) const { ...@@ -196,6 +205,13 @@ bool UnknownAutomaton::operator==(const UnknownAutomaton& other) const {
&& transitions == other.transitions; && transitions == other.transitions;
} }
   
bool UnknownAutomaton::operator<(const UnknownAutomaton& other) const {
std::pointer<alphabet::Symbol> blankSymbolPointer(blankSymbol);
std::pointer<alphabet::Symbol> otherBlankSymbolPointer(other.blankSymbol);
return std::tie(states, inputAlphabet, initialStates, finalStates, stackAlphabet, initialSymbols, tapeAlphabet, blankSymbolPointer, transitions) < std::tie(other.states, other.inputAlphabet, other.initialStates, other.finalStates, other.stackAlphabet, other.initialSymbols, other.tapeAlphabet, otherBlankSymbolPointer, other.transitions);
}
void UnknownAutomaton::operator>>(std::ostream& out) const { void UnknownAutomaton::operator>>(std::ostream& out) const {
out << "(UnknownAutomaton" out << "(UnknownAutomaton"
<< " states = " << states << " states = " << states
......
...@@ -271,17 +271,24 @@ public: ...@@ -271,17 +271,24 @@ public:
*/ */
const std::set<UnknownTransition>& getTransitions() const; const std::set<UnknownTransition>& getTransitions() const;
virtual bool operator>(const AutomatonBase& other) const;
virtual bool operator==(const AutomatonBase& other) const;
virtual bool operator<(const AutomatonBase& other) const;
/** /**
* Compares two instances of UnknownAutomata * Compares two instances of UnknownAutomata
* @return true if this and other instance are same * @return true if this and other instance are same
*/ */
virtual bool operator<(const UnknownAutomaton& other) const;
virtual bool operator==(const UnknownAutomaton& other) const; virtual bool operator==(const UnknownAutomaton& other) const;
   
virtual bool operator==(const AutomatonBase& other) const;
virtual void operator>>(std::ostream& os) const; virtual void operator>>(std::ostream& os) const;
   
virtual operator std::string() const; virtual operator std::string() const;
virtual int selfTypeId() const {
return typeId(*this);
}
}; };
   
} /* namespace automaton */ } /* namespace automaton */
......
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