Skip to content

Commit d081eed

Browse files
committed
Merge branch 'branch-A-JavaDoc'
2 parents e074e85 + c13b21c commit d081eed

File tree

5 files changed

+38
-0
lines changed

5 files changed

+38
-0
lines changed

src/main/java/duke/commands/Command.java

Lines changed: 4 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -2,6 +2,10 @@
22

33
public abstract class Command {
44

5+
/**
6+
* Executes the command.
7+
* @return True if the command executed successfully and false otherwise.
8+
*/
59
public abstract boolean execute();
610

711
}

src/main/java/duke/utils/DateParser.java

Lines changed: 7 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -14,6 +14,13 @@ public class DateParser {
1414
DateTimeFormatter.ofPattern("dd/MM/yyyy")
1515
};
1616

17+
/**
18+
* Parses the given String to a LocalDate.
19+
* Accepts multiple formats.
20+
* @param s String representing the date.
21+
* @return LocalDate corresponding to the given string.
22+
* @throws UnrecognisedDateException If the given string does not follow any defined format.
23+
*/
1724
public static LocalDate stringToDate(String s) throws UnrecognisedDateException {
1825
for (DateTimeFormatter formatter : formatterList) {
1926
try {

src/main/java/duke/utils/InputParser.java

Lines changed: 8 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -7,6 +7,14 @@
77

88
public class InputParser {
99

10+
/**
11+
* Parses the input string.
12+
* @param input Input string.
13+
* @param tasks TaskList in use by the app.
14+
* @param storage Storage in use by the app.
15+
* @param ui Ui in use by the app.
16+
* @return Command to be executed.
17+
*/
1018
public Command parse(String input, TaskList tasks, Storage storage, Ui ui) {
1119
int spaceIndex = input.indexOf(' ');
1220
String command, body;

src/main/java/duke/utils/Storage.java

Lines changed: 9 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -20,6 +20,11 @@ public Storage(File givenSaveFile) {
2020
taskList = new ArrayList<>();
2121
saveFile = givenSaveFile;
2222
}
23+
24+
/**
25+
* Loads the list of tasks from the save file.
26+
* @return List of tasks
27+
*/
2328
public List<Task> loadFromFile() {
2429
boolean isSaveFileCreated = saveFile.exists();
2530
if (!isSaveFileCreated) {
@@ -45,6 +50,10 @@ public List<Task> loadFromFile() {
4550
return taskList;
4651
}
4752

53+
/**
54+
* Persists the list of tasks to the save file.
55+
* @param givenTaskList List of tasks in use by the app.
56+
*/
4857
public void saveToFile(List<Task> givenTaskList) {
4958
taskList = givenTaskList;
5059
try {

src/main/java/duke/utils/TaskParser.java

Lines changed: 10 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -8,6 +8,16 @@
88

99
public class TaskParser {
1010

11+
/**
12+
* Parses a String from the input containing task information into a Task.
13+
* @param type Type of the Task.
14+
* @param s String containing task information.
15+
* @return Task object.
16+
* @throws EmptyTaskDateException If a date is required but not specified.
17+
* @throws EmptyTaskDescException If no description is specified.
18+
* @throws NoSuchTaskTypeException If no such task type exists.
19+
* @throws UnrecognisedDateException If the format of the given date is unrecognised.
20+
*/
1121
public static Task stringToTask(TaskType type, String s)
1222
throws EmptyTaskDateException, EmptyTaskDescException, NoSuchTaskTypeException, UnrecognisedDateException {
1323
if ("".equals(s)) {

0 commit comments

Comments
 (0)