Skip to content

Commit

Permalink
Addition of some Javadoc comments to the code
Browse files Browse the repository at this point in the history
  • Loading branch information
Jannice committed Sep 21, 2023
1 parent 9568b8d commit 652398d
Show file tree
Hide file tree
Showing 7 changed files with 70 additions and 6 deletions.
12 changes: 10 additions & 2 deletions src/main/java/duke/Deadline.java
Original file line number Diff line number Diff line change
Expand Up @@ -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 {
Expand All @@ -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;
Expand Down
12 changes: 10 additions & 2 deletions src/main/java/duke/Event.java
Original file line number Diff line number Diff line change
Expand Up @@ -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;
Expand Down
21 changes: 20 additions & 1 deletion src/main/java/duke/Parser.java
Original file line number Diff line number Diff line change
Expand Up @@ -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);
}
Expand Down
8 changes: 8 additions & 0 deletions src/main/java/duke/Task.java
Original file line number Diff line number Diff line change
Expand Up @@ -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;
}
Expand Down
4 changes: 4 additions & 0 deletions src/main/java/duke/TaskList.java
Original file line number Diff line number Diff line change
Expand Up @@ -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"
Expand Down
11 changes: 10 additions & 1 deletion src/main/java/duke/Todo.java
Original file line number Diff line number Diff line change
Expand Up @@ -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();
Expand Down
8 changes: 8 additions & 0 deletions src/main/java/duke/Ui.java
Original file line number Diff line number Diff line change
Expand Up @@ -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 :)";
Expand Down

0 comments on commit 652398d

Please sign in to comment.