From f8044ec253c8f06ab01a2a745434dbdcc6f10c57 Mon Sep 17 00:00:00 2001 From: fxe025 Date: Thu, 7 Mar 2024 13:48:22 +0800 Subject: [PATCH] edit Manager and TaskList class --- src/main/java/Parser/Manager.java | 8 ++++---- src/main/java/TaskList/TaskList.java | 4 ++++ 2 files changed, 8 insertions(+), 4 deletions(-) diff --git a/src/main/java/Parser/Manager.java b/src/main/java/Parser/Manager.java index 96ac64248..d1178ff3f 100644 --- a/src/main/java/Parser/Manager.java +++ b/src/main/java/Parser/Manager.java @@ -1,7 +1,6 @@ package Parser; import Storage.DukeFile; -import TaskList.DeleteTask; import TaskList.Task; import Ui.PrintTask; import Ui.PrintText; @@ -9,7 +8,8 @@ import java.util.ArrayList; import java.util.Scanner; -import static TaskList.AddTask.addSpecialTask; +import static TaskList.TaskList.deleteTask; +import static TaskList.TaskList.newSpecialTask; public class Manager { /** @@ -42,7 +42,7 @@ public static void taskListManager(ArrayList tasks) { case "todo": case "deadline": case "event": - Task specialTask = addSpecialTask(text); + Task specialTask = newSpecialTask(text); if (specialTask.getType() != ' ') { tasks.add(specialTask); index++; @@ -51,7 +51,7 @@ public static void taskListManager(ArrayList tasks) { } break; case "delete": - DeleteTask.delete(userInputWords, tasks); + deleteTask(userInputWords, tasks); index--; PrintTask.printMultipleToFile(tasks, false); break; diff --git a/src/main/java/TaskList/TaskList.java b/src/main/java/TaskList/TaskList.java index 8068e4439..d3259cf98 100644 --- a/src/main/java/TaskList/TaskList.java +++ b/src/main/java/TaskList/TaskList.java @@ -14,4 +14,8 @@ public void newTasks() { public static Task newSpecialTask(String description) { return AddTask.addSpecialTask(description); } + + public static void deleteTask(String[] userInputWords, ArrayList tasks) { + DeleteTask.delete(userInputWords, tasks); + } }