Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Get symbols to work with #419

Merged
merged 3 commits into from
Jul 9, 2024
Merged

Get symbols to work with #419

merged 3 commits into from
Jul 9, 2024

Conversation

Adda0
Copy link
Collaborator

@Adda0 Adda0 commented Jul 9, 2024

This PR:

  1. extracts a utility function to get a set of symbols to work with during an operation on NFA. The symbols are collected either from an alphabet passed as an argument, or if it is nullptr (by default if the alphabet is not passed), from an alphabet shared between NFAs pointed to by Nfa::alphabet, or if it is also nullptr, from transition relation (reading all symbols used in transition relation).
  2. uses the utility function to make the method make_complete() callable without any arguments.
  3. modifies the make_complete() function to pass alphabet as a pointer, as in all other functions in Mata.

@Adda0 Adda0 requested a review from jurajsic July 9, 2024 12:45
@@ -1208,6 +1202,12 @@ std::set<mata::Word> mata::nfa::Nfa::get_words(unsigned max_length) {
return result;
}

OrdVector<Symbol> mata::nfa::get_symbols_to_work_with(const Nfa& nfa, const mata::Alphabet *const shared_alphabet) {
Copy link
Member

@jurajsic jurajsic Jul 9, 2024

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Shouldn't this be return const OrdVector<Symbol>&? Or do those functions (get_alphabet_symbols() and get_used_symbols()) create the ordvector and return by value?

Copy link
Collaborator Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

No. It is constructing the set of symbols, either from alphabets (which themselves do not necessarily have a handy OrdVector<Symbol> allocated either), or constructing a new set directly from the transition relation. Therefore, a new set has to be allocated.

@Adda0 Adda0 merged commit 9deba89 into devel Jul 9, 2024
18 checks passed
@Adda0 Adda0 deleted the get_symbols_to_work_with branch July 9, 2024 16:29
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

2 participants