diff --git a/.idea/shelf/Uncommitted_changes_before_Checkout_at_08_01_2024_23_40_[Changes]/shelved.patch b/.idea/shelf/Uncommitted_changes_before_Checkout_at_08_01_2024_23_40_[Changes]/shelved.patch
new file mode 100644
index 0000000..a6bb22c
--- /dev/null
+++ b/.idea/shelf/Uncommitted_changes_before_Checkout_at_08_01_2024_23_40_[Changes]/shelved.patch
@@ -0,0 +1,126 @@
+Index: .idea/workspace.xml
+IDEA additional info:
+Subsystem: com.intellij.openapi.diff.impl.patch.BaseRevisionTextPatchEP
+<+>\r\n\r\n \r\n \r\n \r\n \r\n \r\n \r\n \r\n \r\n
\r\n
\r\n
\r\n \r\n \r\n \r\n \r\n \r\n \r\n \r\n \r\n \r\n \r\n \r\n \r\n \r\n {\r\n "lastFilter": {\r\n "state": "OPENED",\r\n "assignee": {\r\n "type": "org.jetbrains.plugins.gitlab.mergerequest.ui.filters.GitLabMergeRequestsFiltersValue.MergeRequestsMemberFilterValue.MergeRequestsAssigneeFilterValue",\r\n "username": "rawalcher",\r\n "fullname": "rawalcher"\r\n }\r\n }\r\n} \r\n {\r\n "selectedUrlAndAccountId": {\r\n "first": "https://git-ainf.aau.at/rawalcher/theorethische-informatik-gruppe-10.git",\r\n "second": "2afc8825-f511-4d8a-8cc1-901875567c84"\r\n }\r\n} \r\n \r\n \r\n \r\n {\r\n "associatedIndex": 2\r\n} \r\n \r\n \r\n \r\n \r\n \r\n \r\n \r\n \r\n \r\n \r\n \r\n \r\n \r\n \r\n \r\n \r\n \r\n \r\n \r\n \r\n \r\n \r\n \r\n \r\n \r\n \r\n \r\n \r\n \r\n \r\n \r\n \r\n \r\n \r\n \r\n \r\n \r\n \r\n \r\n \r\n \r\n \r\n \r\n \r\n \r\n \r\n \r\n \r\n \r\n \r\n \r\n \r\n \r\n \r\n \r\n \r\n \r\n \r\n \r\n \r\n \r\n \r\n \r\n \r\n \r\n \r\n \r\n \r\n \r\n \r\n \r\n \r\n \r\n \r\n \r\n \r\n \r\n \r\n \r\n \r\n \r\n \r\n \r\n \r\n \r\n \r\n \r\n \r\n \r\n \r\n \r\n \r\n \r\n \r\n \r\n \r\n
\r\n \r\n \r\n \r\n \r\n \r\n \r\n \r\n \r\n \r\n \r\n \r\n \r\n \r\n 1704700820495 \r\n \r\n \r\n 1704700820495 \r\n \r\n \r\n \r\n \r\n \r\n \r\n 1704734947115 \r\n \r\n \r\n \r\n 1704734947115 \r\n \r\n \r\n \r\n \r\n \r\n \r\n \r\n \r\n \r\n \r\n \r\n \r\n \r\n \r\n \r\n \r\n file://$PROJECT_DIR$/src/test/java/ab1/tests/ComplexTests.java \r\n 171 \r\n \r\n \r\n \r\n file://$PROJECT_DIR$/src/test/java/ab1/tests/ComplexTests.java \r\n 15 \r\n \r\n \r\n \r\n file://$PROJECT_DIR$/src/main/java/ab1/impl/GRUPPE/NFAImpl.java \r\n 447 \r\n \r\n \r\n \r\n \r\n \r\n \r\n \r\n \r\n \r\n \r\n
+Subsystem: com.intellij.openapi.diff.impl.patch.CharsetEP
+<+>UTF-8
+===================================================================
+diff --git a/.idea/workspace.xml b/.idea/workspace.xml
+--- a/.idea/workspace.xml (revision b1b97fff10c85cc1d368f8304a716300729e71a3)
++++ b/.idea/workspace.xml (date 1704752627213)
+@@ -4,10 +4,8 @@
+
+
+
+-
+-
++
+
+-
+
+
+
+@@ -53,7 +51,9 @@
+
+
+-
++
++
++
++
++
++
++
++
++
++
++
++
++
++
++
++
+
+
+
+@@ -126,20 +141,6 @@
+
+
+
+-
+-
+-
+-
+-
+-
+-
+-
+-
+-
+-
+-
+-
+-
+
+
+
+@@ -157,11 +158,11 @@
+
+
+
++
+
+
+
+
+-
+
+
+
+@@ -192,7 +193,15 @@
+
+ 1704734947115
+
+-
++
++
++ 1704752454444
++
++
++
++ 1704752454444
++
++
+
+
+
+@@ -201,7 +210,8 @@
+
+
+
+-
++
++
+
+
+
+@@ -218,7 +228,7 @@
+
+
+ file://$PROJECT_DIR$/src/main/java/ab1/impl/GRUPPE/NFAImpl.java
+- 447
++ 448
+
+
+
diff --git a/.idea/shelf/Uncommitted_changes_before_Checkout_at_08_01_2024_23_40__Changes_.xml b/.idea/shelf/Uncommitted_changes_before_Checkout_at_08_01_2024_23_40__Changes_.xml
new file mode 100644
index 0000000..569e971
--- /dev/null
+++ b/.idea/shelf/Uncommitted_changes_before_Checkout_at_08_01_2024_23_40__Changes_.xml
@@ -0,0 +1,4 @@
+
+
+
+
\ No newline at end of file
diff --git a/.idea/shelf/Uncommitted_changes_before_Checkout_at_09_01_2024_17_27_[Changes]/FinalizeTests.class b/.idea/shelf/Uncommitted_changes_before_Checkout_at_09_01_2024_17_27_[Changes]/FinalizeTests.class
new file mode 100644
index 0000000..17e959c
Binary files /dev/null and b/.idea/shelf/Uncommitted_changes_before_Checkout_at_09_01_2024_17_27_[Changes]/FinalizeTests.class differ
diff --git a/.idea/shelf/Uncommitted_changes_before_Checkout_at_09_01_2024_17_27_[Changes]/NFAImpl.class b/.idea/shelf/Uncommitted_changes_before_Checkout_at_09_01_2024_17_27_[Changes]/NFAImpl.class
new file mode 100644
index 0000000..a18bce3
Binary files /dev/null and b/.idea/shelf/Uncommitted_changes_before_Checkout_at_09_01_2024_17_27_[Changes]/NFAImpl.class differ
diff --git a/.idea/shelf/Uncommitted_changes_before_Checkout_at_09_01_2024_17_27_[Changes]/Transition$TransitionBuilder.class b/.idea/shelf/Uncommitted_changes_before_Checkout_at_09_01_2024_17_27_[Changes]/Transition$TransitionBuilder.class
new file mode 100644
index 0000000..8deddb3
Binary files /dev/null and b/.idea/shelf/Uncommitted_changes_before_Checkout_at_09_01_2024_17_27_[Changes]/Transition$TransitionBuilder.class differ
diff --git a/.idea/shelf/Uncommitted_changes_before_Checkout_at_09_01_2024_17_27_[Changes]/Transition.class b/.idea/shelf/Uncommitted_changes_before_Checkout_at_09_01_2024_17_27_[Changes]/Transition.class
new file mode 100644
index 0000000..55ad5d1
Binary files /dev/null and b/.idea/shelf/Uncommitted_changes_before_Checkout_at_09_01_2024_17_27_[Changes]/Transition.class differ
diff --git a/.idea/shelf/Uncommitted_changes_before_Checkout_at_09_01_2024_17_27_[Changes]/shelved.patch b/.idea/shelf/Uncommitted_changes_before_Checkout_at_09_01_2024_17_27_[Changes]/shelved.patch
new file mode 100644
index 0000000..e69de29
diff --git a/.idea/shelf/Uncommitted_changes_before_Checkout_at_09_01_2024_17_27_[Changes]1/FinalizeTests.class b/.idea/shelf/Uncommitted_changes_before_Checkout_at_09_01_2024_17_27_[Changes]1/FinalizeTests.class
new file mode 100644
index 0000000..17e959c
Binary files /dev/null and b/.idea/shelf/Uncommitted_changes_before_Checkout_at_09_01_2024_17_27_[Changes]1/FinalizeTests.class differ
diff --git a/.idea/shelf/Uncommitted_changes_before_Checkout_at_09_01_2024_17_27_[Changes]1/NFAImpl.class b/.idea/shelf/Uncommitted_changes_before_Checkout_at_09_01_2024_17_27_[Changes]1/NFAImpl.class
new file mode 100644
index 0000000..a18bce3
Binary files /dev/null and b/.idea/shelf/Uncommitted_changes_before_Checkout_at_09_01_2024_17_27_[Changes]1/NFAImpl.class differ
diff --git a/.idea/shelf/Uncommitted_changes_before_Checkout_at_09_01_2024_17_27_[Changes]1/Transition$TransitionBuilder.class b/.idea/shelf/Uncommitted_changes_before_Checkout_at_09_01_2024_17_27_[Changes]1/Transition$TransitionBuilder.class
new file mode 100644
index 0000000..8deddb3
Binary files /dev/null and b/.idea/shelf/Uncommitted_changes_before_Checkout_at_09_01_2024_17_27_[Changes]1/Transition$TransitionBuilder.class differ
diff --git a/.idea/shelf/Uncommitted_changes_before_Checkout_at_09_01_2024_17_27_[Changes]1/Transition.class b/.idea/shelf/Uncommitted_changes_before_Checkout_at_09_01_2024_17_27_[Changes]1/Transition.class
new file mode 100644
index 0000000..55ad5d1
Binary files /dev/null and b/.idea/shelf/Uncommitted_changes_before_Checkout_at_09_01_2024_17_27_[Changes]1/Transition.class differ
diff --git a/.idea/shelf/Uncommitted_changes_before_Checkout_at_09_01_2024_17_27_[Changes]1/shelved.patch b/.idea/shelf/Uncommitted_changes_before_Checkout_at_09_01_2024_17_27_[Changes]1/shelved.patch
new file mode 100644
index 0000000..9a01a2b
--- /dev/null
+++ b/.idea/shelf/Uncommitted_changes_before_Checkout_at_09_01_2024_17_27_[Changes]1/shelved.patch
@@ -0,0 +1,386 @@
+Index: src/main/java/ab1/impl/GRUPPE/NFAImpl.java
+IDEA additional info:
+Subsystem: com.intellij.openapi.diff.impl.patch.BaseRevisionTextPatchEP
+<+>package ab1.impl.GRUPPE;\r\n\r\nimport ab1.FinalizedStateException;\r\nimport ab1.NFA;\r\nimport ab1.Transition;\r\n\r\nimport java.util.*;\r\n\r\npublic class NFAImpl implements NFA {\r\n private final Set states;\r\n private final Set transitions;\r\n\r\n private final String initialState;\r\n private final Set acceptingStates;\r\n\r\n private Set alphabet;\r\n\r\n private Set completeAlphabet;\r\n private boolean isFinalized;\r\n\r\n public NFAImpl(String startState) {\r\n this.initialState = startState;\r\n this.states = new HashSet<>();\r\n this.states.add(startState);\r\n this.transitions = new HashSet<>();\r\n this.acceptingStates = new HashSet<>();\r\n this.alphabet = new HashSet<>();\r\n this.completeAlphabet = new HashSet<>();\r\n for(int i='a';i<='z';i++){\r\n completeAlphabet.add((char)i);\r\n }\r\n this.isFinalized = false;\r\n\r\n }\r\n\r\n @Override\r\n public Set getStates() {\r\n return this.states;\r\n }\r\n\r\n /*\r\n public void safeAddStates(Set states, Set toCheck, NFAImpl nfa) {\r\n for (String state : states) {\r\n nfa.states.add(changeIfNecessary(state, toCheck));\r\n }\r\n }\r\n */\r\n\r\n @Override\r\n public Collection getTransitions() {\r\n return this.transitions;\r\n }\r\n\r\n @Override\r\n public Set getAcceptingStates() {\r\n return this.acceptingStates;\r\n }\r\n\r\n @Override\r\n public String getInitialState() {\r\n return this.initialState;\r\n }\r\n\r\n public Set getAlphabet() {\r\n return this.alphabet;\r\n }\r\n\r\n @Override\r\n public void addTransition(Transition transition) throws FinalizedStateException {\r\n if (this.isFinalized) {\r\n throw new FinalizedStateException();\r\n }\r\n if (!states.contains(transition.fromState())) {\r\n this.states.add(transition.fromState());\r\n }\r\n if (!states.contains(transition.toState())) {\r\n this.states.add(transition.toState());\r\n }\r\n // add symbol to alphabet. If it is already in the alphabet, nothing happens\r\n if (transition.readSymbol() != null) {\r\n this.alphabet.add(transition.readSymbol());\r\n }\r\n this.transitions.add(transition);\r\n }\r\n\r\n public void addAllTransitions(Set transitions) throws FinalizedStateException {\r\n if (this.isFinalized) {\r\n throw new FinalizedStateException();\r\n }\r\n for (Transition transition : transitions) {\r\n this.addTransition(transition);\r\n }\r\n }\r\n\r\n @Override\r\n public void addAcceptingState(String state) throws FinalizedStateException {\r\n if (this.isFinalized) {\r\n throw new FinalizedStateException();\r\n }\r\n this.states.add(state);\r\n this.acceptingStates.add(state);\r\n }\r\n\r\n public void addAllAcceptingStates(Set states) throws FinalizedStateException {\r\n if (this.isFinalized) {\r\n throw new FinalizedStateException();\r\n }\r\n for (String state : states) {\r\n this.addAcceptingState(state);\r\n }\r\n }\r\n\r\n public void safeAddAcceptingStates(Set states, Set toCheck, NFAImpl nfa) {\r\n for (String state : states) {\r\n nfa.addAcceptingState(changeIfNecessary(state, toCheck));\r\n }\r\n }\r\n\r\n // #TODO\r\n // write more testcases\r\n @Override\r\n public NFA union(NFA other) throws FinalizedStateException {\r\n if (!this.isFinalized || !other.isFinalized()) {\r\n throw new FinalizedStateException();\r\n }\r\n // new initialState with epsilon to initialState of this and other.\r\n // Problem: what if states are called the same in this and other + what do we use as initialState?\r\n NFAImpl unionNFA = new NFAImpl(this.getInitialState());\r\n\r\n unionNFA.states.addAll(this.states);\r\n\r\n unionNFA.addAllAcceptingStates(this.acceptingStates);\r\n\r\n Set otherAcceptingStates = new HashSet<>(other.getAcceptingStates());\r\n unionNFA.safeAddAcceptingStates(this.acceptingStates, otherAcceptingStates, unionNFA);\r\n\r\n\r\n Set newTransitions = new HashSet<>();\r\n for (Transition transition : other.getTransitions()) {\r\n Transition newTransition =\r\n new Transition(transition.fromState(), transition.readSymbol(), transition.toState());\r\n newTransitions.add(newTransition);\r\n }\r\n String flag = \"\";\r\n newTransitions.add(new Transition(flag, null, other.getInitialState()));\r\n\r\n for (String state : other.getStates()) {\r\n if (!unionNFA.states.contains(state)) {\r\n unionNFA.states.add(state);\r\n if (other.getAcceptingStates().contains(state)) {\r\n unionNFA.acceptingStates.add(state);\r\n }\r\n } else {\r\n // a state of other has the same name as one in this.\r\n // change name of state and every Transition it is a part of in other\r\n String newState = changeIfNecessary(state, unionNFA.states);\r\n\r\n // wieder a neues set\r\n Set tempTransitions = new HashSet<>();\r\n\r\n // check each transition of other if start or to state was state\r\n for (Transition transition : newTransitions) {\r\n if (transition.fromState().equals(state)) {\r\n transition = new Transition(newState, transition.readSymbol(), transition.toState());\r\n }\r\n if (transition.toState().equals(state)) {\r\n transition = new Transition(transition.fromState(), transition.readSymbol(), newState);\r\n }\r\n tempTransitions.add(transition);\r\n }\r\n for (String accState : other.getAcceptingStates()) {\r\n if (accState.equals(state)) {\r\n unionNFA.acceptingStates.add(newState);\r\n }\r\n }\r\n newTransitions = tempTransitions; // Replace the original set with the updated set\r\n }\r\n }\r\n // add, alphabet\r\n\r\n Iterator iterator = newTransitions.iterator();\r\n while (iterator.hasNext()){\r\n Transition transition = iterator.next();\r\n if(transition.fromState().isEmpty()){\r\n iterator.remove();\r\n\r\n newTransitions.add(new Transition(unionNFA.initialState, transition.readSymbol(), transition.toState()));\r\n break;\r\n }\r\n }\r\n\r\n unionNFA.addAllTransitions(newTransitions);\r\n\r\n unionNFA.addAllTransitions(this.transitions);\r\n\r\n unionNFA.finalizeAutomaton();\r\n\r\n\r\n return unionNFA;\r\n }\r\n\r\n // #TODO\r\n // needs to work with a DFA not NFA\r\n @Override\r\n public NFA intersection(NFA other) throws FinalizedStateException {\r\n if (!this.isFinalized || !other.isFinalized()) {\r\n throw new FinalizedStateException();\r\n }\r\n NFAImpl intersectionNFA = new NFAImpl(this.initialState);\r\n\r\n intersectionNFA.states.addAll(this.states);\r\n intersectionNFA.states.retainAll(other.getStates());\r\n\r\n intersectionNFA.transitions.addAll(this.transitions);\r\n intersectionNFA.transitions.retainAll(other.getTransitions());\r\n\r\n return intersectionNFA;\r\n }\r\n\r\n @Override\r\n public NFA concatenation(NFA other) throws FinalizedStateException {\r\n if (!this.isFinalized || !other.isFinalized()) {\r\n throw new FinalizedStateException();\r\n }\r\n\r\n NFAImpl concatenationNFA = new NFAImpl(this.initialState);\r\n\r\n // Add states from 'this'\r\n concatenationNFA.states.addAll(this.states);\r\n\r\n // Add states from 'other', with renaming if necessary\r\n Map renamedStates = new HashMap<>();\r\n for (String state : other.getStates()) {\r\n String newState = changeIfNecessary(state, concatenationNFA.states);\r\n renamedStates.put(state, newState); // Old state name -> New state name\r\n concatenationNFA.states.add(newState);\r\n }\r\n\r\n // Add transitions from 'this'\r\n concatenationNFA.transitions.addAll(this.transitions);\r\n\r\n // Add transitions from 'other', updating state names\r\n for (Transition transition : other.getTransitions()) {\r\n String newFromState = renamedStates.getOrDefault(transition.fromState(), transition.fromState());\r\n String newToState = renamedStates.getOrDefault(transition.toState(), transition.toState());\r\n Transition newTransition = new Transition(newFromState, transition.readSymbol(), newToState);\r\n concatenationNFA.transitions.add(newTransition);\r\n }\r\n\r\n // Connect accepting states of 'this' to the initial state of 'other' with epsilon transitions\r\n String newOtherInitialState = renamedStates.getOrDefault(other.getInitialState(), other.getInitialState());\r\n for (String acceptingState : this.acceptingStates) {\r\n Transition epsilon = new Transition(acceptingState, null, newOtherInitialState);\r\n concatenationNFA.transitions.add(epsilon);\r\n }\r\n\r\n // Set accepting states of the concatenated NFA to be the accepting states of 'other'\r\n concatenationNFA.acceptingStates.clear();\r\n for (String acceptingState : other.getAcceptingStates()) {\r\n concatenationNFA.acceptingStates.add(renamedStates.getOrDefault(acceptingState, acceptingState));\r\n }\r\n\r\n concatenationNFA.finalizeAutomaton();\r\n\r\n return concatenationNFA;\r\n }\r\n\r\n\r\n @Override\r\n public NFA kleeneStar() throws FinalizedStateException {\r\n if (!this.isFinalized) {\r\n throw new FinalizedStateException();\r\n }\r\n\r\n NFAImpl nfa = new NFAImpl(this.initialState);\r\n\r\n // copy, but without accepting states\r\n nfa.states.addAll(this.states);\r\n nfa.addAllTransitions(this.transitions);\r\n\r\n // adding the initial state as accepting state because we have to accept the empty string\r\n nfa.acceptingStates.add(this.initialState);\r\n\r\n // for each accepting state\r\n for (String acceptingState : this.getAcceptingStates()) {\r\n Transition loopBackTransition =\r\n // creating an epsilon transition (null) for each accepting state\r\n new Transition(acceptingState, null, this.initialState);\r\n nfa.transitions.add(loopBackTransition);\r\n }\r\n\r\n nfa.finalizeAutomaton();\r\n\r\n return nfa;\r\n }\r\n\r\n @Override\r\n public NFA plusOperator() throws FinalizedStateException {\r\n if (!this.isFinalized) {\r\n throw new FinalizedStateException();\r\n }\r\n\r\n String newInitialState = \"newSTART\";\r\n NFAImpl nfa = new NFAImpl(newInitialState);\r\n\r\n // simple copy\r\n nfa.states.addAll(this.states);\r\n nfa.transitions.addAll(this.transitions);\r\n nfa.acceptingStates.addAll(this.acceptingStates);\r\n\r\n nfa.transitions.add(new Transition(newInitialState, null, this.initialState));\r\n\r\n\r\n for (String acceptingState : this.acceptingStates) {\r\n nfa.transitions.add(new Transition(acceptingState, null, newInitialState));\r\n }\r\n\r\n /*\r\n // for each accepting state\r\n for (String acceptingState : this.acceptingStates) {\r\n Transition loopBackTransition =\r\n // creating an epsilon transition (null) for each accepting state\r\n new Transition(acceptingState, null, this.initialState);\r\n if (!nfa.transitions.contains(loopBackTransition)) {\r\n nfa.transitions.add(loopBackTransition);\r\n }\r\n }\r\n */\r\n\r\n nfa.finalizeAutomaton();\r\n\r\n return nfa;\r\n }\r\n\r\n // #TODO\r\n @Override\r\n public NFA complement() throws FinalizedStateException {\r\n if (!this.isFinalized) {\r\n throw new FinalizedStateException();\r\n }\r\n\r\n // create a copy of this NFA\r\n NFAImpl nfa = new NFAImpl(this.initialState);\r\n nfa.states.addAll(this.states);\r\n nfa.addAllTransitions(this.transitions);\r\n nfa.addAllAcceptingStates(this.acceptingStates);\r\n\r\n nfaAddTrap(nfa);\r\n\r\n NFAImpl fakeNFA = convertNFAtoDFA(nfa);\r\n\r\n // state -> accepting\r\n // accepting -> state\r\n\r\n Set newAcceptingState = new HashSet<>();\r\n\r\n for (String state : fakeNFA.getStates()) {\r\n if (!fakeNFA.getAcceptingStates().contains(state)) {\r\n newAcceptingState.add(state);\r\n }\r\n }\r\n fakeNFA.acceptingStates.clear();\r\n fakeNFA.addAllAcceptingStates(newAcceptingState);\r\n\r\n Set originalAlphabet = new HashSet<>(fakeNFA.alphabet);\r\n\r\n fakeNFA.alphabet.clear();\r\n\r\n Set newAlphabet = new HashSet<>();\r\n\r\n for (char ch = 'a'; ch <= 'z'; ch++) {\r\n if (!originalAlphabet.contains(ch)) {\r\n newAlphabet.add(ch);\r\n }\r\n }\r\n\r\n for (Transition transition : fakeNFA.transitions) {\r\n for (Character letter : newAlphabet) {\r\n fakeNFA.addTransition(new Transition(transition.fromState(), letter, transition.toState()));\r\n }\r\n }\r\n\r\n fakeNFA.alphabet = newAlphabet;\r\n\r\n fakeNFA.finalizeAutomaton();\r\n\r\n return fakeNFA;\r\n }\r\n\r\n @Override\r\n public boolean isFinalized() {\r\n return isFinalized;\r\n }\r\n\r\n @Override\r\n public void finalizeAutomaton() {\r\n this.isFinalized = true;\r\n }\r\n\r\n // #TODO\r\n @Override\r\n public boolean isFinite() {\r\n //transitions={fromState==toState}\r\n //states={A,B,C,D,E,F,G,H,I,J,K,L,M,N,O,P,Q,R,S,T,U,V,W,X,Y,Z}\r\n //obergrenze = anzahl der states (26)\r\n return false;\r\n }\r\n\r\n // #TODO\r\n @Override\r\n public boolean acceptsWord(String word) throws FinalizedStateException {\r\n if (!this.isFinalized) {\r\n throw new FinalizedStateException();\r\n }\r\n\r\n char[] wordArray = word.toCharArray();\r\n\r\n Set currentStates = new HashSet<>();\r\n currentStates.add(this.initialState);\r\n currentStates = (epsilonClosure(currentStates, this));\r\n\r\n for (char letter : wordArray) {\r\n // schritt a\r\n currentStates = getStateAfterTransition(currentStates, letter, this);\r\n // schritt b\r\n currentStates = epsilonClosure(currentStates, this);\r\n }\r\n\r\n\r\n\r\n return isAcceptingState(currentStates, this);\r\n }\r\n\r\n public NFAImpl convertNFAtoDFA(NFAImpl input) {\r\n\r\n // all accepting states of the DFA\r\n Set dfaAcceptingStates = new HashSet<>();\r\n // all states of the DFA\r\n List> dfaStates = new ArrayList<>();\r\n // all transitions of the DFA\r\n Set dfaTransitions = new HashSet<>();\r\n\r\n // all states of the NFA\r\n Set startState = new HashSet<>();\r\n startState.add(input.getInitialState());\r\n\r\n // getting the epsilon closure of the start state\r\n startState = epsilonClosure(startState, input);\r\n dfaStates.add(startState);\r\n if (isAcceptingState(startState, input)) {\r\n dfaAcceptingStates.add(getIndexOfSet(startState, dfaStates));\r\n }\r\n\r\n // do the above with each DFA state\r\n Queue> queue = new LinkedList<>();\r\n queue.add(startState);\r\n // iterate each Letter\r\n while (!queue.isEmpty()) {\r\n Set currentState = queue.poll();\r\n // for each possible Letter\r\n for (char letter : input.getAlphabet()) {\r\n // get the new state after the transition\r\n Set newState = epsilonClosure(getStateAfterTransition(currentState, letter, input), input);\r\n if (!dfaStates.contains(newState)) {\r\n queue.add(newState);\r\n dfaStates.add(newState);\r\n if (isAcceptingState(newState, input)) {\r\n dfaAcceptingStates.add(getIndexOfSet(newState, dfaStates));\r\n }\r\n\r\n }\r\n\r\n // build new Transition\r\n dfaTransitions.add(new Transition(getIndexOfSet(currentState, dfaStates), letter, getIndexOfSet(newState, dfaStates)));\r\n }\r\n }\r\n\r\n NFAImpl newDFA = new NFAImpl(\"0\");\r\n\r\n for (int i = 0; i < dfaStates.size(); i++) {\r\n newDFA.states.add(\"\" + i);\r\n }\r\n\r\n newDFA.addAllTransitions(dfaTransitions);\r\n newDFA.addAllAcceptingStates(dfaAcceptingStates);\r\n\r\n return newDFA;\r\n }\r\n\r\n private Set epsilonClosure(Set states, NFA nfa) {\r\n Set closure = new HashSet<>(states);\r\n Stack stack = new Stack<>();\r\n stack.addAll(states);\r\n while (!stack.isEmpty()) {\r\n String state = stack.pop();\r\n for (Transition transition : nfa.getTransitions()) {\r\n if (transition.fromState().equals(state) && transition.readSymbol() == null) {\r\n if (closure.add(transition.toState())) {\r\n stack.push(transition.toState());\r\n }\r\n }\r\n }\r\n }\r\n return closure;\r\n }\r\n\r\n private Set getStateAfterTransition(Set states, char symbol, NFA nfa) {\r\n Set result = new HashSet<>();\r\n for (String state : states) {\r\n for (Transition transition : nfa.getTransitions()) {\r\n if (transition.fromState().equals(state) && transition.readSymbol() != null && transition.readSymbol() == symbol) {\r\n result.add(transition.toState());\r\n }\r\n }\r\n }\r\n return result;\r\n }\r\n\r\n private boolean isAcceptingState(Set states, NFA input) {\r\n for (String accState : input.getAcceptingStates()) {\r\n if (states.contains(accState)) {\r\n return true;\r\n }\r\n }\r\n return false;\r\n }\r\n\r\n private String getIndexOfSet(Set set, List> dfaStates) {\r\n return Integer.toString(dfaStates.indexOf(set));\r\n }\r\n\r\n private String changeIfNecessary(String str, Set toCheck) {\r\n while (toCheck.contains(str)) {\r\n str = str + \"1\";\r\n }\r\n return str;\r\n }\r\n\r\n private void nfaAddTrap(NFAImpl input){\r\n String trap = changeIfNecessary(\"TRAP\", input.getStates());\r\n input.states.add(trap);\r\n Set newTransitions = new HashSet<>();\r\n for(String state : input.getStates()){\r\n for(char letter : completeAlphabet){\r\n boolean hasTransition = false;\r\n for(Transition transition : input.getTransitions()){\r\n if(transition.fromState().equals(state)&&transition.readSymbol().equals(letter)){\r\n hasTransition = true;\r\n break;\r\n }\r\n }\r\n if(!hasTransition){\r\n newTransitions.add(new Transition(state, letter, trap));\r\n }\r\n }\r\n }\r\n input.addAllTransitions(newTransitions); //input.transitions.addAll(newTransitions);\r\n }\r\n\r\n}\r\n
+Subsystem: com.intellij.openapi.diff.impl.patch.CharsetEP
+<+>UTF-8
+===================================================================
+diff --git a/src/main/java/ab1/impl/GRUPPE/NFAImpl.java b/src/main/java/ab1/impl/GRUPPE/NFAImpl.java
+--- a/src/main/java/ab1/impl/GRUPPE/NFAImpl.java
++++ b/src/main/java/ab1/impl/GRUPPE/NFAImpl.java
+@@ -206,15 +206,11 @@
+ if (!this.isFinalized || !other.isFinalized()) {
+ throw new FinalizedStateException();
+ }
+- NFAImpl intersectionNFA = new NFAImpl(this.initialState);
+-
+- intersectionNFA.states.addAll(this.states);
+- intersectionNFA.states.retainAll(other.getStates());
+-
+- intersectionNFA.transitions.addAll(this.transitions);
+- intersectionNFA.transitions.retainAll(other.getTransitions());
+-
+- return intersectionNFA;
++ NFA newFNA_A = this.complement();
++ NFA newNFA_B = other.complement();
++ NFA unionNFA = newFNA_A.union(newNFA_B);
++ NFA result = unionNFA.complement();
++ return result;
+ }
+
+ @Override
+@@ -345,7 +341,7 @@
+ nfa.addAllTransitions(this.transitions);
+ nfa.addAllAcceptingStates(this.acceptingStates);
+
+- nfaAddTrap(nfa);
++ nfaAddTrap(nfa); //error on last occasion
+
+ NFAImpl fakeNFA = convertNFAtoDFA(nfa);
+
+@@ -555,6 +551,9 @@
+ }
+ }
+ input.addAllTransitions(newTransitions); //input.transitions.addAll(newTransitions);
++ for(char letter : completeAlphabet){
++ input.getAlphabet().add(letter);
++ }
+ }
+
+ }
+Index: .idea/workspace.xml
+IDEA additional info:
+Subsystem: com.intellij.openapi.diff.impl.patch.BaseRevisionTextPatchEP
+<+>\r\n\r\n \r\n \r\n \r\n \r\n
\r\n
\r\n \r\n \r\n \r\n \r\n \r\n \r\n \r\n \r\n \r\n \r\n \r\n \r\n \r\n {\r\n "lastFilter": {\r\n "state": "OPENED",\r\n "assignee": {\r\n "type": "org.jetbrains.plugins.gitlab.mergerequest.ui.filters.GitLabMergeRequestsFiltersValue.MergeRequestsMemberFilterValue.MergeRequestsAssigneeFilterValue",\r\n "username": "rawalcher",\r\n "fullname": "rawalcher"\r\n }\r\n }\r\n} \r\n {\r\n "selectedUrlAndAccountId": {\r\n "first": "https://git-ainf.aau.at/rawalcher/theorethische-informatik-gruppe-10.git",\r\n "second": "2afc8825-f511-4d8a-8cc1-901875567c84"\r\n }\r\n} \r\n \r\n \r\n \r\n {\r\n "associatedIndex": 2\r\n} \r\n \r\n \r\n \r\n \r\n \r\n {\r\n "keyToString": {\r\n "RunOnceActivity.OpenProjectViewOnStart": "true",\r\n "RunOnceActivity.ShowReadmeOnStart": "true",\r\n "WebServerToolWindowFactoryState": "false",\r\n "full.screen.before.presentation.mode": "false",\r\n "git-widget-placeholder": "5-top-skill-issue-raphael",\r\n "ignore.virus.scanning.warn.message": "true",\r\n "node.js.detected.package.eslint": "true",\r\n "node.js.detected.package.tslint": "true",\r\n "node.js.selected.package.eslint": "(autodetect)",\r\n "node.js.selected.package.tslint": "(autodetect)",\r\n "nodejs_package_manager_path": "npm",\r\n "project.structure.last.edited": "Project",\r\n "project.structure.proportion": "0.0",\r\n "project.structure.side.proportion": "0.0",\r\n "settings.editor.selected.configurable": "preferences.lookFeel",\r\n "vue.rearranger.settings.migration": "true"\r\n }\r\n} \r\n \r\n \r\n \r\n \r\n \r\n \r\n \r\n \r\n \r\n \r\n \r\n \r\n \r\n \r\n \r\n \r\n \r\n \r\n \r\n \r\n \r\n \r\n \r\n \r\n \r\n \r\n \r\n \r\n \r\n \r\n \r\n \r\n \r\n \r\n \r\n \r\n \r\n \r\n \r\n \r\n \r\n \r\n \r\n \r\n \r\n \r\n \r\n \r\n \r\n \r\n \r\n \r\n \r\n \r\n \r\n \r\n \r\n \r\n \r\n \r\n \r\n \r\n \r\n \r\n \r\n \r\n \r\n \r\n \r\n \r\n \r\n \r\n \r\n \r\n \r\n \r\n \r\n \r\n \r\n \r\n \r\n \r\n \r\n \r\n \r\n \r\n \r\n \r\n \r\n \r\n \r\n
\r\n \r\n \r\n \r\n \r\n \r\n \r\n \r\n \r\n \r\n \r\n \r\n \r\n \r\n 1704700820495 \r\n \r\n \r\n 1704700820495 \r\n \r\n \r\n \r\n \r\n \r\n \r\n \r\n 1704734947115 \r\n \r\n \r\n \r\n 1704734947115 \r\n \r\n \r\n \r\n 1704749802065 \r\n \r\n \r\n \r\n 1704749802065 \r\n \r\n \r\n \r\n 1704749806556 \r\n \r\n \r\n \r\n 1704749806556 \r\n \r\n \r\n \r\n 1704749811525 \r\n \r\n \r\n \r\n 1704749811525 \r\n \r\n \r\n \r\n 1704750289780 \r\n \r\n \r\n \r\n 1704750289780 \r\n \r\n \r\n \r\n 1704752332678 \r\n \r\n \r\n \r\n 1704752332678 \r\n \r\n \r\n \r\n 1704752420737 \r\n \r\n \r\n \r\n 1704752420737 \r\n \r\n \r\n \r\n \r\n \r\n \r\n \r\n \r\n \r\n \r\n \r\n \r\n \r\n \r\n \r\n \r\n \r\n \r\n \r\n file://$PROJECT_DIR$/src/test/java/ab1/tests/ComplexTests.java \r\n 15 \r\n \r\n \r\n \r\n \r\n \r\n \r\n \r\n \r\n \r\n \r\n
+Subsystem: com.intellij.openapi.diff.impl.patch.CharsetEP
+<+>UTF-8
+===================================================================
+diff --git a/.idea/workspace.xml b/.idea/workspace.xml
+--- a/.idea/workspace.xml
++++ b/.idea/workspace.xml
+@@ -4,8 +4,18 @@
+
+
+
+-
++
++
++
++
++
++
++
++
++
++
+
++
+
+
+
+@@ -46,28 +56,33 @@
+
+
+
+- {
+- "keyToString": {
+- "RunOnceActivity.OpenProjectViewOnStart": "true",
+- "RunOnceActivity.ShowReadmeOnStart": "true",
+- "WebServerToolWindowFactoryState": "false",
+- "full.screen.before.presentation.mode": "false",
+- "git-widget-placeholder": "5-top-skill-issue-raphael",
+- "ignore.virus.scanning.warn.message": "true",
+- "node.js.detected.package.eslint": "true",
+- "node.js.detected.package.tslint": "true",
+- "node.js.selected.package.eslint": "(autodetect)",
+- "node.js.selected.package.tslint": "(autodetect)",
+- "nodejs_package_manager_path": "npm",
+- "project.structure.last.edited": "Project",
+- "project.structure.proportion": "0.0",
+- "project.structure.side.proportion": "0.0",
+- "settings.editor.selected.configurable": "preferences.lookFeel",
+- "vue.rearranger.settings.migration": "true"
++
+-
+-
++}]]>
++
++
+
+
+
+@@ -77,14 +92,12 @@
+
+
+
+-
+-
+-
++
+
+
+
+
+-
++
+
+
+
+@@ -94,14 +107,14 @@
+
+
+
+-
++
+
+
+
+
+
+
+-
++
+
+
+
+@@ -111,16 +124,24 @@
+
+
+
+-
++
+
+
+
+
+
+-
++
+
+-
+-
++
++
++
++
++
++
++
++
++
++
+
+
+
+@@ -152,8 +173,8 @@
+
+
+
+-
+-
++
++
+
+
+
+@@ -163,6 +184,7 @@
+
+
+
++
+
+
+
+@@ -178,7 +200,7 @@
+
+
+
+-
++
+
+
+
+@@ -188,67 +210,27 @@
+
+ 1704734947115
+
+-
+-
+- 1704749802065
+-
+-
+-
+- 1704749802065
+-
+-
+-
+- 1704749806556
+-
+-
+-
+- 1704749806556
+-
+-
+-
+- 1704749811525
+-
+-
+-
+- 1704749811525
+-
+-
+-
+- 1704750289780
+-
+-
+-
+- 1704750289780
+-
+-
+-
+- 1704752332678
+-
+-
+-
+- 1704752332678
+-
+-
+-
+- 1704752420737
+-
+-
+-
+- 1704752420737
+-
+-
++
+
+
+
+
++
++
++
++
++
++
++
++
++
++
++
+
+
+
+
+-
+-
+-
+-
++
+
+
+
+@@ -257,6 +239,31 @@
+ file://$PROJECT_DIR$/src/test/java/ab1/tests/ComplexTests.java
+ 15
+
++
++
++ file://$PROJECT_DIR$/src/main/java/ab1/impl/GRUPPE/NFAImpl.java
++ 472
++
++
++
++ file://$PROJECT_DIR$/src/test/java/ab1/tests/ComplexTests.java
++ 31
++
++
++
++ file://$PROJECT_DIR$/src/test/java/ab1/tests/ComplexTests.java
++ 120
++
++
++
++ file://$PROJECT_DIR$/src/main/java/ab1/impl/GRUPPE/NFAImpl.java
++ 211
++
++
++
++ file://$PROJECT_DIR$/src/main/java/ab1/impl/GRUPPE/NFAImpl.java
++ 338
++
+
+
+
+Index: .idea/jarRepositories.xml
+IDEA additional info:
+Subsystem: com.intellij.openapi.diff.impl.patch.BaseRevisionTextPatchEP
+<+>\r\n\r\n \r\n \r\n \r\n \r\n \r\n \r\n \r\n \r\n \r\n \r\n \r\n \r\n \r\n \r\n \r\n \r\n \r\n \r\n \r\n \r\n \r\n \r\n
+Subsystem: com.intellij.openapi.diff.impl.patch.CharsetEP
+<+>UTF-8
+===================================================================
+diff --git a/.idea/jarRepositories.xml b/.idea/jarRepositories.xml
+--- a/.idea/jarRepositories.xml
++++ b/.idea/jarRepositories.xml
+@@ -7,6 +7,11 @@
+
+
+
++
++
++
++
++
+
+
+
+Index: .idea/misc.xml
+IDEA additional info:
+Subsystem: com.intellij.openapi.diff.impl.patch.BaseRevisionTextPatchEP
+<+>\r\n\r\n \r\n \r\n \r\n \r\n \r\n
\r\n \r\n \r\n \r\n \r\n \r\n \r\n \r\n \r\n
+Subsystem: com.intellij.openapi.diff.impl.patch.CharsetEP
+<+>UTF-8
+===================================================================
+diff --git a/.idea/misc.xml b/.idea/misc.xml
+--- a/.idea/misc.xml
++++ b/.idea/misc.xml
+@@ -7,11 +7,12 @@
+
+
+
++
+
+
+
+
+-
++
+
+
+
+\ No newline at end of file
diff --git a/.idea/shelf/Uncommitted_changes_before_Checkout_at_09_01_2024_17_27__Changes_.xml b/.idea/shelf/Uncommitted_changes_before_Checkout_at_09_01_2024_17_27__Changes_.xml
new file mode 100644
index 0000000..aa7df08
--- /dev/null
+++ b/.idea/shelf/Uncommitted_changes_before_Checkout_at_09_01_2024_17_27__Changes_.xml
@@ -0,0 +1,4 @@
+
+
+
+
\ No newline at end of file
diff --git a/.idea/shelf/Uncommitted_changes_before_Checkout_at_09_01_2024_17_27__Changes_1.xml b/.idea/shelf/Uncommitted_changes_before_Checkout_at_09_01_2024_17_27__Changes_1.xml
new file mode 100644
index 0000000..d830bbc
--- /dev/null
+++ b/.idea/shelf/Uncommitted_changes_before_Checkout_at_09_01_2024_17_27__Changes_1.xml
@@ -0,0 +1,24 @@
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
\ No newline at end of file
diff --git a/.idea/shelf/Uncommitted_changes_before_Update_at_10_01_2024_21_36_[Changes]/NFAFactoryImpl.class b/.idea/shelf/Uncommitted_changes_before_Update_at_10_01_2024_21_36_[Changes]/NFAFactoryImpl.class
new file mode 100644
index 0000000..d84a881
Binary files /dev/null and b/.idea/shelf/Uncommitted_changes_before_Update_at_10_01_2024_21_36_[Changes]/NFAFactoryImpl.class differ
diff --git a/.idea/shelf/Uncommitted_changes_before_Update_at_10_01_2024_21_36_[Changes]/shelved.patch b/.idea/shelf/Uncommitted_changes_before_Update_at_10_01_2024_21_36_[Changes]/shelved.patch
new file mode 100644
index 0000000..e69de29
diff --git a/.idea/shelf/Uncommitted_changes_before_Update_at_10_01_2024_21_36__Changes_.xml b/.idea/shelf/Uncommitted_changes_before_Update_at_10_01_2024_21_36__Changes_.xml
new file mode 100644
index 0000000..809dfef
--- /dev/null
+++ b/.idea/shelf/Uncommitted_changes_before_Update_at_10_01_2024_21_36__Changes_.xml
@@ -0,0 +1,9 @@
+
+
+
+
+
+
+
+
+
\ No newline at end of file
diff --git a/target/classes/ab1/impl/GRUPPE/NFAImpl.class b/target/classes/ab1/impl/GRUPPE/NFAImpl.class
new file mode 100644
index 0000000..b34c871
Binary files /dev/null and b/target/classes/ab1/impl/GRUPPE/NFAImpl.class differ
diff --git a/target/classes/ab1/impl/GRUPPE/Tuple.class b/target/classes/ab1/impl/GRUPPE/Tuple.class
new file mode 100644
index 0000000..cc75c29
Binary files /dev/null and b/target/classes/ab1/impl/GRUPPE/Tuple.class differ
diff --git a/target/test-classes/ab1/tests/myTests.class b/target/test-classes/ab1/tests/myTests.class
new file mode 100644
index 0000000..9928e25
Binary files /dev/null and b/target/test-classes/ab1/tests/myTests.class differ