-
Notifications
You must be signed in to change notification settings - Fork 0
Expand file tree
/
Copy pathTask.java
More file actions
58 lines (47 loc) · 1.3 KB
/
Copy pathTask.java
File metadata and controls
58 lines (47 loc) · 1.3 KB
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
package linqing.tojava;
import java.util.ArrayList;
import java.util.List;
/**
* Task class represent tasks and helps to store tasks
*/
public class Task {
protected String description;
protected boolean isDone;
List<String> saveTask = new ArrayList<>();
String printTask;
public Task(String description) {
this.description = description; // we only want the string after "add" command, so we use split to achieve
// this purpose
this.isDone = false;
saveTask.add(0, "description: " + getDescription());
}
public String getDescription() {
return description;
}
public void saveTask(int level, String info) {
saveTask.add(level, info);
}
public String toString(int i) {
for (int n = 0; n <= i; ++n) {
if (n == 0)
printTask = saveTask.get(n);
else
printTask = (printTask + '\n' + saveTask.get(n));
}
return printTask;
}
public void setDone(boolean isDone) {
this.isDone = isDone;
saveTask.set(1, "is done? Yes");
}
public String checkDone() {
if (isDone == false)
return "No";
else {
return "Yes";
}
}
public boolean isDone() {
return isDone;
}
}