Skip to content

Commit

Permalink
checkstyle fixes
Browse files Browse the repository at this point in the history
  • Loading branch information
yeozongyao committed Mar 19, 2024
1 parent cd11661 commit 0c33860
Showing 1 changed file with 27 additions and 27 deletions.
54 changes: 27 additions & 27 deletions src/main/java/seedu/bookbuddy/Parser.java
Original file line number Diff line number Diff line change
Expand Up @@ -29,33 +29,33 @@ public static void parseCommand( String input, BookList books) {
int index;
try {
switch (command) {
case ADD_COMMAND:
if (inputArray.length < 2) {
throw new InvalidCommandArgumentException("The add command requires a book title.");
}
books.addBook(inputArray[1]);
break;
case REMOVE_COMMAND:
index = Integer.parseInt(inputArray[1]);
books.deleteBook(index);
break;
case LIST_COMMAND:
books.printAllBooks();
break;
case MARK_COMMAND:
index = Integer.parseInt(inputArray[1]);
books.markDoneByIndex(index);
break;
case UNMARK_COMMAND:
index = Integer.parseInt(inputArray[1]);
books.markUndoneByIndex(index);
break;
case EXIT_COMMAND:
BookBuddy.printExitMessage();
System.exit(0);
break;
default:
throw new UnsupportedCommandException("Sorry but that is not a valid command. Please try again");
case ADD_COMMAND:
if (inputArray.length < 2) {
throw new InvalidCommandArgumentException("The add command requires a book title.");
}
books.addBook(inputArray[1]);
break;
case REMOVE_COMMAND:
index = Integer.parseInt(inputArray[1]);
books.deleteBook(index);
break;
case LIST_COMMAND:
books.printAllBooks();
break;
case MARK_COMMAND:
index = Integer.parseInt(inputArray[1]);
books.markDoneByIndex(index);
break;
case UNMARK_COMMAND:
index = Integer.parseInt(inputArray[1]);
books.markUndoneByIndex(index);
break;
case EXIT_COMMAND:
BookBuddy.printExitMessage();
System.exit(0);
break;
default:
throw new UnsupportedCommandException("Sorry but that is not a valid command. Please try again");
}
} catch (NumberFormatException e) {
throw new InvalidBookIndexException("Book index must be an integer.");
Expand Down

0 comments on commit 0c33860

Please sign in to comment.