Skip to content

Commit 39e6e1c

Browse files
committed
A-CodeQuality 💙
1 parent 458523f commit 39e6e1c

2 files changed

Lines changed: 19 additions & 2 deletions

File tree

src/main/java/duke/task/TaskList.java

Lines changed: 18 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -33,6 +33,7 @@ public int getSize() {
3333

3434
/**
3535
* get the number i task
36+
* @param i index
3637
*/
3738
public Task get(int i) {
3839
assert i >= 0 : "Getter error, pointer less than 0";
@@ -41,6 +42,9 @@ public Task get(int i) {
4142

4243
/**
4344
* check whether is date format
45+
* @param date String date
46+
* @param pattern date pattern
47+
* @return boolean of whether string match the pattern
4448
*/
4549
public boolean isDateFormat(String date, String pattern) {
4650
SimpleDateFormat dateFormat = new SimpleDateFormat(pattern);
@@ -59,13 +63,17 @@ public boolean isDateFormat(String date, String pattern) {
5963

6064
/**
6165
* add task to the list
66+
* @param t task that being added
6267
*/
6368
public void add(Task t) {
6469
task.add(t);
6570
}
6671

6772
/**
6873
* parser for add tasks
74+
* @param userInput
75+
* @param ui
76+
* @return String that indicating the result
6977
*/
7078
public String add(String[] userInput, Ui ui) throws DukeException {
7179
String reportString = " ";
@@ -111,6 +119,9 @@ public String add(String[] userInput, Ui ui) throws DukeException {
111119

112120
/**
113121
* mark task as done
122+
* @param inputIndex
123+
* @param ui
124+
* return String indicating the done option
114125
*/
115126
public String doneTask(String inputIndex, Ui ui) {
116127
try {
@@ -134,6 +145,9 @@ public String doneTask(String inputIndex, Ui ui) {
134145

135146
/**
136147
* delete task from list
148+
* @param inputIndex the index of the task being deleted
149+
* @param ui the ui for style printing
150+
* @return string indicating the result of deletion
137151
*/
138152
public String deleteTask(String inputIndex, Ui ui) {
139153
try {
@@ -154,8 +168,9 @@ public String deleteTask(String inputIndex, Ui ui) {
154168

155169
/**
156170
* print out task
171+
* @return tasks description in the list
157172
*/
158-
public String printTask(Ui ui) {
173+
public String printTask() {
159174
String taskList;
160175
taskList = "Here is your current tasks\n";
161176
for (int i = 1; i <= task.size(); ++i) {
@@ -166,6 +181,8 @@ public String printTask(Ui ui) {
166181

167182
/**
168183
* check whether a task is in the list
184+
* @param taskInfo
185+
* @return foundTasks tasks with discriptions that match the string
169186
*/
170187
public List<Task> findTask(String taskInfo) {
171188
List<Task> foundTasks = new ArrayList<>();

src/main/java/duke/ui/Ui.java

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -126,7 +126,7 @@ public String getResponse(String userInput, TaskList task, FileSaver fs) {
126126
response = task.deleteTask(input[1], this);
127127
break;
128128
case LIST:
129-
response = task.printTask(this);
129+
response = task.printTask();
130130
break;
131131
case DONE:
132132
response = task.doneTask(input[1], this);

0 commit comments

Comments
 (0)