Skip to content

Commit

Permalink
Update to conform coding standards
Browse files Browse the repository at this point in the history
  • Loading branch information
woodenclock committed Oct 16, 2023
1 parent 7b23c41 commit 6bd0efe
Show file tree
Hide file tree
Showing 3 changed files with 12 additions and 5 deletions.
6 changes: 3 additions & 3 deletions src/main/java/seedu/wildwatch/command/AddCommand.java
Original file line number Diff line number Diff line change
Expand Up @@ -20,9 +20,9 @@ public class AddCommand extends Command {
+ "(?: R/(?<remark>[^/]+))?");

public static void addEntry(String inputBuffer, boolean isFromFile) throws IncorrectInputException {
// if (!isFromFile) {
// Ui.listMessagePrinter();
// }
//if (!isFromFile) {
// Ui.listMessagePrinter();
//}

final Matcher matcher = ADD_ENTRY_COMMAND_FORMAT.matcher(inputBuffer);
if (!matcher.matches()) {
Expand Down
1 change: 0 additions & 1 deletion src/main/java/seedu/wildwatch/entry/EntryList.java
Original file line number Diff line number Diff line change
@@ -1,7 +1,6 @@
package seedu.wildwatch.entry;

import java.time.LocalDate;
import java.time.format.DateTimeFormatter;
import java.util.ArrayList;

public class EntryList {
Expand Down
10 changes: 9 additions & 1 deletion src/main/java/seedu/wildwatch/operation/Parser.java
Original file line number Diff line number Diff line change
@@ -1,7 +1,8 @@
package seedu.wildwatch.operation;

import java.util.Scanner;

import java.util.logging.Level;
import java.util.logging.Logger;
import seedu.wildwatch.command.HelpCommand;
import seedu.wildwatch.command.ListCommand;
import seedu.wildwatch.command.DeleteCommand;
Expand All @@ -12,11 +13,15 @@

public class Parser {
private static final int DEFAULT_NUMBER_INPUT = -3710; //Number that can never be input in normal use of WildWatch
private static final Logger LOGGER = Logger.getLogger(Parser.class.getName());

public static void manualInputHandler() {
while (true) {
String inputBuffer = Ui.inputRetriever(); //Retrieves input of user
LOGGER.log(Level.INFO, "Input received: {0}", inputBuffer);

if (inputBuffer.equals("bye")) { //Program exit
LOGGER.log(Level.INFO, "Exiting program on user command.");
break;
} else if (inputBuffer.equals("help")) { //User request "help"
Ui.printHorizontalLines();
Expand All @@ -29,11 +34,13 @@ public static void manualInputHandler() {
Ui.printHorizontalLines();
}
}
LOGGER.log(Level.INFO, "Initiating shutdown procedures.");
ShutDown.shutDown();
}

public static void entryManager(String inputBuffer, boolean isFromFile)
throws UnknownInputException, IncorrectInputException {
LOGGER.log(Level.INFO, "Managing entry for input: {0}", inputBuffer);
Scanner bufferScanner = new Scanner(inputBuffer); //Scanner for the buffer
String firstWord = bufferScanner.next(); //Stores first word in the input
assert firstWord != null && !firstWord.isEmpty() : "First word shouldn't be null or empty";
Expand All @@ -53,6 +60,7 @@ public static void entryManager(String inputBuffer, boolean isFromFile)
} else if (inputBuffer.equals("list")) {
ListCommand.listEntry(isFromFile);
} else {
LOGGER.log(Level.WARNING, "Unknown input received: {0}. Throwing exception.", inputBuffer);
throw new UnknownInputException(); //Unrecognizable by Parser
}
}
Expand Down

0 comments on commit 6bd0efe

Please sign in to comment.