-
Notifications
You must be signed in to change notification settings - Fork 0
/
Copy pathautomaton.h
73 lines (56 loc) · 1.28 KB
/
automaton.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
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
#include <map>
#include <set>
#include <vector>
#include <string>
using namespace std;
#ifndef AUT_H
#define AUT_H
class State {
public:
vector<State *> accessibleStates;
vector<string> transitions;
map<string, int> transPos;
int _idx;
bool final;
State();
~State();
void addTransition (State * state, string transition);
bool containsTranstionTo (State *);
string getTranstionTo (State *);
void modifyTransitionTo (State * state, const string & transition);
State * getNext (string transition);
virtual string toString() {return "";};
virtual string getName() {return "";};
};
class NulaState: public State {
public:
int x;
int y;
NulaState(int x, int y);
NulaState();
~NulaState();
int getIdx();
string toString();
string getName();
};
class DulaState: public State {
public:
int idx;
set<int> nulaStates;
DulaState(int idx);
DulaState();
~DulaState();
int statePosition (DulaState * state);
string toString();
string getName();
State * getNext (string transition);
};
class Automaton {
public:
map<int, State *> states;
~Automaton ();
};
void saveAutomaton (Automaton * aut, const string & filename);
void saveAutomatonAsFst (Automaton * aut, const string & filename, int wordSize);
void graphVizOutput (Automaton * aut, const string & filename);
#endif