-
Notifications
You must be signed in to change notification settings - Fork 0
Expand file tree
/
Copy pathTask.java
More file actions
61 lines (50 loc) · 1.4 KB
/
Task.java
File metadata and controls
61 lines (50 loc) · 1.4 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
59
60
61
import java.util.ArrayList;
import java.util.List;
public class Task {
private String name;
private String description;
private boolean isCompleted;
private List<TaskVersion> history;
public Task(String name, String description) {
this.name = name;
this.description = description;
this.isCompleted = false;
this.history = new ArrayList<>();
saveVersion(); // Sauvegarde initiale de la tâche
}
public String getName() {
return name;
}
public void setName(String name) {
this.name = name;
saveVersion();
}
public String getDescription() {
return description;
}
public void setDescription(String description) {
this.description = description;
saveVersion();
}
public boolean isCompleted() {
return isCompleted;
}
public void setCompleted(boolean completed) {
isCompleted = completed;
saveVersion();
}
public void saveVersion() {
history.add(new TaskVersion(this.name, this.description, this.isCompleted));
}
public List<TaskVersion> getHistory() {
return history;
}
@Override
public String toString() {
return "Task{" +
"name='" + name + '\'' +
", description='" + description + '\'' +
", isCompleted=" + isCompleted +
'}';
}
}