-
Notifications
You must be signed in to change notification settings - Fork 0
Expand file tree
/
Copy pathDFAtest.java
More file actions
25 lines (19 loc) · 719 Bytes
/
DFAtest.java
File metadata and controls
25 lines (19 loc) · 719 Bytes
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
import java.util.ArrayList;
import java.util.Arrays;
import java.util.HashSet;
public class DFAtest {
public static void main(String[] args) {
// TODO Auto-generated method stub
String startState = "a";
String acceptState = "c";
HashSet<String> setOfStates = new HashSet<String>(Arrays.asList("a", "b", "c"));
ArrayList<String[]> transition = new ArrayList<>();
transition.add(new String[] { "a", "0", "b" });
transition.add(new String[] { "b", "1", "c" });
transition.add(new String[] { "c", "0", "c" });
transition.add(new String[] { "c", "1", "c" });
String input = "01.0111";
DFA myDFA = new DFA(setOfStates, startState, acceptState, transition);
System.out.println(myDFA.run(input));
}
}