From be4aa094715212990b3c5c27cc2df599be47fe55 Mon Sep 17 00:00:00 2001 From: Junwei Date: Sun, 22 Sep 2019 13:43:46 +0800 Subject: [PATCH] Fix Code Quality --- src/main/java/Duke.java | 1 - src/main/java/command/AddCommand.java | 6 +++++- src/main/java/command/DeleteCommand.java | 6 +++++- src/main/java/command/DoneCommand.java | 6 +++++- src/main/java/command/ExitCommand.java | 6 +++++- src/main/java/command/FindCommand.java | 6 +++++- src/main/java/command/HelpCommand.java | 6 +++++- src/main/java/command/InvalidCommand.java | 6 +++++- src/main/java/command/ListCommand.java | 6 +++++- src/main/java/tasks/Task.java | 5 ++--- src/test/java/DeadLineTest.java | 2 ++ 11 files changed, 44 insertions(+), 12 deletions(-) diff --git a/src/main/java/Duke.java b/src/main/java/Duke.java index 001e76b248..3607febe41 100644 --- a/src/main/java/Duke.java +++ b/src/main/java/Duke.java @@ -19,7 +19,6 @@ public class Duke { */ String getResponse(String input) throws IOException { Command c = Parser.parse(input); - assert (c instanceof Command) : "Parser did not return a command."; return c.execute(tasks, ui, storage); } diff --git a/src/main/java/command/AddCommand.java b/src/main/java/command/AddCommand.java index a74e324fe0..f7499bdb86 100644 --- a/src/main/java/command/AddCommand.java +++ b/src/main/java/command/AddCommand.java @@ -36,7 +36,11 @@ public AddCommand(String type, String taskDescription) { } /** - * Executes the given task and prints the respective output. + * Executes the given add task. + * @param tasks A {@Code: TaskList} object + * @param ui A {@Code: Ui} object + * @param storage A {@Code: Storage} object + * @return A String representing the information of the executed task */ public String execute(TaskList tasks, Ui ui, Storage storage) throws IOException { diff --git a/src/main/java/command/DeleteCommand.java b/src/main/java/command/DeleteCommand.java index 0f302d6c26..c9447d142b 100644 --- a/src/main/java/command/DeleteCommand.java +++ b/src/main/java/command/DeleteCommand.java @@ -19,7 +19,11 @@ public DeleteCommand(int index) { } /** - * Executes the given task and prints the respective output. + * Executes the given delete task. + * @param tasks A {@Code: TaskList} object + * @param ui A {@Code: Ui} object + * @param storage A {@Code: Storage} object + * @return A String representing the information of the executed task */ public String execute(TaskList tasks, Ui ui, Storage storage) throws IOException { diff --git a/src/main/java/command/DoneCommand.java b/src/main/java/command/DoneCommand.java index eb8ab563b2..76bb5467a3 100644 --- a/src/main/java/command/DoneCommand.java +++ b/src/main/java/command/DoneCommand.java @@ -19,7 +19,11 @@ public DoneCommand(int index) { } /** - * Executes the given task and prints the respective output. + * Executes the given done task. + * @param tasks A {@Code: TaskList} object + * @param ui A {@Code: Ui} object + * @param storage A {@Code: Storage} object + * @return A String representing the information of the executed task */ public String execute(TaskList tasks, Ui ui, Storage storage) throws IOException { diff --git a/src/main/java/command/ExitCommand.java b/src/main/java/command/ExitCommand.java index af6b153e96..918b5fd93f 100644 --- a/src/main/java/command/ExitCommand.java +++ b/src/main/java/command/ExitCommand.java @@ -7,7 +7,11 @@ public class ExitCommand extends Command { /** - * Executes the given task and prints the respective output. + * Executes the given exit task. + * @param tasks A {@Code: TaskList} object + * @param ui A {@Code: Ui} object + * @param storage A {@Code: Storage} object + * @return A String representing the information of the executed task */ public String execute(TaskList tasks, Ui ui, Storage storage) { diff --git a/src/main/java/command/FindCommand.java b/src/main/java/command/FindCommand.java index e3f576b78c..0fef6ff99d 100644 --- a/src/main/java/command/FindCommand.java +++ b/src/main/java/command/FindCommand.java @@ -13,7 +13,11 @@ public FindCommand(String description) { } /** - * Executes the given task and prints the respective output. + * Executes the given find task. + * @param tasks A {@Code: TaskList} object + * @param ui A {@Code: Ui} object + * @param storage A {@Code: Storage} object + * @return A String representing the information of the executed task */ public String execute(TaskList tasks, Ui ui, Storage storage) { diff --git a/src/main/java/command/HelpCommand.java b/src/main/java/command/HelpCommand.java index 9028cc8bb7..327575716e 100644 --- a/src/main/java/command/HelpCommand.java +++ b/src/main/java/command/HelpCommand.java @@ -17,7 +17,11 @@ public class HelpCommand extends Command { private static final String EVENT_MSG = "event [description] [/at] [date] - Add an event task."; /** - * Executes the given task and prints the respective output. + * Executes the given help task. + * @param tasks A {@Code: TaskList} object + * @param ui A {@Code: Ui} object + * @param storage A {@Code: Storage} object + * @return A String representing the information of the help commands */ public String execute(TaskList tasks, Ui ui, Storage storage) { String output = ""; diff --git a/src/main/java/command/InvalidCommand.java b/src/main/java/command/InvalidCommand.java index ad44705759..6067dbe72e 100644 --- a/src/main/java/command/InvalidCommand.java +++ b/src/main/java/command/InvalidCommand.java @@ -13,7 +13,11 @@ public InvalidCommand(String errorMessage) { } /** - * Executes the given task and prints the respective output. + * Executes the given InvalidCommand task. + * @param tasks A {@Code: TaskList} object + * @param ui A {@Code: Ui} object + * @param storage A {@Code: Storage} object + * @return A String representing the error message of the command */ public String execute(TaskList tasks, Ui ui, Storage storage) { diff --git a/src/main/java/command/ListCommand.java b/src/main/java/command/ListCommand.java index 30e94a9127..f2b5f1615f 100644 --- a/src/main/java/command/ListCommand.java +++ b/src/main/java/command/ListCommand.java @@ -7,7 +7,11 @@ public class ListCommand extends Command { /** - * Executes the given task and prints the respective output. + * Executes the given List task. + * @param tasks A {@Code: TaskList} object + * @param ui A {@Code: Ui} object + * @param storage A {@Code: Storage} object + * @return A String representing the list of tasks */ public String execute(TaskList tasks, Ui ui, Storage storage) { diff --git a/src/main/java/tasks/Task.java b/src/main/java/tasks/Task.java index 15f6446dcf..6984ee2e85 100644 --- a/src/main/java/tasks/Task.java +++ b/src/main/java/tasks/Task.java @@ -31,9 +31,8 @@ public String toString() { } /** - * Returns a StatusIcon, based on whether the task is completed or not. - * - * @return StatusIcon + * Returns a status icon, based on whether the task is completed or not. + * @return String representing the status icon */ public String getStatusIcon() { // X to represent done, nothing to represent not done diff --git a/src/test/java/DeadLineTest.java b/src/test/java/DeadLineTest.java index 1a695dfe84..718aca182e 100644 --- a/src/test/java/DeadLineTest.java +++ b/src/test/java/DeadLineTest.java @@ -26,4 +26,6 @@ public void testGetStatusIcon() { d.setAsDone(); assertEquals("X", d.getStatusIcon()); } + + }