8 #include "timed_automaton.hh"
9 #include "zone_automaton.hh"
21 std::array<unsigned int, CHAR_MAX> delta{};
23 std::unordered_set<char> endChars;
31 std::vector<std::unordered_set<char>> charSet;
32 bool accepted =
false;
34 std::vector<std::shared_ptr<ZAState>> CStates = ZA.
initialStates;
36 if (CStates.empty()) {
37 std::cerr <<
"monaa: empty pattern" << std::endl;
40 std::vector<std::shared_ptr<ZAState>> NStates;
43 for (
const auto& zaState : CStates) {
44 std::unordered_set<std::shared_ptr<ZAState>> closure;
45 closure.insert(zaState);
46 epsilonClosure(closure);
47 for (
const auto& state : closure) {
48 for (
char c = 1; c < CHAR_MAX; c++) {
49 for (
const auto& nextState : state->next[c]) {
50 auto sharedNext = nextState.lock();
54 accepted = accepted || sharedNext->isMatch;
55 NStates.push_back(sharedNext);
56 charSet[m - 1].insert(c);
66 for (
int i = 0; i <= m - 1; i++) {
67 for (
char s : charSet[i]) {
71 endChars = charSet[m - 1];
73 unsigned int at(std::size_t n)
const {
return delta.at(n); }
74 unsigned int operator[](std::size_t n)
const {
return delta[n]; }
76 int getM()
const {
return m; }
77 void getEndChars(std::unordered_set<char> &endCharsHolder)
const {
78 endCharsHolder = this->endChars;
The skip value function based on Sunday's quick search.
Definition: sunday_skip_value.hh:17
int getM() const
Minimum length of the recognized language.
Definition: sunday_skip_value.hh:76
std::vector< std::shared_ptr< State > > initialStates
The initial states of this automaton.
Definition: common_types.hh:19
A timed automaton.
Definition: timed_automaton.hh:54
Definition: zone_automaton.hh:55
void removeDeadStates()
remove states unreachable to any accepting states
Definition: zone_automaton.hh:59