just some fancy shit added

This commit is contained in:
Ghost_Element 2024-01-10 15:49:49 +01:00
parent b6ab5bdf72
commit c81659c1f9
3 changed files with 22 additions and 16 deletions

21
.idea/workspace.xml generated
View file

@ -4,10 +4,10 @@
<option name="autoReloadType" value="SELECTIVE" /> <option name="autoReloadType" value="SELECTIVE" />
</component> </component>
<component name="ChangeListManager"> <component name="ChangeListManager">
<list default="true" id="f5e08808-a5af-4c89-a1ee-21b3bcb9ae3e" name="Changes" comment="isFinite methode recursiv..."> <list default="true" id="f5e08808-a5af-4c89-a1ee-21b3bcb9ae3e" name="Changes" comment="guess what works now, fker:)">
<change beforePath="$PROJECT_DIR$/.idea/workspace.xml" beforeDir="false" afterPath="$PROJECT_DIR$/.idea/workspace.xml" afterDir="false" /> <change beforePath="$PROJECT_DIR$/.idea/workspace.xml" beforeDir="false" afterPath="$PROJECT_DIR$/.idea/workspace.xml" afterDir="false" />
<change beforePath="$PROJECT_DIR$/src/main/java/ab1/impl/GRUPPE/NFAFactoryImpl.java" beforeDir="false" afterPath="$PROJECT_DIR$/src/main/java/ab1/impl/GRUPPE/NFAFactoryImpl.java" afterDir="false" />
<change beforePath="$PROJECT_DIR$/src/main/java/ab1/impl/GRUPPE/NFAImpl.java" beforeDir="false" afterPath="$PROJECT_DIR$/src/main/java/ab1/impl/GRUPPE/NFAImpl.java" afterDir="false" /> <change beforePath="$PROJECT_DIR$/src/main/java/ab1/impl/GRUPPE/NFAImpl.java" beforeDir="false" afterPath="$PROJECT_DIR$/src/main/java/ab1/impl/GRUPPE/NFAImpl.java" afterDir="false" />
<change beforePath="$PROJECT_DIR$/src/main/java/ab1/impl/GRUPPE/Tuple.java" beforeDir="false" afterPath="$PROJECT_DIR$/src/main/java/ab1/impl/GRUPPE/Tuple.java" afterDir="false" />
</list> </list>
<list id="39d4ccb3-eae9-4ed4-996a-5a13f44678fa" name="Changes by carol" comment="" /> <list id="39d4ccb3-eae9-4ed4-996a-5a13f44678fa" name="Changes by carol" comment="" />
<option name="SHOW_DIALOG" value="false" /> <option name="SHOW_DIALOG" value="false" />
@ -276,7 +276,15 @@
<option name="project" value="LOCAL" /> <option name="project" value="LOCAL" />
<updated>1704888180655</updated> <updated>1704888180655</updated>
</task> </task>
<option name="localTasksCounter" value="10" /> <task id="LOCAL-00010" summary="guess what works now, fker:)">
<option name="closed" value="true" />
<created>1704896842030</created>
<option name="number" value="00010" />
<option name="presentableId" value="LOCAL-00010" />
<option name="project" value="LOCAL" />
<updated>1704896842030</updated>
</task>
<option name="localTasksCounter" value="11" />
<servers /> <servers />
</component> </component>
<component name="TypeScriptGeneratedFilesManager"> <component name="TypeScriptGeneratedFilesManager">
@ -301,19 +309,20 @@
<MESSAGE value="concat GEHT" /> <MESSAGE value="concat GEHT" />
<MESSAGE value="changed nfaAddTrap, bei dem Fall, dass Transition.readSymbol() einen nullwert zurückgibt. (Thx ChatGBT)&#10;-&gt; intersectionTests funktionieren" /> <MESSAGE value="changed nfaAddTrap, bei dem Fall, dass Transition.readSymbol() einen nullwert zurückgibt. (Thx ChatGBT)&#10;-&gt; intersectionTests funktionieren" />
<MESSAGE value="isFinite methode recursiv..." /> <MESSAGE value="isFinite methode recursiv..." />
<option name="LAST_COMMIT_MESSAGE" value="isFinite methode recursiv..." /> <MESSAGE value="guess what works now, fker:)" />
<option name="LAST_COMMIT_MESSAGE" value="guess what works now, fker:)" />
</component> </component>
<component name="XDebuggerManager"> <component name="XDebuggerManager">
<breakpoint-manager> <breakpoint-manager>
<breakpoints> <breakpoints>
<line-breakpoint enabled="true" type="java-line"> <line-breakpoint enabled="true" type="java-line">
<url>file://$PROJECT_DIR$/src/main/java/ab1/impl/GRUPPE/NFAImpl.java</url> <url>file://$PROJECT_DIR$/src/main/java/ab1/impl/GRUPPE/NFAImpl.java</url>
<line>344</line> <line>343</line>
<option name="timeStamp" value="44" /> <option name="timeStamp" value="44" />
</line-breakpoint> </line-breakpoint>
<line-breakpoint enabled="true" type="java-line"> <line-breakpoint enabled="true" type="java-line">
<url>file://$PROJECT_DIR$/src/main/java/ab1/impl/GRUPPE/NFAImpl.java</url> <url>file://$PROJECT_DIR$/src/main/java/ab1/impl/GRUPPE/NFAImpl.java</url>
<line>356</line> <line>355</line>
<option name="timeStamp" value="53" /> <option name="timeStamp" value="53" />
</line-breakpoint> </line-breakpoint>
<line-breakpoint enabled="true" type="java-line"> <line-breakpoint enabled="true" type="java-line">

View file

@ -6,8 +6,6 @@ import ab1.NFAFactory;
public class NFAFactoryImpl implements NFAFactory { public class NFAFactoryImpl implements NFAFactory {
@Override @Override
public NFA buildNFA(String startState) { public NFA buildNFA(String startState) {
NFA nfa = new NFAImpl(startState); return new NFAImpl(startState);
return nfa;
} }
} }

View file

@ -16,7 +16,7 @@ public class NFAImpl implements NFA {
private Set<Character> alphabet; private Set<Character> alphabet;
private Set<Character> completeAlphabet; private final Set<Character> completeAlphabet;
private boolean isFinalized; private boolean isFinalized;
public NFAImpl(String startState) { public NFAImpl(String startState) {
@ -210,8 +210,7 @@ public class NFAImpl implements NFA {
NFA newNFA_A = this.complement(); NFA newNFA_A = this.complement();
NFA newNFA_B = other.complement(); NFA newNFA_B = other.complement();
NFA unionNFA = newNFA_A.union(newNFA_B); NFA unionNFA = newNFA_A.union(newNFA_B);
NFA result = unionNFA.complement(); return unionNFA.complement();
return result;
} }
@Override @Override
@ -447,7 +446,7 @@ public class NFAImpl implements NFA {
// need newLetter // need newLetter
for(int i=letters.indexOf(readSymbol)+1;i<letters.size();i++){ for(int i=letters.indexOf(readSymbol)+1;i<letters.size();i++){
Character newLetter = letters.get(i); Character newLetter = letters.get(i);
String newState = checkForNewLetter(path, transitions, letters, newLetter); String newState = checkForNewLetter(path, transitions, newLetter);
//more than 1 transition for new letter? //more than 1 transition for new letter?
if(newState!=null){ if(newState!=null){
//check given state //check given state
@ -483,10 +482,10 @@ public class NFAImpl implements NFA {
/** /**
* !Does not check the new state added * !Does not check the new state added
* @return state if a tostate for the newletter is found and deletes the old Tuple * @return -state if a tostate for the newletter is found and deletes the old Tuple
* @return null if with the newletter there is no transition further * -null if with the newletter there is no transition further
*/ */
private String checkForNewLetter(List<Tuple> path, List<Transition> transitions, List<Character> letters, Character letter){ private String checkForNewLetter(List<Tuple> path, List<Transition> transitions, Character letter){
String fromState = path.get(path.size()-2).getElement_2(); String fromState = path.get(path.size()-2).getElement_2();
for(Transition transition : transitions){ for(Transition transition : transitions){
if (transition.fromState().equals(fromState) && transition.readSymbol().equals(letter)) { if (transition.fromState().equals(fromState) && transition.readSymbol().equals(letter)) {