Go to the documentation of this file.00001 #ifndef _IAUTOMATON_H_414567883019_
00002 #define _IAUTOMATON_H_414567883019_
00003
00004 #include "itransition.h"
00005 #include "istate.h"
00006
00007 #include <QSharedPointer>
00008 #include <QPointF>
00009
00010
00011
00012
00013 class ITTRow
00014 {
00015 public:
00016 virtual ~ITTRow() {}
00017
00018 virtual const QStringList head() const = 0;
00019 virtual const QStringList getValue(const QString &character) const = 0;
00020
00021 virtual QStringList& operator[](const QString &character) = 0;
00022
00023 virtual QList<QString> getUniqueKeys() const = 0;
00024
00025 virtual void setInitialFlag(bool inital) = 0;
00026 virtual void setFinalFlag(bool final) = 0;
00027
00028 virtual bool initialFlag() const = 0;
00029 virtual bool finalFlag() const = 0;
00030 };
00031
00032
00033
00034
00035
00036 class ITransitionTable
00037 {
00038 public:
00039 virtual ~ITransitionTable() {}
00040
00041 virtual int getRowCount() const = 0;
00042
00043 virtual QSharedPointer<ITTRow> getRow(int idx) const = 0;
00044
00045 virtual int addRow(const QSharedPointer<ITTRow> &row) = 0;
00046
00047 virtual QList<QString> getUniqueKeys() const = 0;
00048
00049 virtual QString toLaTeXTable() const = 0;
00050 virtual QString toStringTable() const = 0;
00051 };
00052
00053
00054
00055
00056
00057
00058
00059 class IAutomaton
00060 {
00061 public:
00062
00063 typedef QList<QSharedPointer<IAutomaton> > TAutomataList;
00064 typedef QMap<QString, QPointF> TPositioningMap;
00065
00066 virtual ~IAutomaton(){}
00067
00068 virtual IState::TIStateList getStates() const = 0;
00069 virtual IState::TIStateList getInitialStates() const = 0;
00070 virtual IState::TIStateList getFinalStates() const = 0;
00071
00072 virtual IState::TIStateNameList getStateNameList() const = 0;
00073
00074 virtual ITransition::TITransitionList getTransitions() const = 0;
00075
00076 virtual QSharedPointer<ITransitionTable> getTransitionTable() const = 0;
00077
00078 virtual void setAlphabet(const ITransition::TCharSet &alphabet) = 0;
00079 virtual void setAlphabetSymbol(const QString &alphabetSymbol) = 0;
00080 virtual void setEpsilonSymbol(const QString &epsilonSymbol) = 0;
00081
00082 virtual ITransition::TCharSet getAlphabet() const = 0;
00083 virtual QString getAlphabetSymbol() const = 0;
00084 virtual QString getEpsilonSymbol() const = 0;
00085
00086 virtual QSharedPointer<IState> getState(const QString &name) const = 0;
00087 virtual bool removeState(const QSharedPointer<IState> &state) = 0;
00088 virtual bool removeState(const QString &stateName) = 0;
00089
00090 virtual bool removeTransition(const QSharedPointer<ITransition> &tr) = 0;
00091
00092
00093 virtual bool renameState(const QSharedPointer<IState> &state, const QString &newName) = 0;
00094
00095
00096 virtual QSharedPointer<IState> createState
00097 (const QString &name, const QString &label, bool initial, bool final) = 0;
00098
00099
00100
00101
00102
00103 virtual bool allowRedundantTransitions() const = 0;
00104
00105 virtual void setAllowRedundantTransitions(bool allow) = 0;
00106
00107
00108
00109
00110 virtual QSharedPointer<ITransition> createTransition
00111 (const QString &source, const QString &dest, const ITransition::TCharSet &characters) = 0;
00112
00113
00114
00115 virtual bool hasMultipleInitials() const = 0;
00116 virtual bool hasEpsilonTransitions() const = 0;
00117 virtual bool isDeterministic() const = 0;
00118
00119 virtual bool hasState(const QString &name) const = 0;
00120 virtual ITransition::TCharSet getTransitionSymbols(const QString &source, const QString &dest) const = 0;
00121
00122
00123
00124
00125
00126 virtual bool hasPositions() const = 0;
00127
00128 virtual TPositioningMap getPositioningMap() const = 0;
00129
00130 virtual void setPositioningMap(const TPositioningMap &map) = 0;
00131
00132
00133
00134
00135
00136 virtual void reset() = 0;
00137
00138 virtual bool processCharacter(const QString &character) = 0;
00139
00140 virtual bool isConfigurationAccepted() const = 0;
00141
00142 virtual IState::TIStateList getActiveStates() const = 0;
00143
00144 virtual QStringList getActiveStatesNames() const = 0;
00145
00146 virtual QStringList getProcessedString() const = 0;
00147
00148 };
00149
00150
00151
00152
00153
00154
00155
00156 class IAutomataCreator
00157 {
00158 public:
00159 virtual ~IAutomataCreator() {}
00160
00161
00162 virtual QSharedPointer<IAutomaton> createAutomaton(const ITransition::TCharSet &alphabet,
00163 const QString &alphabetSymbol,
00164 const QString &epsilonSymbol) = 0;
00165
00166
00167
00168 };
00169
00170
00171 #endif //_IAUTOMATON_H_414567883019_