diff --git a/src/main/java/duke/logic/CommandParser.java b/src/main/java/duke/logic/CommandParser.java index d823523e1f..993a858d06 100644 --- a/src/main/java/duke/logic/CommandParser.java +++ b/src/main/java/duke/logic/CommandParser.java @@ -17,11 +17,9 @@ public class CommandParser { private static final String EMPTY_INPUT_MESSAGE = "Input is empty. Type \"help\" for more information."; private static final String TOO_LITTLE_ARGUMENTS_MESSAGE = "Too little arguments. Type \"help\" " + "followed by the command for more information."; - private static final String FULL_TASKLIST_MESSAGE = "Unable to add task. List is full. Consider deleting" - + " some tasks"; private static final String INVALID_NUMBER_MESSAGE = "Please input a valid task number after the command."; private final String output; - private boolean willExit; + private boolean isExiting; /** * Creates a new command parser for the input. @@ -39,12 +37,12 @@ public CommandParser(String input, TaskList taskList, Storage storage, Ui ui) { CommandsEnum commandEnum; try { commandEnum = CommandsEnum.valueOf(inputArr[0].toUpperCase()); - this.willExit = false; + this.isExiting = false; switch (commandEnum) { // Single word commands case BYE: output = ui.getGoodByeMessage(); - willExit = true; + isExiting = true; return; case LIST: output = ui.getAllTasksMessage(taskList.getAllTasks(), taskList.size()); @@ -60,7 +58,7 @@ public CommandParser(String input, TaskList taskList, Storage storage, Ui ui) { if (inputArr.length < 2) { throw new InvalidCommandException(TOO_LITTLE_ARGUMENTS_MESSAGE); } - output = parseMultiword(inputArr[1], commandEnum, taskList, ui); + output = parseMultiWord(inputArr[1], commandEnum, taskList, ui); } } catch (IllegalArgumentException e) { throw new InvalidCommandException(INVALID_COMMAND); @@ -81,7 +79,7 @@ public CommandParser(String input, TaskList taskList, Storage storage, Ui ui) { * @param ui The user interface generating the output messages. * @return The output string from ui. */ - private static String parseMultiword(String inputWords, CommandsEnum commandsEnum, TaskList taskList, Ui ui) { + private static String parseMultiWord(String inputWords, CommandsEnum commandsEnum, TaskList taskList, Ui ui) { switch (commandsEnum) { case FIND: return ui.getTasksWithPatternMessage(inputWords, @@ -145,7 +143,7 @@ public String getOutput() { * @return true if and only if the command is to exit */ public boolean willExit() { - return willExit; + return isExiting; } } diff --git a/src/main/java/duke/logic/DateTimeParser.java b/src/main/java/duke/logic/DateTimeParser.java index fcc26bdda5..966a84c98a 100644 --- a/src/main/java/duke/logic/DateTimeParser.java +++ b/src/main/java/duke/logic/DateTimeParser.java @@ -56,14 +56,6 @@ public DateTimeParser(String dateTime, LocalDate relativeStartDate, LocalTime re } } - private LocalDate parseDate(String date) { - return LocalDate.parse(date, DateTimeFormatter.ofPattern("d/M/yyyy")); - } - - private LocalTime parseTime(String time) { - return LocalTime.parse(time, DateTimeFormatter.ofPattern("H:m")); - } - /** * Returns the LocalDateTime object associated with the date and time represented in the data string. * @@ -74,6 +66,14 @@ public static LocalDateTime getDateTimeFromDataString(String data) { return LocalDateTime.parse(data, DateTimeFormatter.ofPattern("yyyy-MM-dd HH:mm")); } + private LocalDate parseDate(String date) { + return LocalDate.parse(date, DateTimeFormatter.ofPattern("d/M/yyyy")); + } + + private LocalTime parseTime(String time) { + return LocalTime.parse(time, DateTimeFormatter.ofPattern("H:m")); + } + /** * Gets the date of this datetime. * diff --git a/src/main/java/duke/ui/TextCliUi.java b/src/main/java/duke/ui/TextCliUi.java index 46de840a6a..728c641dc2 100644 --- a/src/main/java/duke/ui/TextCliUi.java +++ b/src/main/java/duke/ui/TextCliUi.java @@ -13,15 +13,16 @@ public class TextCliUi { private final Scanner sc; private final Ui ui; - private boolean willExit; + private boolean isExiting; /** - * Creates a new instance of a user interface by creating a new scanner and querying for the user's name. + * Creates a new instance of a user interface by creating a new scanner and + * querying for the user's name. */ public TextCliUi() { sc = new Scanner(System.in); String name = ""; - willExit = false; + isExiting = false; String logo = " ____ _ \n" + "| _ \\ _ _| | _____ \n" + "| | | | | | | |/ / _ \\\n" @@ -39,7 +40,7 @@ public TextCliUi() { } public boolean willExit() { - return willExit; + return isExiting; } /** @@ -52,7 +53,7 @@ public void checkInput(TaskList taskList, Storage storage) { String userInput = sc.nextLine(); try { CommandParser cmdParser = new CommandParser(userInput, taskList, storage, ui); - willExit = cmdParser.willExit(); + isExiting = cmdParser.willExit(); System.out.println(cmdParser.getOutput()); } catch (DukeException e) { System.out.println(e.getMessage()); diff --git a/src/main/java/duke/ui/Ui.java b/src/main/java/duke/ui/Ui.java index f738b9ed38..ba9e2138dc 100644 --- a/src/main/java/duke/ui/Ui.java +++ b/src/main/java/duke/ui/Ui.java @@ -19,7 +19,7 @@ */ public class Ui { private final String name; - private boolean willExit = false; + private boolean isExiting = false; /** * Creates a new instance of a user interface by creating a new scanner and querying for the user's name. @@ -30,7 +30,7 @@ public Ui(String name) { } public boolean willExit() { - return willExit; + return isExiting; } /** @@ -45,7 +45,7 @@ public String checkInput(String userInput, TaskList taskList, Storage storage) { CommandParser cmdParser; try { cmdParser = new CommandParser(userInput, taskList, storage, this); - willExit = cmdParser.willExit(); + isExiting = cmdParser.willExit(); output += cmdParser.getOutput() + "\n"; } catch (DukeException e) { output += e.getMessage() + "\n"; @@ -59,15 +59,16 @@ public String checkInput(String userInput, Duke duke) { } /** - * Called when the user wants to exit the program. + * Returns the goodbye message. Called when the user wants to exit the program. * * @return the output string */ public String getGoodByeMessage() { - return ("Bye, " + name + "! Hope to see you again soon."); + return "Bye, " + name + "! Hope to see you again soon."; } /** + * Returns the successful add task message. * Called when the user successfully adds the task to tasklist. * * @param task the task that is added @@ -82,6 +83,7 @@ public String addTaskMessage(Task task, int sizeOfList) { } /** + * Returns the successful remove task message. * Called when the user removes a task from the task list. * * @param task the task that is removed or deleted diff --git a/src/main/resources/view/DialogBox.fxml b/src/main/resources/view/DialogBox.fxml index 03a25f34d2..da78b8c4ef 100644 --- a/src/main/resources/view/DialogBox.fxml +++ b/src/main/resources/view/DialogBox.fxml @@ -2,8 +2,8 @@ - + + ellipsisString=""/> \ No newline at end of file diff --git a/src/main/resources/view/MainWindow.fxml b/src/main/resources/view/MainWindow.fxml index 44908e435d..183a3b0cfa 100644 --- a/src/main/resources/view/MainWindow.fxml +++ b/src/main/resources/view/MainWindow.fxml @@ -5,7 +5,8 @@ -