diff --git a/src/main/java/duke/Deadline.java b/src/main/java/duke/Deadline.java index 958215378e..759b72a88f 100644 --- a/src/main/java/duke/Deadline.java +++ b/src/main/java/duke/Deadline.java @@ -18,7 +18,11 @@ public Deadline(String description, String by) { super(description); this.by = LocalDateTime.parse(by); } - + /** + * Gets the full description of the deadline task. + * The message here is used to be printed for the user. + * @return Message for the description of the deadline task. + */ @Override public String printDesc() { try { @@ -28,7 +32,11 @@ public String printDesc() { return "Please key in the dates in the format of YYYY-MM-ddThh:mm:ss"; } } - + /** + * Gets the full description of the deadline task. + * The message here is used to be stored in the duke.txt. + * @return Message for the description of the deadline task. + */ @Override public String getDescription() { return "D~" + super.getDescription() + "~" + this.by; diff --git a/src/main/java/duke/Event.java b/src/main/java/duke/Event.java index a94dbd4954..88a1067e32 100644 --- a/src/main/java/duke/Event.java +++ b/src/main/java/duke/Event.java @@ -21,14 +21,22 @@ public Event(String description, String from, String to) { this.from = LocalDateTime.parse(from); this.to = LocalDateTime.parse(to); } - + /** + * Gets the full description of the event task. + * The message here is used to be printed for the user. + * @return Message for the description of the event task. + */ @Override public String printDesc() { String fromMessage = this.from.format(DateTimeFormatter.ofPattern("MMM d yyyy H:mm")); String toMessage = this.to.format(DateTimeFormatter.ofPattern("MMM d yyyy H:mm")); return "[E]" + super.printDesc() + " (from: " + fromMessage + " to: " + toMessage + ")"; } - + /** + * Gets the full description of the event task. + * The message here is used to be stored in the duke.txt. + * @return Message for the description of the event task. + */ @Override public String getDescription() { return "E~" + super.getDescription() + "~" + this.from + " - " + this.to; diff --git a/src/main/java/duke/Parser.java b/src/main/java/duke/Parser.java index 90bdfefa8f..39cf491310 100644 --- a/src/main/java/duke/Parser.java +++ b/src/main/java/duke/Parser.java @@ -4,19 +4,38 @@ * The duke.Parser class processes commands by breaking it up to words. */ public class Parser { + /** + * Splits the input into array of [command word, details]. + * @return The array of parsed input. + */ public String[] commandSplit(String command) { return command.split(" ", 2); } - + /** + * Splits the input into array of [deadline details, deadline due date]. + * @return The array of parsed input. + */ public String[] deadlineDetails(String task) { return task.split("/by ", 2); } + /** + * Splits the input into array of [event details, event from, event to]. + * @return The array of parsed input. + */ public String[] eventDetails(String task) { return task.split(" /", 3); } + /** + * Splits the input containing details regarding a task. + * @return The array of parsed input. + */ public String[] storageSplit(String task) { return task.split("~", 6); } + /** + * Splits the input containing details about start and end time of an event task. + * @return The array of parsed input. + */ public String[] storageTimeSplit(String time) { return time.split(" - ", 2); } diff --git a/src/main/java/duke/Task.java b/src/main/java/duke/Task.java index 56c86fc6b1..4ea388f02d 100644 --- a/src/main/java/duke/Task.java +++ b/src/main/java/duke/Task.java @@ -88,10 +88,18 @@ public String getDescription() { public String getDesc() { return this.description; } + /** + * Updates the task as a reminder. + * This task will then be printed out everytime the charbot is first launched. + * @return Message for the progress of the task. + */ public String makeReminder() { this.isReminder = true; return "OK, I will remind you of this task the next time I see you!\n"; } + /** + * Updates the task as a reminder without printing any messages. + */ public void updateReminder() { this.isReminder = true; } diff --git a/src/main/java/duke/TaskList.java b/src/main/java/duke/TaskList.java index 9569152dc5..585c084786 100644 --- a/src/main/java/duke/TaskList.java +++ b/src/main/java/duke/TaskList.java @@ -250,6 +250,10 @@ protected static String printReminders() { return message; } } + /** + * Provides the list of commands that POPOOH can execute. + * @return The full list of commands and their formats. + */ public String getHelp() { String message = "Here are some of the commands that I can execute!:\n" + "1. List out the all the tasks\n" diff --git a/src/main/java/duke/Todo.java b/src/main/java/duke/Todo.java index 5e708f00b4..3e0e4a3230 100644 --- a/src/main/java/duke/Todo.java +++ b/src/main/java/duke/Todo.java @@ -12,11 +12,20 @@ public class Todo extends Task { public Todo(String description) { super(description); } - + /** + * Gets the full description of the todo task. + * The message here is used to be printed for the user. + * @return Message for the description of the todo task. + */ @Override public String printDesc() { return "[T]" + super.printDesc(); } + /** + * Gets the full description of the todo task. + * The message here is used to be stored in the duke.txt. + * @return Message for the description of the todo task. + */ @Override public String getDescription() { return "T~" + super.getDescription(); diff --git a/src/main/java/duke/Ui.java b/src/main/java/duke/Ui.java index 769ecc10d7..4bec0de5e4 100644 --- a/src/main/java/duke/Ui.java +++ b/src/main/java/duke/Ui.java @@ -4,10 +4,18 @@ * This class helps Duke interact with the user. */ public class Ui { + /** + * Prints out the greeting message for when the chatbot is first launched. + * @return The greeting message. + */ public static String greet() { return "Hello! I'm POPOOH!!\n" + "What can I do for you?\n"; } + /** + * Prints out the exit message for when the chatbot. + * @return The exit message. + */ public static String exit() { return "Glad that I could help you!\n" + "See ya next time hehe :)";