diff --git a/.gradle/8.14/executionHistory/executionHistory.bin b/.gradle/8.14/executionHistory/executionHistory.bin
index 17b5e65..03f3208 100644
Binary files a/.gradle/8.14/executionHistory/executionHistory.bin and b/.gradle/8.14/executionHistory/executionHistory.bin differ
diff --git a/.gradle/8.14/executionHistory/executionHistory.lock b/.gradle/8.14/executionHistory/executionHistory.lock
index 6444c67..0dbeab0 100644
Binary files a/.gradle/8.14/executionHistory/executionHistory.lock and b/.gradle/8.14/executionHistory/executionHistory.lock differ
diff --git a/.gradle/8.14/fileHashes/fileHashes.bin b/.gradle/8.14/fileHashes/fileHashes.bin
index 1eb3d44..2bc4be6 100644
Binary files a/.gradle/8.14/fileHashes/fileHashes.bin and b/.gradle/8.14/fileHashes/fileHashes.bin differ
diff --git a/.gradle/8.14/fileHashes/fileHashes.lock b/.gradle/8.14/fileHashes/fileHashes.lock
index 5a7deb4..cb53a03 100644
Binary files a/.gradle/8.14/fileHashes/fileHashes.lock and b/.gradle/8.14/fileHashes/fileHashes.lock differ
diff --git a/.gradle/8.14/fileHashes/resourceHashesCache.bin b/.gradle/8.14/fileHashes/resourceHashesCache.bin
index dd7a248..9284926 100644
Binary files a/.gradle/8.14/fileHashes/resourceHashesCache.bin and b/.gradle/8.14/fileHashes/resourceHashesCache.bin differ
diff --git a/.gradle/buildOutputCleanup/buildOutputCleanup.lock b/.gradle/buildOutputCleanup/buildOutputCleanup.lock
index 1d2e89f..667e9de 100644
Binary files a/.gradle/buildOutputCleanup/buildOutputCleanup.lock and b/.gradle/buildOutputCleanup/buildOutputCleanup.lock differ
diff --git a/build/classes/java/main/hhn/temp/project/TaskManager.class b/build/classes/java/main/hhn/temp/project/TaskManager.class
index 6e76648..2ead6e6 100644
Binary files a/build/classes/java/main/hhn/temp/project/TaskManager.class and b/build/classes/java/main/hhn/temp/project/TaskManager.class differ
diff --git a/build/classes/java/test/project/BadCaseTaskTest.class b/build/classes/java/test/project/BadCaseTaskTest.class
index 8510648..7b738f6 100644
Binary files a/build/classes/java/test/project/BadCaseTaskTest.class and b/build/classes/java/test/project/BadCaseTaskTest.class differ
diff --git a/build/classes/java/test/project/GoodCaseTaskTest.class b/build/classes/java/test/project/GoodCaseTaskTest.class
index 1b9ac88..5bdea69 100644
Binary files a/build/classes/java/test/project/GoodCaseTaskTest.class and b/build/classes/java/test/project/GoodCaseTaskTest.class differ
diff --git a/build/jacoco/test.exec b/build/jacoco/test.exec
index 8ea2a4d..5877e87 100644
Binary files a/build/jacoco/test.exec and b/build/jacoco/test.exec differ
diff --git a/build/jacocoHtml/hhn.temp.project/TaskManager.html b/build/jacocoHtml/hhn.temp.project/TaskManager.html
index ab2d37b..9507097 100644
--- a/build/jacocoHtml/hhn.temp.project/TaskManager.html
+++ b/build/jacocoHtml/hhn.temp.project/TaskManager.html
@@ -1 +1 @@
-
TaskManagerTaskManager
\ No newline at end of file
+TaskManagerTaskManager
\ No newline at end of file
diff --git a/build/jacocoHtml/hhn.temp.project/TaskManager.java.html b/build/jacocoHtml/hhn.temp.project/TaskManager.java.html
index b5ab397..a0d637c 100644
--- a/build/jacocoHtml/hhn.temp.project/TaskManager.java.html
+++ b/build/jacocoHtml/hhn.temp.project/TaskManager.java.html
@@ -2,27 +2,44 @@
import hhn.temp.project.expections.TaskAlreadyExistsException;
+import java.util.ArrayList;
import java.util.HashMap;
+import java.util.List;
import java.util.Map;
public class TaskManager {
private Map<Integer, Task> taskMap;
- public TaskManager() {
- taskMap = new HashMap<>();
- }
+ public TaskManager() {
+ taskMap = new HashMap<>();
+ }
public Task createTask(String name, String description) {
- boolean taskExited = this.taskMap.values().stream().anyMatch(task -> task.getName().equals(name));
- if(taskExited) {
- throw new TaskAlreadyExistsException("Task already exits, with the name: " + name);
+ boolean taskExited = this.taskMap.values().stream().anyMatch(task -> task.getName().equals(name));
+ if(taskExited) {
+ throw new TaskAlreadyExistsException("Task already exits, with the name: " + name);
}
- Task task = new Task(name, description);
- taskMap.put(task.getTaskID(), task);
- return task;
+ Task task = new Task(name, description);
+ taskMap.put(task.getTaskID(), task);
+ return task;
+ }
+
+ public List<Task> getTaskList() {
+ return new ArrayList<>(this.taskMap.values());
+ }
+
+ public Task getTask(String name) {
+ return taskMap.values().stream().filter(t -> t.getName().equals(name)).findFirst()
+ .orElseThrow(() -> new IllegalArgumentException("Wrong name"));
+ }
+ public Task getTask(int taskID) {
+ if(!this.taskMap.containsKey(taskID)) {
+ throw new IllegalArgumentException("Wrong id");
+ }
+ return this.taskMap.get(taskID);
}
}