hope this works...
This commit is contained in:
parent
ac579644f5
commit
8a6ea12b68
8 changed files with 262 additions and 77 deletions
1
.idea/compiler.xml
generated
1
.idea/compiler.xml
generated
|
|
@ -2,6 +2,7 @@
|
|||
<project version="4">
|
||||
<component name="CompilerConfiguration">
|
||||
<annotationProcessing>
|
||||
<profile default="true" name="Default" enabled="true" />
|
||||
<profile name="Maven default annotation processors profile" enabled="true">
|
||||
<sourceOutputDir name="target/generated-sources/annotations" />
|
||||
<sourceTestOutputDir name="target/generated-test-sources/test-annotations" />
|
||||
|
|
|
|||
9
.idea/jarRepositories.xml
generated
9
.idea/jarRepositories.xml
generated
|
|
@ -3,8 +3,13 @@
|
|||
<component name="RemoteRepositoriesConfiguration">
|
||||
<remote-repository>
|
||||
<option name="id" value="central" />
|
||||
<option name="name" value="Central Repository" />
|
||||
<option name="url" value="https://repo.maven.apache.org/maven2" />
|
||||
<option name="name" value="libs-release" />
|
||||
<option name="url" value="${env.ARTIFACTORY_URL}/maven" />
|
||||
</remote-repository>
|
||||
<remote-repository>
|
||||
<option name="id" value="snapshots" />
|
||||
<option name="name" value="libs-snapshot" />
|
||||
<option name="url" value="${env.ARTIFACTORY_URL}/maven" />
|
||||
</remote-repository>
|
||||
<remote-repository>
|
||||
<option name="id" value="central" />
|
||||
|
|
|
|||
4
.idea/misc.xml
generated
4
.idea/misc.xml
generated
|
|
@ -8,5 +8,7 @@
|
|||
</list>
|
||||
</option>
|
||||
</component>
|
||||
<component name="ProjectRootManager" version="2" languageLevel="JDK_19" default="true" project-jdk-name="openjdk-19" project-jdk-type="JavaSDK" />
|
||||
<component name="ProjectRootManager" version="2" languageLevel="JDK_21" default="true" project-jdk-name="openjdk-21" project-jdk-type="JavaSDK">
|
||||
<output url="file://$PROJECT_DIR$/out" />
|
||||
</component>
|
||||
</project>
|
||||
22
.idea/shelf/Uncommitted_changes_before_Update_at_08_01_2024_12_06_[Changes]/shelved.patch
generated
Normal file
22
.idea/shelf/Uncommitted_changes_before_Update_at_08_01_2024_12_06_[Changes]/shelved.patch
generated
Normal file
|
|
@ -0,0 +1,22 @@
|
|||
Index: .idea/jarRepositories.xml
|
||||
IDEA additional info:
|
||||
Subsystem: com.intellij.openapi.diff.impl.patch.BaseRevisionTextPatchEP
|
||||
<+><?xml version=\"1.0\" encoding=\"UTF-8\"?>\r\n<project version=\"4\">\r\n <component name=\"RemoteRepositoriesConfiguration\">\r\n <remote-repository>\r\n <option name=\"id\" value=\"central\" />\r\n <option name=\"name\" value=\"libs-release\" />\r\n <option name=\"url\" value=\"${env.ARTIFACTORY_URL}/maven\" />\r\n </remote-repository>\r\n <remote-repository>\r\n <option name=\"id\" value=\"snapshots\" />\r\n <option name=\"name\" value=\"libs-snapshot\" />\r\n <option name=\"url\" value=\"${env.ARTIFACTORY_URL}/maven\" />\r\n </remote-repository>\r\n <remote-repository>\r\n <option name=\"id\" value=\"central\" />\r\n <option name=\"name\" value=\"Maven Central repository\" />\r\n <option name=\"url\" value=\"https://repo1.maven.org/maven2\" />\r\n </remote-repository>\r\n <remote-repository>\r\n <option name=\"id\" value=\"jboss.community\" />\r\n <option name=\"name\" value=\"JBoss Community repository\" />\r\n <option name=\"url\" value=\"https://repository.jboss.org/nexus/content/repositories/public/\" />\r\n </remote-repository>\r\n </component>\r\n</project>
|
||||
Subsystem: com.intellij.openapi.diff.impl.patch.CharsetEP
|
||||
<+>UTF-8
|
||||
===================================================================
|
||||
diff --git a/.idea/jarRepositories.xml b/.idea/jarRepositories.xml
|
||||
--- a/.idea/jarRepositories.xml (revision b2f6932eae27588a4b5ad8e1bb1f83f2a533182a)
|
||||
+++ b/.idea/jarRepositories.xml (date 1704711982177)
|
||||
@@ -7,6 +7,11 @@
|
||||
<option name="url" value="${env.ARTIFACTORY_URL}/maven" />
|
||||
</remote-repository>
|
||||
<remote-repository>
|
||||
+ <option name="id" value="central" />
|
||||
+ <option name="name" value="Central Repository" />
|
||||
+ <option name="url" value="https://repo.maven.apache.org/maven2" />
|
||||
+ </remote-repository>
|
||||
+ <remote-repository>
|
||||
<option name="id" value="snapshots" />
|
||||
<option name="name" value="libs-snapshot" />
|
||||
<option name="url" value="${env.ARTIFACTORY_URL}/maven" />
|
||||
4
.idea/shelf/Uncommitted_changes_before_Update_at_08_01_2024_12_06__Changes_.xml
generated
Normal file
4
.idea/shelf/Uncommitted_changes_before_Update_at_08_01_2024_12_06__Changes_.xml
generated
Normal file
|
|
@ -0,0 +1,4 @@
|
|||
<changelist name="Uncommitted_changes_before_Update_at_08_01_2024_12_06_[Changes]" date="1704712018273" recycled="true" deleted="true">
|
||||
<option name="PATH" value="$PROJECT_DIR$/.idea/shelf/Uncommitted_changes_before_Update_at_08_01_2024_12_06_[Changes]/shelved.patch" />
|
||||
<option name="DESCRIPTION" value="Uncommitted changes before Update at 08/01/2024 12:06 [Changes]" />
|
||||
</changelist>
|
||||
165
.idea/workspace.xml
generated
Normal file
165
.idea/workspace.xml
generated
Normal file
|
|
@ -0,0 +1,165 @@
|
|||
<?xml version="1.0" encoding="UTF-8"?>
|
||||
<project version="4">
|
||||
<component name="AutoImportSettings">
|
||||
<option name="autoReloadType" value="SELECTIVE" />
|
||||
</component>
|
||||
<component name="ChangeListManager">
|
||||
<list default="true" id="f5e08808-a5af-4c89-a1ee-21b3bcb9ae3e" name="Changes" comment="">
|
||||
<change beforePath="$PROJECT_DIR$/.idea/compiler.xml" beforeDir="false" afterPath="$PROJECT_DIR$/.idea/compiler.xml" afterDir="false" />
|
||||
<change beforePath="$PROJECT_DIR$/.idea/jarRepositories.xml" beforeDir="false" afterPath="$PROJECT_DIR$/.idea/jarRepositories.xml" afterDir="false" />
|
||||
<change beforePath="$PROJECT_DIR$/.idea/misc.xml" beforeDir="false" afterPath="$PROJECT_DIR$/.idea/misc.xml" 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" />
|
||||
</list>
|
||||
<list id="2bf04d9d-9125-4ed6-9018-847e14e9822c" name="Changes by danie" comment="">
|
||||
<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" />
|
||||
</list>
|
||||
<option name="SHOW_DIALOG" value="false" />
|
||||
<option name="HIGHLIGHT_CONFLICTS" value="true" />
|
||||
<option name="HIGHLIGHT_NON_ACTIVE_CHANGELIST" value="false" />
|
||||
<option name="LAST_RESOLUTION" value="IGNORE" />
|
||||
</component>
|
||||
<component name="Git.Settings">
|
||||
<option name="RECENT_BRANCH_BY_REPOSITORY">
|
||||
<map>
|
||||
<entry key="$PROJECT_DIR$" value="main" />
|
||||
</map>
|
||||
</option>
|
||||
<option name="RECENT_GIT_ROOT_PATH" value="$PROJECT_DIR$" />
|
||||
</component>
|
||||
<component name="GitLabMergeRequestFiltersHistory">{
|
||||
"lastFilter": {
|
||||
"state": "OPENED",
|
||||
"assignee": {
|
||||
"type": "org.jetbrains.plugins.gitlab.mergerequest.ui.filters.GitLabMergeRequestsFiltersValue.MergeRequestsMemberFilterValue.MergeRequestsAssigneeFilterValue",
|
||||
"username": "rawalcher",
|
||||
"fullname": "rawalcher"
|
||||
}
|
||||
}
|
||||
}</component>
|
||||
<component name="GitLabMergeRequestsSettings">{
|
||||
"selectedUrlAndAccountId": {
|
||||
"first": "https://git-ainf.aau.at/rawalcher/theorethische-informatik-gruppe-10.git",
|
||||
"second": "e0c4ebfe-e254-4a34-93d3-a6ee2cb18f94"
|
||||
}
|
||||
}</component>
|
||||
<component name="LineStatusTrackerManager">
|
||||
<file path="$PROJECT_DIR$/src/main/java/ab1/impl/GRUPPE/NFAImpl.java">
|
||||
<ranges>
|
||||
<range start1="9" end1="9" start2="9" end2="10" changelist="f5e08808-a5af-4c89-a1ee-21b3bcb9ae3e" />
|
||||
<range start1="37" end1="37" start2="38" end2="39" changelist="f5e08808-a5af-4c89-a1ee-21b3bcb9ae3e" />
|
||||
<range start1="56" end1="61" start2="58" end2="68" changelist="f5e08808-a5af-4c89-a1ee-21b3bcb9ae3e" />
|
||||
<range start1="62" end1="62" start2="69" end2="78" changelist="f5e08808-a5af-4c89-a1ee-21b3bcb9ae3e" />
|
||||
<range start1="67" end1="71" start2="83" end2="86" changelist="f5e08808-a5af-4c89-a1ee-21b3bcb9ae3e" />
|
||||
<range start1="72" end1="72" start2="87" end2="96" changelist="f5e08808-a5af-4c89-a1ee-21b3bcb9ae3e" />
|
||||
<range start1="76" end1="77" start2="100" end2="101" changelist="f5e08808-a5af-4c89-a1ee-21b3bcb9ae3e" />
|
||||
<range start1="94" end1="95" start2="118" end2="119" changelist="f5e08808-a5af-4c89-a1ee-21b3bcb9ae3e" />
|
||||
<range start1="111" end1="112" start2="135" end2="136" changelist="f5e08808-a5af-4c89-a1ee-21b3bcb9ae3e" />
|
||||
<range start1="122" end1="123" start2="146" end2="147" changelist="f5e08808-a5af-4c89-a1ee-21b3bcb9ae3e" />
|
||||
<range start1="187" end1="188" start2="211" end2="212" changelist="f5e08808-a5af-4c89-a1ee-21b3bcb9ae3e" />
|
||||
<range start1="230" end1="231" start2="254" end2="255" changelist="f5e08808-a5af-4c89-a1ee-21b3bcb9ae3e" />
|
||||
<range start1="242" end1="242" start2="266" end2="267" changelist="f5e08808-a5af-4c89-a1ee-21b3bcb9ae3e" />
|
||||
<range start1="254" end1="273" start2="279" end2="282" changelist="f5e08808-a5af-4c89-a1ee-21b3bcb9ae3e" />
|
||||
<range start1="278" end1="279" start2="287" end2="288" changelist="f5e08808-a5af-4c89-a1ee-21b3bcb9ae3e" />
|
||||
<range start1="287" end1="288" start2="296" end2="300" changelist="f5e08808-a5af-4c89-a1ee-21b3bcb9ae3e" />
|
||||
<range start1="290" end1="291" start2="302" end2="303" changelist="2bf04d9d-9125-4ed6-9018-847e14e9822c" />
|
||||
<range start1="292" end1="293" start2="304" end2="305" changelist="f5e08808-a5af-4c89-a1ee-21b3bcb9ae3e" />
|
||||
<range start1="297" end1="310" start2="309" end2="313" changelist="f5e08808-a5af-4c89-a1ee-21b3bcb9ae3e" />
|
||||
<range start1="312" end1="313" start2="315" end2="317" changelist="f5e08808-a5af-4c89-a1ee-21b3bcb9ae3e" />
|
||||
<range start1="314" end1="317" start2="318" end2="321" changelist="f5e08808-a5af-4c89-a1ee-21b3bcb9ae3e" />
|
||||
<range start1="377" end1="388" start2="381" end2="388" changelist="f5e08808-a5af-4c89-a1ee-21b3bcb9ae3e" />
|
||||
<range start1="389" end1="389" start2="389" end2="393" changelist="2bf04d9d-9125-4ed6-9018-847e14e9822c" />
|
||||
<range start1="390" end1="404" start2="394" end2="394" changelist="f5e08808-a5af-4c89-a1ee-21b3bcb9ae3e" />
|
||||
</ranges>
|
||||
</file>
|
||||
</component>
|
||||
<component name="MarkdownSettingsMigration">
|
||||
<option name="stateVersion" value="1" />
|
||||
</component>
|
||||
<component name="ProjectColorInfo">{
|
||||
"associatedIndex": 2
|
||||
}</component>
|
||||
<component name="ProjectId" id="2afDcX9p9UZiDe6ife9RGZcJjKQ" />
|
||||
<component name="ProjectViewState">
|
||||
<option name="hideEmptyMiddlePackages" value="true" />
|
||||
<option name="showLibraryContents" value="true" />
|
||||
</component>
|
||||
<component name="PropertiesComponent">{
|
||||
"keyToString": {
|
||||
"RunOnceActivity.OpenProjectViewOnStart": "true",
|
||||
"RunOnceActivity.ShowReadmeOnStart": "true",
|
||||
"WebServerToolWindowFactoryState": "false",
|
||||
"git-widget-placeholder": "main",
|
||||
"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.pluginManager",
|
||||
"vue.rearranger.settings.migration": "true"
|
||||
}
|
||||
}</component>
|
||||
<component name="RunManager">
|
||||
<configuration name="ab1.tests in ETI_Abgabe" type="JUnit" factoryName="JUnit" temporary="true" nameIsGenerated="true">
|
||||
<module name="ETI_Abgabe" />
|
||||
<extension name="coverage">
|
||||
<pattern>
|
||||
<option name="PATTERN" value="ab1.tests.*" />
|
||||
<option name="ENABLED" value="true" />
|
||||
</pattern>
|
||||
</extension>
|
||||
<option name="PACKAGE_NAME" value="ab1.tests" />
|
||||
<option name="TEST_OBJECT" value="package" />
|
||||
<method v="2">
|
||||
<option name="Make" enabled="true" />
|
||||
</method>
|
||||
</configuration>
|
||||
<configuration default="true" type="JetRunConfigurationType">
|
||||
<method v="2">
|
||||
<option name="Make" enabled="true" />
|
||||
</method>
|
||||
</configuration>
|
||||
<configuration default="true" type="KotlinStandaloneScriptRunConfigurationType">
|
||||
<option name="filePath" />
|
||||
<method v="2">
|
||||
<option name="Make" enabled="true" />
|
||||
</method>
|
||||
</configuration>
|
||||
<recent_temporary>
|
||||
<list>
|
||||
<item itemvalue="JUnit.ab1.tests in ETI_Abgabe" />
|
||||
</list>
|
||||
</recent_temporary>
|
||||
</component>
|
||||
<component name="SpellCheckerSettings" RuntimeDictionaries="0" Folders="0" CustomDictionaries="0" DefaultDictionary="application-level" UseSingleDictionary="true" transferred="true" />
|
||||
<component name="TaskManager">
|
||||
<task active="true" id="Default" summary="Default task">
|
||||
<changelist id="f5e08808-a5af-4c89-a1ee-21b3bcb9ae3e" name="Changes" comment="" />
|
||||
<created>1704700820495</created>
|
||||
<option name="number" value="Default" />
|
||||
<option name="presentableId" value="Default" />
|
||||
<updated>1704700820495</updated>
|
||||
<workItem from="1704700821945" duration="5461000" />
|
||||
<workItem from="1704712375384" duration="4940000" />
|
||||
<workItem from="1704717343016" duration="2934000" />
|
||||
</task>
|
||||
<servers />
|
||||
</component>
|
||||
<component name="TypeScriptGeneratedFilesManager">
|
||||
<option name="version" value="3" />
|
||||
</component>
|
||||
<component name="XDebuggerManager">
|
||||
<breakpoint-manager>
|
||||
<breakpoints>
|
||||
<line-breakpoint enabled="true" type="java-line">
|
||||
<url>file://$PROJECT_DIR$/src/test/java/ab1/tests/ComplexTests.java</url>
|
||||
<line>171</line>
|
||||
<option name="timeStamp" value="1" />
|
||||
</line-breakpoint>
|
||||
</breakpoints>
|
||||
</breakpoint-manager>
|
||||
</component>
|
||||
</project>
|
||||
|
|
@ -7,6 +7,7 @@ import ab1.Transition;
|
|||
import lombok.Getter;
|
||||
|
||||
import java.util.*;
|
||||
import java.util.stream.Collectors;
|
||||
|
||||
public class NFAImpl implements NFA {
|
||||
private Set<String> states;
|
||||
|
|
@ -35,6 +36,7 @@ public class NFAImpl implements NFA {
|
|||
public Set<String> getStates() {
|
||||
return this.states;
|
||||
}
|
||||
|
||||
@Override
|
||||
public Collection<Transition> getTransitions() {
|
||||
return this.transitions;
|
||||
|
|
@ -54,21 +56,43 @@ public class NFAImpl implements NFA {
|
|||
public void addTransition(Transition transition) throws FinalizedStateException {
|
||||
if (this.isFinalized) {
|
||||
throw new FinalizedStateException();
|
||||
} else if (!this.transitions.contains(transition)) {
|
||||
}
|
||||
if (!states.contains(transition.fromState())) {
|
||||
this.states.add(transition.fromState());
|
||||
}
|
||||
if (!states.contains(transition.toState())) {
|
||||
this.states.add(transition.toState());
|
||||
}
|
||||
// add symbol to alphabet. If it is already in the alphabet, nothing happens
|
||||
this.alphabet.add(transition.readSymbol());
|
||||
this.transitions.add(transition);
|
||||
}
|
||||
|
||||
public void addAllTransition(Set<Transition> transitions) throws FinalizedStateException {
|
||||
if(this.isFinalized){
|
||||
throw new FinalizedStateException();
|
||||
}
|
||||
for (Transition transition : transitions) {
|
||||
this.addTransition(transition);
|
||||
}
|
||||
}
|
||||
|
||||
@Override
|
||||
public void addAcceptingState(String state) throws FinalizedStateException {
|
||||
if (this.isFinalized) {
|
||||
throw new FinalizedStateException();
|
||||
} else if (!this.states.contains(state)) {
|
||||
}
|
||||
this.states.add(state);
|
||||
this.acceptingStates.add(state);
|
||||
}
|
||||
|
||||
public void addAllAcceptingStates(Set<String> states) throws FinalizedStateException {
|
||||
if(this.isFinalized){
|
||||
throw new FinalizedStateException();
|
||||
}
|
||||
for (String state : states) {
|
||||
this.addAcceptingState(state);
|
||||
}
|
||||
}
|
||||
|
||||
// #TODO
|
||||
|
|
@ -240,6 +264,7 @@ public class NFAImpl implements NFA {
|
|||
|
||||
*/
|
||||
|
||||
Set<String> dfaAcceptingStates = new HashSet<>();
|
||||
// all states of the DFA
|
||||
List<Set<String>> dfaStates = new ArrayList<>();
|
||||
// all transitions of the DFA
|
||||
|
|
@ -252,25 +277,9 @@ public class NFAImpl implements NFA {
|
|||
// getting the epsilon closure of the start state
|
||||
startState = epsilonClosure(startState, input);
|
||||
dfaStates.add(startState);
|
||||
|
||||
// find all letters in transitions
|
||||
// obsolete, added alphabet to NFA which stores all read symbols
|
||||
/*
|
||||
Set<Character> possibleLetters = new HashSet<>();
|
||||
Set<Transition> possibleTransitions = new HashSet<>();
|
||||
for(Transition transition : input.transitions){
|
||||
for(String state : states) {
|
||||
if (state.equals(transition.fromState())){
|
||||
|
||||
if(transition.readSymbol() != null){
|
||||
possibleLetters.add(transition.readSymbol());
|
||||
possibleTransitions.add(transition);
|
||||
if (isAcceptingState(startState, input)){
|
||||
dfaAcceptingStates.add(getIndexOfSet(startState, dfaStates));
|
||||
}
|
||||
break;
|
||||
}
|
||||
}
|
||||
}
|
||||
*/
|
||||
|
||||
// do the above with each DFA state
|
||||
Queue<Set<String>> queue = new LinkedList<>();
|
||||
|
|
@ -285,36 +294,31 @@ public class NFAImpl implements NFA {
|
|||
if (!dfaStates.contains(newState)) {
|
||||
queue.add(newState);
|
||||
dfaStates.add(newState);
|
||||
// build new Transition
|
||||
if (isAcceptingState(newState, input)) {
|
||||
dfaAcceptingStates.add(getIndexOfSet(newState, dfaStates));
|
||||
}
|
||||
|
||||
}
|
||||
// build new Transition
|
||||
dfaTransitions.add(new Transition(Integer.toString(dfaStates.indexOf(currentState)), letter, Integer.toString(dfaStates.indexOf(newState))));
|
||||
|
||||
// we gotta change this to only a string is given
|
||||
// we got to change this to only a string is given
|
||||
//dfaTransitions.add(new Transition(currentState, letter, newState));
|
||||
}
|
||||
}
|
||||
|
||||
/*
|
||||
for(Character letter : possibleLetters){
|
||||
Set<String> newState = new HashSet<>();
|
||||
for(Transition trans : possibleTransitions){
|
||||
if(trans.readSymbol().equals(letter)){
|
||||
// is every transition fromState = state from states? Hoffentlich ja :')
|
||||
newState.add(trans.toState());
|
||||
}
|
||||
}
|
||||
//deal with newState + new Transitions
|
||||
if(DFA_states.contains(newState)){
|
||||
Transition newtrans = new Transition(DFA_states.get(index), letter, DFA_states.get(DFA_states.indexOf(newState)));
|
||||
}
|
||||
NFAImpl newDFA = new NFAImpl("0");
|
||||
|
||||
for(int i=1;i<dfaStates.size();i++){
|
||||
newDFA.states.add(""+i);
|
||||
}
|
||||
|
||||
*/
|
||||
newDFA.addAllTransition(dfaTransitions);
|
||||
newDFA.addAllAcceptingStates(dfaAcceptingStates);
|
||||
|
||||
// what we gonna do now?
|
||||
return null;
|
||||
// return new DFA(dfaStates, dfaTransitions, startState, determineAcceptingStates(dfaStates, input));
|
||||
newDFA.finalizeAutomaton();
|
||||
|
||||
return newDFA;
|
||||
}
|
||||
|
||||
private Set<String> epsilonClosure(Set<String> states, NFA nfa) {
|
||||
|
|
@ -375,31 +379,13 @@ public class NFAImpl implements NFA {
|
|||
return result;
|
||||
}
|
||||
|
||||
private Set<Set<String>> determineAcceptingStates(Set<Set<String>> dfaStates, NFA nfa) {
|
||||
Set<Set<String>> acceptingStates = new HashSet<>();
|
||||
for (Set<String> dfaState : dfaStates) {
|
||||
for (String nfaState : dfaState) {
|
||||
if (nfa.getAcceptingStates().contains(nfaState)) {
|
||||
acceptingStates.add(dfaState);
|
||||
break;
|
||||
private boolean isAcceptingState(Set<String> states, NFA input) {
|
||||
for (String accState : input.getAcceptingStates()) {
|
||||
if (states.contains(accState)) {
|
||||
return true;
|
||||
}
|
||||
}
|
||||
}
|
||||
return acceptingStates;
|
||||
return false;
|
||||
}
|
||||
|
||||
public void test(){
|
||||
final NFAFactory factory = new NFAFactoryImpl();
|
||||
var instance = factory.buildNFA("START");
|
||||
instance.addTransition(
|
||||
Transition.builder()
|
||||
.fromState("START")
|
||||
.readSymbol('a')
|
||||
.toState("ACCEPT")
|
||||
.build()
|
||||
);
|
||||
instance.addAcceptingState("ACCEPT");
|
||||
instance.finalizeAutomaton();
|
||||
|
||||
}
|
||||
}
|
||||
|
|
|
|||
Binary file not shown.
Reference in a new issue