private static void TWDFAFunction(string inputString) { Timer.Start(); FiniteAutomata automata1 = TWDFABuilder3(); ConsoleOperations.WriteBMarkReset("2DFA Creation"); ConsoleOperations.WriteTitle("2DFA Info"); ConsoleOperations.WriteAutomataInfo(automata1); Timer.Restart(); FiniteAutomataConverter dfaConverter1 = new FiniteAutomataConverter(); FiniteAutomata resultX = dfaConverter1.Convert2DFAToDFA(automata1); ConsoleOperations.WriteBMarkReset("Automata Conversion"); Console.WriteLine("\n>>>2DFA is converted to DFA<<<\n"); ConsoleOperations.WriteTitle("DFA Info"); ConsoleOperations.WriteAutomataInfo(resultX); ConsoleOperations.WriteTitle("DFA Trace"); Timer.Restart(); bool result = resultX.Run(inputString); ConsoleOperations.WriteBMarkReset("DFA Run"); Timer.Stop(); ConsoleOperations.WriteTitle("Automata Results"); Console.WriteLine("DFA Response: Input is " + (result ? "Accepted" : "Rejected")); ConsoleOperations.WriteTitle("Benchmark Results"); BenchmarkResults.ForEach(x => Console.WriteLine(x)); }
private static void NFAFunction(string inputString) { Timer.Start(); FiniteAutomata automata = NFABuilder(); ConsoleOperations.WriteBMarkReset("NFA Creation"); ConsoleOperations.WriteTitle("NFA Info"); ConsoleOperations.WriteAutomataInfo(automata); ConsoleOperations.WriteTitle("NFA Trace"); Timer.Restart(); bool result = automata.Run(inputString); ConsoleOperations.WriteBMarkReset("NFA Run"); Timer.Restart(); FiniteAutomataConverter dfaConverter = new FiniteAutomataConverter(); FiniteAutomata DFAVersion = dfaConverter.ConvertNFAToDFA(automata); ConsoleOperations.WriteBMarkReset("Automata Conversion"); Console.WriteLine("\n>>>NFA is converted to DFA<<<\n"); ConsoleOperations.WriteTitle("DFA Info"); ConsoleOperations.WriteAutomataInfo(DFAVersion); ConsoleOperations.WriteTitle("DFA Trace"); Timer.Restart(); bool resultDFA = DFAVersion.Run(inputString); ConsoleOperations.WriteBMarkReset("DFA Run"); Timer.Stop(); ConsoleOperations.WriteTitle("Automata Results"); Console.WriteLine("NFA Response: Input is " + (result ? "Accepted" : "Rejected")); Console.WriteLine("DFA Response: Input is " + (resultDFA ? "Accepted" : "Rejected")); ConsoleOperations.WriteTitle("Benchmark Results"); BenchmarkResults.ForEach(x => Console.WriteLine(x)); }