Skip to content

Commit

Permalink
refactor: replace BufferedReader input handling with Keyboard utility…
Browse files Browse the repository at this point in the history
… in notADFA exception class
  • Loading branch information
Tony0380 committed Nov 2, 2024
1 parent 4a6dd8c commit 0ff5fdf
Showing 1 changed file with 2 additions and 10 deletions.
12 changes: 2 additions & 10 deletions app/src/main/java/computability/calculation/exception/notADFA.java
Original file line number Diff line number Diff line change
@@ -1,9 +1,7 @@
package computability.calculation.exception;

import java.io.BufferedReader;
import java.io.InputStreamReader;

import computability.calculation.model.DFA;
import computability.controller.Keyboard;

public class notADFA extends Exception {
public notADFA(String message) {
Expand All @@ -26,13 +24,7 @@ public DFA FixDFA(DFA dfa) {
System.out.println("Transiction 1: " + dfa.getTransictions().get(i));
System.out.println("Transiction 2: " + dfa.getTransictions().get(j));
System.out.print("Choice: ");
Integer choice = 1;
try {
BufferedReader reader = new BufferedReader(new InputStreamReader(System.in));
choice = Integer.parseInt(reader.readLine());
} catch (Exception e) {
System.out.println("An error occurred. Please try again.");
}
int choice = Keyboard.readInt();

do {
if(choice == 1) {
Expand Down

0 comments on commit 0ff5fdf

Please sign in to comment.