| 498 | } |
| 499 | |
| 500 | bool |
| 501 | DFA::equal(const DFA& d) const { |
| 502 | assert(n_states() == d.n_states()); |
| 503 | assert(n_transitions() == d.n_transitions()); |
| 504 | assert(n_symbols() == d.n_symbols()); |
| 505 | assert(final_fst() == d.final_fst()); |
| 506 | assert(final_lst() == d.final_lst()); |
| 507 | DFA::Transitions me(*this); |
| 508 | DFA::Transitions they(d); |
| 509 | while (me()) { |
| 510 | if (me.i_state() != they.i_state()) |
| 511 | return false; |
| 512 | if (me.symbol() != they.symbol()) |
| 513 | return false; |
| 514 | if (me.o_state() != they.o_state()) |
| 515 | return false; |
| 516 | ++me; |
| 517 | ++they; |
| 518 | } |
| 519 | return true; |
| 520 | } |
| 521 | |
| 522 | } |
| 523 | |