-
Notifications
You must be signed in to change notification settings - Fork 0
/
Copy pathDFA.h
57 lines (45 loc) · 1.39 KB
/
DFA.h
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
#ifndef DFA_H
#define DFA_H
#include<QString>
#include <QSet>
#include "nodedfa.h"
#include<QMap>
class DFA {
public:
//Default Constructer of DFA
DFA();
~DFA();
// Default Constructer of DFA and build DFA
DFA(QList<QString>KeyWords);
//Build DFA
void LoadDFA(QList<QString>KeyWords);
// Get
NodeDFA * getStartState();
NodeDFA * getFinit_WordsState();
NodeDFA * getSeparate_wordsState();
QSet<NodeDFA*> getFinitStates();
QSet<NodeDFA*> getAllStates();
QSet<NodeDFA*> getNonFinitStates();
QList<char> getAlphabetic();
QList<char> getSeparate_wordsAlphabetic();
void addToFinitState(NodeDFA* state);
void addToState(NodeDFA* state);
//Set
void setStartState(NodeDFA *state);
void setFinit_WordsState(NodeDFA *state);
void setSeparate_wordsState(NodeDFA *state);
void setAlphabetic(QList<char> alphabetic);
void setSeparate_wordsAlphabetic(QList<char> alphabetic);
// simulate DFA (Run DFA)
QHash<QString,int> SimulateDFA(QString input); //Simulate DFA and return True or false
void simplify();
//private:
NodeDFA *StartState ;
NodeDFA *Separate_wordsState;
NodeDFA *Finit_wordsState;
QList<char> Alphabetic ;
QList<char> Separate_wordsAlphabetic ;
QSet<NodeDFA*> FinitStates;
QSet<NodeDFA*> AllStates;
};
#endif // DFA_H