-
Notifications
You must be signed in to change notification settings - Fork 0
/
rabin_automaton.h
67 lines (52 loc) · 1.6 KB
/
rabin_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
#ifndef RABIN_AUTOMATON_H
#define RABIN_AUTOMATON_H
#include <list>
#include <utility>
#include "run.h"
class Acceptance final
{
public:
bitset_t l;
bitset_t u;
Acceptance(const bitset_t &l, const bitset_t &u) : l{l}, u{u} {};
Acceptance(const bitset_t &&l, const bitset_t &&u) : l{std::move(l)}, u{std::move(u)} {};
};
std::ostream &operator<<(std::ostream &, const Acceptance &);
struct Out_transition
{
state_t left;
state_t right;
};
class Illegal_state_set
{
};
class Rabin_automaton final
{
public:
const state_t states;
private:
state_t starting_state;
bool has_transitions;
std::list<Out_transition> *transitions;
std::list<Acceptance> conditions;
public:
Rabin_automaton(const state_t);
Rabin_automaton(const Rabin_automaton &);
Rabin_automaton(Rabin_automaton &&);
~Rabin_automaton();
Rabin_automaton &operator=(const Rabin_automaton &) = delete;
Rabin_automaton &operator=(Rabin_automaton &&) = delete;
state_t get_start() const { return starting_state; };
void set_start(const state_t q) { starting_state = q; };
bool is_valid_state(const state_t q) const { return q < states; };
void add_transition(const state_t, const state_t, const state_t);
void add_acceptance(const bitset_t &, const bitset_t &);
void add_acceptance(bitset_t &&, bitset_t &&);
Run *find_run(const int max_threads = 1) const;
std::ostream &print_logic_prog_rep(std::ostream &) const;
private:
std::ostream &acceptances_print_logic_prog_rep(std::ostream &) const;
friend std::ostream &operator<<(std::ostream &, const Rabin_automaton &);
};
std::ostream &operator<<(std::ostream &, const Rabin_automaton &);
#endif