fixed complement

This commit is contained in:
Tocuro 2024-01-09 17:00:16 +01:00
parent 0d47de5c44
commit 4422270452
3 changed files with 44 additions and 44 deletions

View file

@ -362,26 +362,6 @@ public class NFAImpl implements NFA {
fakeNFA.acceptingStates.clear();
fakeNFA.addAllAcceptingStates(newAcceptingState);
Set<Character> originalAlphabet = new HashSet<>(fakeNFA.alphabet);
fakeNFA.alphabet.clear();
Set<Character> newAlphabet = new HashSet<>();
for (char ch = 'a'; ch <= 'z'; ch++) {
if (!originalAlphabet.contains(ch)) {
newAlphabet.add(ch);
}
}
for (Transition transition : fakeNFA.transitions) {
for (Character letter : newAlphabet) {
fakeNFA.addTransition(new Transition(transition.fromState(), letter, transition.toState()));
}
}
fakeNFA.alphabet = newAlphabet;
fakeNFA.finalizeAutomaton();
return fakeNFA;