forked from nus-cs2103-AY2223S1/ip
-
Notifications
You must be signed in to change notification settings - Fork 0
/
TaskList.java
66 lines (57 loc) · 1.39 KB
/
TaskList.java
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
package duke;
import java.util.ArrayList;
/**
* Represents a list of tasks.
*/
public class TaskList {
private ArrayList<Task> tasks;
/**
* TaskList Default Constructor
*/
public TaskList() {
this.tasks = new ArrayList<>();
}
/**
* TaskList Constructor if tasks are provided
* @param tasks ArrayList of Task loaded.
*/
public TaskList(ArrayList<Task> tasks) {
this.tasks = tasks;
}
/**
* Tasks Getter
* @return ArrayList of Task stored.
*/
public ArrayList<Task> getTasks() {
return this.tasks;
}
/**
* Single Task Getter
* @param index index number specifying the location of the task to be retrieved in the TaskList.
* @return Task object located at the specified index.
*/
public Task getTask(int index) {
return this.tasks.get(index);
}
/**
* Task Adder
* @param task Task object to be added to the TaskList.
*/
public void addTask(Task task) {
this.tasks.add(task);
}
/**
* Task Cleaner
* @param index index number specifying the location of the task to be deleted in the TaskList.
*/
public void deleteTask(int index) {
this.tasks.remove(index);
}
/**
* Size Getter
* @return Integer size of the TaskList.
*/
public int getSize() {
return this.tasks.size();
}
}