From 452bb0b47cc431d55e5a8be77bd7a5d9d76f3cc9 Mon Sep 17 00:00:00 2001 From: alextang809 Date: Wed, 18 Jan 2023 20:42:03 +0800 Subject: [PATCH 01/27] add welcome msg and bye msg --- src/main/java/Duke.java | 21 +++++++++++++++++++++ src/main/java/Task.java | 3 +++ 2 files changed, 24 insertions(+) create mode 100644 src/main/java/Task.java diff --git a/src/main/java/Duke.java b/src/main/java/Duke.java index 5d313334cc..ee4c28bc5c 100644 --- a/src/main/java/Duke.java +++ b/src/main/java/Duke.java @@ -1,3 +1,5 @@ +import java.util.Scanner; + public class Duke { public static void main(String[] args) { String logo = " ____ _ \n" @@ -6,5 +8,24 @@ public static void main(String[] args) { + "| |_| | |_| | < __/\n" + "|____/ \\__,_|_|\\_\\___|\n"; System.out.println("Hello from\n" + logo); + + + + printWelcomeMessage(); + Scanner in = new Scanner(System.in); + Task[] tasks = new Task[MAX_TASK]; + + public static void printByeMessage() { + Task.printHorizontalLine(); + System.out.println(" Bye. Hope to see you again soon!"); + Task.printHorizontalLine(); + } + + public static void printWelcomeMessage() { + Task.printHorizontalLine(); + System.out.println(" Hello! I'm Duke"); + System.out.println(" What can I do for you?"); + Task.printHorizontalLine(); + } } } diff --git a/src/main/java/Task.java b/src/main/java/Task.java new file mode 100644 index 0000000000..d6d9955bea --- /dev/null +++ b/src/main/java/Task.java @@ -0,0 +1,3 @@ +public class Task { + +} From 5a98ecd6813b0ddb2cfc5b4bc1ea10f11b4dc0dd Mon Sep 17 00:00:00 2001 From: alextang809 Date: Wed, 18 Jan 2023 22:45:03 +0800 Subject: [PATCH 02/27] add constant HORIZONTAL_LINE --- src/main/java/Duke.java | 43 +++++++++++++++++++++++++++++------------ src/main/java/Task.java | 7 ++++++- 2 files changed, 37 insertions(+), 13 deletions(-) diff --git a/src/main/java/Duke.java b/src/main/java/Duke.java index ee4c28bc5c..7497a43325 100644 --- a/src/main/java/Duke.java +++ b/src/main/java/Duke.java @@ -1,6 +1,7 @@ import java.util.Scanner; public class Duke { + public static final int MAX_TASK = 1000; public static void main(String[] args) { String logo = " ____ _ \n" + "| _ \\ _ _| | _____ \n" @@ -9,23 +10,41 @@ public static void main(String[] args) { + "|____/ \\__,_|_|\\_\\___|\n"; System.out.println("Hello from\n" + logo); - - printWelcomeMessage(); + Scanner in = new Scanner(System.in); Task[] tasks = new Task[MAX_TASK]; - public static void printByeMessage() { - Task.printHorizontalLine(); - System.out.println(" Bye. Hope to see you again soon!"); - Task.printHorizontalLine(); + untilBye: + while (true) { + String msgDescription = in.nextLine(); + switch (msgDescription) { + case "bye": + printByeMessage(); + break; + default: + printTaskMessage(msgDescription); + break ; + } } - public static void printWelcomeMessage() { - Task.printHorizontalLine(); - System.out.println(" Hello! I'm Duke"); - System.out.println(" What can I do for you?"); - Task.printHorizontalLine(); - } + } + public static void printByeMessage() { + Task.printHorizontalLine(); + System.out.println(" Bye. Hope to see you again soon!"); + Task.printHorizontalLine(); + } + + public static void printWelcomeMessage() { + Task.printHorizontalLine(); + System.out.println(" Hello! I'm Duke"); + System.out.println(" What can I do for you?"); + Task.printHorizontalLine(); + } + + public static void printTaskMessage(String description) { + Task.printHorizontalLine(); + System.out.println(description); + Task.printHorizontalLine(); } } diff --git a/src/main/java/Task.java b/src/main/java/Task.java index d6d9955bea..dd201f164e 100644 --- a/src/main/java/Task.java +++ b/src/main/java/Task.java @@ -1,3 +1,8 @@ public class Task { - + public static final String HORIZONTAL_LINE = " ____________________________________________________________"; + public String description; + + public static void printHorizontalLine() { + System.out.println(HORIZONTAL_LINE); + } } From dea4eda2ab999f3e90184a8d6f24296232007b5f Mon Sep 17 00:00:00 2001 From: alextang809 Date: Thu, 19 Jan 2023 00:28:35 +0800 Subject: [PATCH 03/27] add documentation for while loop --- src/main/java/Duke.java | 1 + 1 file changed, 1 insertion(+) diff --git a/src/main/java/Duke.java b/src/main/java/Duke.java index 7497a43325..51c2487080 100644 --- a/src/main/java/Duke.java +++ b/src/main/java/Duke.java @@ -15,6 +15,7 @@ public static void main(String[] args) { Scanner in = new Scanner(System.in); Task[] tasks = new Task[MAX_TASK]; + // use while loop to deal with user input through scanner untilBye: while (true) { String msgDescription = in.nextLine(); From 62ed8babbd0707560b3653fadb4e8d4f1ef483b7 Mon Sep 17 00:00:00 2001 From: alextang809 Date: Thu, 19 Jan 2023 00:41:14 +0800 Subject: [PATCH 04/27] add documentation for static functions add TaskList to store List Objects --- src/main/java/Duke.java | 2 ++ src/main/java/TaskList.java | 5 +++++ 2 files changed, 7 insertions(+) create mode 100644 src/main/java/TaskList.java diff --git a/src/main/java/Duke.java b/src/main/java/Duke.java index 51c2487080..a0211e084b 100644 --- a/src/main/java/Duke.java +++ b/src/main/java/Duke.java @@ -30,6 +30,8 @@ public static void main(String[] args) { } } + + // public static void printByeMessage() { Task.printHorizontalLine(); System.out.println(" Bye. Hope to see you again soon!"); diff --git a/src/main/java/TaskList.java b/src/main/java/TaskList.java new file mode 100644 index 0000000000..bae13bf787 --- /dev/null +++ b/src/main/java/TaskList.java @@ -0,0 +1,5 @@ +import java.util.ArrayList; + +public class TaskList extends Task{ + +} From 0fe7424e23ac0c3104480814afd422c0dc694d2f Mon Sep 17 00:00:00 2001 From: alextang809 Date: Thu, 19 Jan 2023 00:49:19 +0800 Subject: [PATCH 05/27] add static member totalNumberOfTask add static method getTotalNumberOfTask create TaskList class to store List of Task --- src/main/java/Task.java | 5 +++++ src/main/java/TaskList.java | 6 +++++- 2 files changed, 10 insertions(+), 1 deletion(-) diff --git a/src/main/java/Task.java b/src/main/java/Task.java index dd201f164e..e8c5d08f73 100644 --- a/src/main/java/Task.java +++ b/src/main/java/Task.java @@ -1,6 +1,11 @@ public class Task { public static final String HORIZONTAL_LINE = " ____________________________________________________________"; public String description; + public static int totalNumberOfTask = 0; + + public static int getTotalNumberOfTask() { + return totalNumberOfTask; + } public static void printHorizontalLine() { System.out.println(HORIZONTAL_LINE); diff --git a/src/main/java/TaskList.java b/src/main/java/TaskList.java index bae13bf787..c58e65848a 100644 --- a/src/main/java/TaskList.java +++ b/src/main/java/TaskList.java @@ -1,5 +1,9 @@ import java.util.ArrayList; -public class TaskList extends Task{ +public class TaskList extends Task { + public static void printTaskList(TaskList taskList) { + + } + ArrayList arrayList = new ArrayList<>(); } From c90157a930169325a49b093bcdac28c0191aae61 Mon Sep 17 00:00:00 2001 From: alextang809 Date: Thu, 19 Jan 2023 01:01:18 +0800 Subject: [PATCH 06/27] commment TaskList class, try to modify Task --- src/main/java/TaskList.java | 22 +++++++++++++--------- 1 file changed, 13 insertions(+), 9 deletions(-) diff --git a/src/main/java/TaskList.java b/src/main/java/TaskList.java index c58e65848a..057396d1a8 100644 --- a/src/main/java/TaskList.java +++ b/src/main/java/TaskList.java @@ -1,9 +1,13 @@ -import java.util.ArrayList; - -public class TaskList extends Task { - public static void printTaskList(TaskList taskList) { - - } - ArrayList arrayList = new ArrayList<>(); - -} +//import java.util.ArrayList; +// +//public class TaskList extends Task { +// public static void printTaskList(TaskList taskList) { +// +// } +// +// public static void addTaskList() { +// +// } +// ArrayList taskList = new ArrayList<>(); +// +//} From e0388a9d8eea5ac522bc95bc2cf6f5517183e70f Mon Sep 17 00:00:00 2001 From: alextang809 Date: Thu, 19 Jan 2023 01:06:50 +0800 Subject: [PATCH 07/27] add method to print TaskList --- src/main/java/Task.java | 10 ++++++++++ 1 file changed, 10 insertions(+) diff --git a/src/main/java/Task.java b/src/main/java/Task.java index e8c5d08f73..5ad427af01 100644 --- a/src/main/java/Task.java +++ b/src/main/java/Task.java @@ -10,4 +10,14 @@ public static int getTotalNumberOfTask() { public static void printHorizontalLine() { System.out.println(HORIZONTAL_LINE); } + + public static void printTaskList(Task[] taskList) { + Task.printHorizontalLine(); + System.out.println(" Here are the tasks in your list:"); + for (int i = 0; i < Task.getTotalNumberOfTask(); i++) { + System.out.println(" " + (i+1) + " " + taskList[i]); + } + Task.printHorizontalLine(); + } + } From 32b75e3c1d1505acd44496af20a60c405d19a249 Mon Sep 17 00:00:00 2001 From: alextang809 Date: Thu, 19 Jan 2023 10:05:42 +0800 Subject: [PATCH 08/27] add constructor with string parameter update way to represent String list some small adjustment about messagePrinting --- src/main/java/Duke.java | 26 +++++++++++++++++++++++--- src/main/java/Task.java | 9 ++++++++- 2 files changed, 31 insertions(+), 4 deletions(-) diff --git a/src/main/java/Duke.java b/src/main/java/Duke.java index a0211e084b..dba1e417f8 100644 --- a/src/main/java/Duke.java +++ b/src/main/java/Duke.java @@ -19,12 +19,16 @@ public static void main(String[] args) { untilBye: while (true) { String msgDescription = in.nextLine(); - switch (msgDescription) { + String[] splitMessage = msgDescription.split(" "); + switch (splitMessage[0]) { case "bye": printByeMessage(); break; + case "list": + Task.printTaskList(tasks); + break; default: - printTaskMessage(msgDescription); + printSplitMessage(msgDescription); break ; } } @@ -47,7 +51,23 @@ public static void printWelcomeMessage() { public static void printTaskMessage(String description) { Task.printHorizontalLine(); - System.out.println(description); + System.out.println(" Hello! I'm Duke"); + Task.printHorizontalLine(); + } + + public static void printSplitMessage(String splitMessage) { + Task.printHorizontalLine(); +//// String combineMessage = ""; +//// // +//// while (true) { +//// +//// } +//// // +// String[] combineMessage = + System.out.println(" added: " + splitMessage); +// for (String a : combineMessage) { +// +// } Task.printHorizontalLine(); } } diff --git a/src/main/java/Task.java b/src/main/java/Task.java index 5ad427af01..aa153ebf21 100644 --- a/src/main/java/Task.java +++ b/src/main/java/Task.java @@ -1,8 +1,15 @@ public class Task { public static final String HORIZONTAL_LINE = " ____________________________________________________________"; public String description; + public int id; public static int totalNumberOfTask = 0; + public Task(String description) { + this.description = description; + totalNumberOfTask ++; + this.id = totalNumberOfTask; + } + public static int getTotalNumberOfTask() { return totalNumberOfTask; } @@ -15,7 +22,7 @@ public static void printTaskList(Task[] taskList) { Task.printHorizontalLine(); System.out.println(" Here are the tasks in your list:"); for (int i = 0; i < Task.getTotalNumberOfTask(); i++) { - System.out.println(" " + (i+1) + " " + taskList[i]); + System.out.println(" " + taskList[i].id + " " + taskList[i]); } Task.printHorizontalLine(); } From 438bb2ce1423a23c4f8e1c1f0d2d7776290ebff8 Mon Sep 17 00:00:00 2001 From: alextang809 Date: Thu, 19 Jan 2023 17:40:01 +0800 Subject: [PATCH 09/27] add code to increase taskList add an adjustment to adjust the index comment out the TaskList --- src/main/java/Duke.java | 33 ++++++++++----------------------- src/main/java/Task.java | 5 +++-- src/main/java/TaskList.java | 3 +++ 3 files changed, 16 insertions(+), 25 deletions(-) diff --git a/src/main/java/Duke.java b/src/main/java/Duke.java index dba1e417f8..dab097c0d9 100644 --- a/src/main/java/Duke.java +++ b/src/main/java/Duke.java @@ -12,8 +12,10 @@ public static void main(String[] args) { printWelcomeMessage(); + Scanner in = new Scanner(System.in); - Task[] tasks = new Task[MAX_TASK]; + Task[] taskList = new Task[MAX_TASK]; + int taskCounter = 0; // use while loop to deal with user input through scanner untilBye: @@ -23,19 +25,20 @@ public static void main(String[] args) { switch (splitMessage[0]) { case "bye": printByeMessage(); - break; + break untilBye; case "list": - Task.printTaskList(tasks); + Task.printTaskList(taskList); break; default: - printSplitMessage(msgDescription); + printMessage(msgDescription); + taskList[taskCounter] = new Task(msgDescription); + taskCounter++; break ; } } } - // public static void printByeMessage() { Task.printHorizontalLine(); System.out.println(" Bye. Hope to see you again soon!"); @@ -49,25 +52,9 @@ public static void printWelcomeMessage() { Task.printHorizontalLine(); } - public static void printTaskMessage(String description) { - Task.printHorizontalLine(); - System.out.println(" Hello! I'm Duke"); - Task.printHorizontalLine(); - } - - public static void printSplitMessage(String splitMessage) { + public static void printMessage(String msgDescription) { Task.printHorizontalLine(); -//// String combineMessage = ""; -//// // -//// while (true) { -//// -//// } -//// // -// String[] combineMessage = - System.out.println(" added: " + splitMessage); -// for (String a : combineMessage) { -// -// } + System.out.println(" added: " + msgDescription); Task.printHorizontalLine(); } } diff --git a/src/main/java/Task.java b/src/main/java/Task.java index aa153ebf21..eba672ef50 100644 --- a/src/main/java/Task.java +++ b/src/main/java/Task.java @@ -1,12 +1,13 @@ public class Task { public static final String HORIZONTAL_LINE = " ____________________________________________________________"; + public String description; public int id; public static int totalNumberOfTask = 0; public Task(String description) { this.description = description; - totalNumberOfTask ++; + totalNumberOfTask++; this.id = totalNumberOfTask; } @@ -22,7 +23,7 @@ public static void printTaskList(Task[] taskList) { Task.printHorizontalLine(); System.out.println(" Here are the tasks in your list:"); for (int i = 0; i < Task.getTotalNumberOfTask(); i++) { - System.out.println(" " + taskList[i].id + " " + taskList[i]); + System.out.println(" " + taskList[i].id + ". " + taskList[i].description); } Task.printHorizontalLine(); } diff --git a/src/main/java/TaskList.java b/src/main/java/TaskList.java index 057396d1a8..6f8ad69a4c 100644 --- a/src/main/java/TaskList.java +++ b/src/main/java/TaskList.java @@ -11,3 +11,6 @@ // ArrayList taskList = new ArrayList<>(); // //} + + +//use a List to store \ No newline at end of file From 8fd56fe7c3f8c6f803a9b17071bf5b3a3d375e81 Mon Sep 17 00:00:00 2001 From: alextang809 Date: Thu, 19 Jan 2023 20:23:46 +0800 Subject: [PATCH 10/27] delete TaskList class --- src/main/java/TaskList.java | 16 ---------------- 1 file changed, 16 deletions(-) delete mode 100644 src/main/java/TaskList.java diff --git a/src/main/java/TaskList.java b/src/main/java/TaskList.java deleted file mode 100644 index 6f8ad69a4c..0000000000 --- a/src/main/java/TaskList.java +++ /dev/null @@ -1,16 +0,0 @@ -//import java.util.ArrayList; -// -//public class TaskList extends Task { -// public static void printTaskList(TaskList taskList) { -// -// } -// -// public static void addTaskList() { -// -// } -// ArrayList taskList = new ArrayList<>(); -// -//} - - -//use a List to store \ No newline at end of file From 20b8324b5038cb58abb97d0d959a9f95b80709ae Mon Sep 17 00:00:00 2001 From: alextang809 Date: Thu, 19 Jan 2023 21:26:01 +0800 Subject: [PATCH 11/27] add isDone add setDone add setUnDone add printMark() add printUnmark() --- src/main/java/Task.java | 32 ++++++++++++++++++++++++++++++++ 1 file changed, 32 insertions(+) diff --git a/src/main/java/Task.java b/src/main/java/Task.java index eba672ef50..ed934821f4 100644 --- a/src/main/java/Task.java +++ b/src/main/java/Task.java @@ -3,12 +3,30 @@ public class Task { public String description; public int id; + public boolean isDone; public static int totalNumberOfTask = 0; public Task(String description) { this.description = description; totalNumberOfTask++; this.id = totalNumberOfTask; + this.isDone = false; + } + + public String getDoneStatus() { + if (isDone) { + return "X"; + } else { + return " "; + } + } + + public void setDone() { + this.isDone = true; + } + + public void setNotDone() { + this.isDone = false; } public static int getTotalNumberOfTask() { @@ -28,4 +46,18 @@ public static void printTaskList(Task[] taskList) { Task.printHorizontalLine(); } + public void printMark() { + Task.printHorizontalLine(); + System.out.println(" Nice! I've marked this task as done:"); + System.out.println(" " + this); + Task.printHorizontalLine(); + } + + public void printUnmark() { + Task.printHorizontalLine(); + System.out.println(" OK, I've marked this task as not done yet:"); + System.out.println(" " + this); + Task.printHorizontalLine(); + } + } From 9e885d414415a6203121d0361b7030825ba25246 Mon Sep 17 00:00:00 2001 From: alextang809 Date: Wed, 25 Jan 2023 19:56:47 +0800 Subject: [PATCH 12/27] Add mark and unmark --- src/main/java/Duke.java | 4 ++++ 1 file changed, 4 insertions(+) diff --git a/src/main/java/Duke.java b/src/main/java/Duke.java index dab097c0d9..964afaab1d 100644 --- a/src/main/java/Duke.java +++ b/src/main/java/Duke.java @@ -29,6 +29,10 @@ public static void main(String[] args) { case "list": Task.printTaskList(taskList); break; + case "mark": + break; + case "ummark": + break; default: printMessage(msgDescription); taskList[taskCounter] = new Task(msgDescription); From 6a41ae0083060edfbae07f755ad04f6123f2d8d3 Mon Sep 17 00:00:00 2001 From: alextang809 Date: Thu, 26 Jan 2023 21:46:09 +0800 Subject: [PATCH 13/27] Add adjustment --- src/main/java/Duke.java | 1 + 1 file changed, 1 insertion(+) diff --git a/src/main/java/Duke.java b/src/main/java/Duke.java index 964afaab1d..061f4440dc 100644 --- a/src/main/java/Duke.java +++ b/src/main/java/Duke.java @@ -18,6 +18,7 @@ public static void main(String[] args) { int taskCounter = 0; // use while loop to deal with user input through scanner + untilBye: while (true) { String msgDescription = in.nextLine(); From ba795409150652adb4b00528e13549fc1706cb8d Mon Sep 17 00:00:00 2001 From: alextang809 Date: Sun, 5 Feb 2023 14:05:53 +0800 Subject: [PATCH 14/27] Change the internal implementation of Mark as Done --- src/main/java/Duke.java | 68 ++++++++++++++++++++++++++--------------- src/main/java/Task.java | 20 +++++++----- 2 files changed, 56 insertions(+), 32 deletions(-) diff --git a/src/main/java/Duke.java b/src/main/java/Duke.java index 061f4440dc..a846b388a2 100644 --- a/src/main/java/Duke.java +++ b/src/main/java/Duke.java @@ -1,4 +1,5 @@ import java.util.Scanner; +import java.util.Objects; public class Duke { public static final int MAX_TASK = 1000; @@ -14,50 +15,69 @@ public static void main(String[] args) { Scanner in = new Scanner(System.in); - Task[] taskList = new Task[MAX_TASK]; - int taskCounter = 0; + Task[] taskList = new Task[MAX_TASK]; //ask[] taskList = new Task[100]; + //int taskCounter = 0; // use while loop to deal with user input through scanner - - untilBye: + String msgDescription; //String line; Line // msgDescription + request: while (true) { - String msgDescription = in.nextLine(); + msgDescription = in.nextLine(); String[] splitMessage = msgDescription.split(" "); - switch (splitMessage[0]) { - case "bye": - printByeMessage(); - break untilBye; - case "list": - Task.printTaskList(taskList); - break; - case "mark": - break; - case "ummark": - break; - default: - printMessage(msgDescription); - taskList[taskCounter] = new Task(msgDescription); - taskCounter++; - break ; +// switch (splitMessage[0]) { + if (Objects.equals(msgDescription, "list")) { + Task.printHorizontalLine(); + System.out.println("Here are the tasks in your list:"); + for (int i = 0; i < Task.getTotalNumberOfTask(); i++) { + taskList[i].printTask(); + } + Task.printHorizontalLine(); + } else if (Objects.equals(msgDescription, "blah")) { + Task.printHorizontalLine(); + System.out.println(" blah"); + Task.printHorizontalLine(); + } else if (Objects.equals(msgDescription, "bye")) { + Duke.printByeMessage(); + break request; + } else if (Objects.equals(msgDescription.split(" ")[0], "mark")) { + int id = Integer.parseInt(msgDescription.split(" ")[1]) - 1; + taskList[id].setDone(); + Task.printHorizontalLine(); + System.out.println(" Nice! I've marked this task as done:"); + System.out.println(" [X] " + taskList[id].getDescription()); + Task.printHorizontalLine(); + } else if (Objects.equals(msgDescription.split(" ")[0], "unmark")) { + int id = Integer.parseInt(msgDescription.split(" ")[1]) - 1; + taskList[id].setNotDone(); + Task.printHorizontalLine(); + System.out.println(" OK, I've marked this task as not done yet:"); + System.out.println(" [] " + taskList[id].getDescription()); + Task.printHorizontalLine(); + } else { + taskList[Task.getTotalNumberOfTask()] = new Task(msgDescription); + System.out.println(" ____________________________________________________________"); + System.out.println(" added: " + msgDescription); + System.out.println(" ____________________________________________________________"); } + } } - public static void printByeMessage() { + private static void printByeMessage() { Task.printHorizontalLine(); System.out.println(" Bye. Hope to see you again soon!"); Task.printHorizontalLine(); } - public static void printWelcomeMessage() { + private static void printWelcomeMessage() { Task.printHorizontalLine(); System.out.println(" Hello! I'm Duke"); System.out.println(" What can I do for you?"); Task.printHorizontalLine(); } - public static void printMessage(String msgDescription) { + public static void printMessage(String msgDescription){ Task.printHorizontalLine(); System.out.println(" added: " + msgDescription); Task.printHorizontalLine(); diff --git a/src/main/java/Task.java b/src/main/java/Task.java index ed934821f4..de888b667d 100644 --- a/src/main/java/Task.java +++ b/src/main/java/Task.java @@ -13,14 +13,6 @@ public Task(String description) { this.isDone = false; } - public String getDoneStatus() { - if (isDone) { - return "X"; - } else { - return " "; - } - } - public void setDone() { this.isDone = true; } @@ -60,4 +52,16 @@ public void printUnmark() { Task.printHorizontalLine(); } + public void printTask() { + System.out.println(this.id + ".[" + this.getStatusIcon() + "] " + this.description); + } + + public String getStatusIcon() { + return (isDone ? "X" : " "); // mark done task with X + } + + public String getDescription() { + return description; + } + } From fd5d0f9bab7f6512c565410bfde3e190a24ec231 Mon Sep 17 00:00:00 2001 From: alextang809 Date: Mon, 13 Feb 2023 12:16:04 +0800 Subject: [PATCH 15/27] Updated SSH Key and save changes back to Lv5 --- src/main/java/Deadline.java | 2 ++ src/main/java/Event.java | 2 ++ src/main/java/Todo.java | 2 ++ 3 files changed, 6 insertions(+) create mode 100644 src/main/java/Deadline.java create mode 100644 src/main/java/Event.java create mode 100644 src/main/java/Todo.java diff --git a/src/main/java/Deadline.java b/src/main/java/Deadline.java new file mode 100644 index 0000000000..623a1f49d4 --- /dev/null +++ b/src/main/java/Deadline.java @@ -0,0 +1,2 @@ +package PACKAGE_NAME;public class Deadline { +} diff --git a/src/main/java/Event.java b/src/main/java/Event.java new file mode 100644 index 0000000000..fe61476524 --- /dev/null +++ b/src/main/java/Event.java @@ -0,0 +1,2 @@ +package PACKAGE_NAME;public class Event { +} diff --git a/src/main/java/Todo.java b/src/main/java/Todo.java new file mode 100644 index 0000000000..73a10cb4da --- /dev/null +++ b/src/main/java/Todo.java @@ -0,0 +1,2 @@ +package PACKAGE_NAME;public class Todo { +} From ec8f9d911bba3f93f929a61d904afdfe58b60df5 Mon Sep 17 00:00:00 2001 From: alextang809 Date: Mon, 13 Feb 2023 12:34:13 +0800 Subject: [PATCH 16/27] Update printUpdatedTask, derived classes of Task, which is Todo, Deadline and Event --- src/main/java/Deadline.java | 20 +++++++++++-- src/main/java/Duke.class | Bin 0 -> 2342 bytes src/main/java/Duke.java | 58 ++++++++++++++++++++++++++---------- src/main/java/Event.java | 20 +++++++++++-- src/main/java/Task.class | Bin 0 -> 2106 bytes src/main/java/Task.java | 8 +++-- src/main/java/Todo.java | 13 ++++++-- 7 files changed, 96 insertions(+), 23 deletions(-) create mode 100644 src/main/java/Duke.class create mode 100644 src/main/java/Task.class diff --git a/src/main/java/Deadline.java b/src/main/java/Deadline.java index 623a1f49d4..bac22ae7f5 100644 --- a/src/main/java/Deadline.java +++ b/src/main/java/Deadline.java @@ -1,2 +1,18 @@ -package PACKAGE_NAME;public class Deadline { -} +public class Deadline extends Task { + + protected String by; + + public Deadline(String description, String by) { + super(description); + this.by = by; + } + + public String getBy() { + return by; + } + + @Override + public String toString() { + return "[D]" + super.toString() + " (by: " + by + ")"; + } +} \ No newline at end of file diff --git a/src/main/java/Duke.class b/src/main/java/Duke.class new file mode 100644 index 0000000000000000000000000000000000000000..167b45c34d7fbf9fb7cff75becb4fd623e63b35e GIT binary patch literal 2342 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 Date: Mon, 13 Feb 2023 12:51:38 +0800 Subject: [PATCH 17/27] Update toString --- src/main/java/Duke.java | 7 ++++++- src/main/java/Task.java | 8 ++++---- src/main/java/Todo.java | 4 +++- 3 files changed, 13 insertions(+), 6 deletions(-) diff --git a/src/main/java/Duke.java b/src/main/java/Duke.java index cd16852720..18bf15e68d 100644 --- a/src/main/java/Duke.java +++ b/src/main/java/Duke.java @@ -104,7 +104,12 @@ public static void printBlahMessage() { System.out.println(" blah"); Task.printHorizontalLine(); } - + + public static void printWriteAgainMessage() { + Task.printHorizontalLine(); + System.out.println(" this is an unknown command, please write again --Notice Duke is case sensitive"); + Task.printHorizontalLine(); + } public static void printMessage(String msgDescription){ Task.printHorizontalLine(); System.out.println(" added: " + msgDescription); diff --git a/src/main/java/Task.java b/src/main/java/Task.java index c0fb5a5ffb..a76d44ae49 100644 --- a/src/main/java/Task.java +++ b/src/main/java/Task.java @@ -13,6 +13,10 @@ public Task(String description) { this.isDone = false; } + public String getStatusIcon() { return (isDone ? "X" : " "); } + + public String toString() { return "[ ]" + "[" + getStatusIcon() + "] " + description; } + public void setDone() { this.isDone = true; } @@ -60,10 +64,6 @@ public void printUpdatedTask() { printHorizontalLine(); } - public String getStatusIcon() { - return (isDone ? "X" : " "); // mark done task with X - } - public String getDescription() { return description; } diff --git a/src/main/java/Todo.java b/src/main/java/Todo.java index 60b62f05c3..4d72a3cf3f 100644 --- a/src/main/java/Todo.java +++ b/src/main/java/Todo.java @@ -6,6 +6,8 @@ public Todo(String description) { @Override public String toString() { - return "[T]" + super.toString(); +// return "[T]" + super.toString().replaceFirst("[]", ""); +// should use regular expression to avoid magic number, but haven't figured out how to do + return "[T]" + super.toString().substring(3); } } \ No newline at end of file From c136f17edd5a5c579ca2bb5ae7686962ddb8598f Mon Sep 17 00:00:00 2001 From: alextang809 Date: Mon, 13 Feb 2023 12:54:55 +0800 Subject: [PATCH 18/27] Update input.txt --- text-ui-test/input.txt | 6 ++++++ 1 file changed, 6 insertions(+) diff --git a/text-ui-test/input.txt b/text-ui-test/input.txt index e69de29bb2..31e89eff61 100644 --- a/text-ui-test/input.txt +++ b/text-ui-test/input.txt @@ -0,0 +1,6 @@ +todo CS2103T 05-20 +deadline weekly CS2030 quiz /by Tuesday 2359pm +list +event CS2103T lecture /at Friday 4 to 6 pm +mark 1 +list \ No newline at end of file From 979c1b38fe8ea42806eca31a4c9080743a8d5ccb Mon Sep 17 00:00:00 2001 From: alextang809 Date: Mon, 13 Feb 2023 14:26:08 +0800 Subject: [PATCH 19/27] Update Text-ui-Test --- src/main/java/Duke.java | 13 +++++++------ src/main/java/Task.java | 8 +++++++- text-ui-test/EXPECTED.TXT | 34 ++++++++++++++++++++++++++++++++++ 3 files changed, 48 insertions(+), 7 deletions(-) diff --git a/src/main/java/Duke.java b/src/main/java/Duke.java index 18bf15e68d..6c0b2ee39d 100644 --- a/src/main/java/Duke.java +++ b/src/main/java/Duke.java @@ -26,12 +26,13 @@ public static void main(String[] args) { String[] splitMessage = msgDescription.split(" "); // switch (splitMessage[0]) { if (Objects.equals(msgDescription, "list")) { - Task.printHorizontalLine(); - System.out.println("Here are the tasks in your list:"); - for (int i = 0; i < Task.getTotalNumberOfTask(); i++) { - taskList[i].printTaskList(taskList); - } - Task.printHorizontalLine(); +// Task.printHorizontalLine(); +// System.out.println("Here are the tasks in your list:"); +// for (int i = 0; i < Task.getTotalNumberOfTask(); i++) { +// taskList[i].printTaskList(taskList); +// } +// Task.printHorizontalLine(); + Task.printTaskList(taskList); } else if (Objects.equals(msgDescription, "blah")) { printBlahMessage(); } else if (Objects.equals(msgDescription, "bye")) { diff --git a/src/main/java/Task.java b/src/main/java/Task.java index a76d44ae49..4a2b62e1bd 100644 --- a/src/main/java/Task.java +++ b/src/main/java/Task.java @@ -36,9 +36,15 @@ public static void printHorizontalLine() { public static void printTaskList(Task[] taskList) { Task.printHorizontalLine(); System.out.println(" Here are the tasks in your list:"); + // +// for (int i = 0; i < Task.getTotalNumberOfTask(); i++) { +// System.out.println(" " + taskList[i].id + ". " + taskList[i].description); +// } + // for (int i = 0; i < Task.getTotalNumberOfTask(); i++) { - System.out.println(" " + taskList[i].id + ". " + taskList[i].description); + System.out.println(" " + taskList[i].id + ". " + taskList[i]); } + // Task.printHorizontalLine(); } diff --git a/text-ui-test/EXPECTED.TXT b/text-ui-test/EXPECTED.TXT index 657e74f6e7..c432fe1842 100644 --- a/text-ui-test/EXPECTED.TXT +++ b/text-ui-test/EXPECTED.TXT @@ -5,3 +5,37 @@ Hello from | |_| | |_| | < __/ |____/ \__,_|_|\_\___| + ____________________________________________________________ + Hello! I'm Duke + What can I do for you? + ____________________________________________________________ + ____________________________________________________________ + Got it. I've added this task: + [T][ ] CS2103T 05-20 + Now you have 1 tasks in the list. + ____________________________________________________________ + ____________________________________________________________ + Got it. I've added this task: + [D][ ][ ] weekly CS2030 quiz (by: Tuesday 2359pm) + Now you have 2 tasks in the list. + ____________________________________________________________ + ____________________________________________________________ + Here are the tasks in your list: + 1. [T][ ] CS2103T 05-20 + 2. [D][ ][ ] weekly CS2030 quiz (by: Tuesday 2359pm) + ____________________________________________________________ + ____________________________________________________________ + Got it. I've added this task: + [E][ ][ ] CS2103T lecture (at: Friday 4 to 6 pm) + Now you have 3 tasks in the list. + ____________________________________________________________ + ____________________________________________________________ + Nice! I've marked this task as done: + [T][X] CS2103T 05-20 + ____________________________________________________________ + ____________________________________________________________ + Here are the tasks in your list: + 1. [T][X] CS2103T 05-20 + 2. [D][ ][ ] weekly CS2030 quiz (by: Tuesday 2359pm) + 3. [E][ ][ ] CS2103T lecture (at: Friday 4 to 6 pm) + ____________________________________________________________ \ No newline at end of file From 8934ce77a91f1a5946f6e9d4e41be2fc3d7d900f Mon Sep 17 00:00:00 2001 From: alextang809 Date: Mon, 13 Feb 2023 14:40:38 +0800 Subject: [PATCH 20/27] Add test --- text-ui-test/EXPECTED.TXT | 2 +- text-ui-test/runtest.sh | 0 2 files changed, 1 insertion(+), 1 deletion(-) mode change 100644 => 100755 text-ui-test/runtest.sh diff --git a/text-ui-test/EXPECTED.TXT b/text-ui-test/EXPECTED.TXT index c432fe1842..1e4f0f157f 100644 --- a/text-ui-test/EXPECTED.TXT +++ b/text-ui-test/EXPECTED.TXT @@ -38,4 +38,4 @@ Hello from 1. [T][X] CS2103T 05-20 2. [D][ ][ ] weekly CS2030 quiz (by: Tuesday 2359pm) 3. [E][ ][ ] CS2103T lecture (at: Friday 4 to 6 pm) - ____________________________________________________________ \ No newline at end of file + ____________________________________________________________ diff --git a/text-ui-test/runtest.sh b/text-ui-test/runtest.sh old mode 100644 new mode 100755 From c6f9d87bb6d1ba1b9457a80b30c729e6c2350224 Mon Sep 17 00:00:00 2001 From: alextang809 Date: Mon, 13 Feb 2023 15:14:59 +0800 Subject: [PATCH 21/27] Add DukeException --- src/main/java/DukeException.java | 2 + src/main/java/Task.java | 1 + src/main/java/Todo.java | 2 +- suggestions/Duke.java | 127 +++++++++++++++++++++++++++++++ 4 files changed, 131 insertions(+), 1 deletion(-) create mode 100644 src/main/java/DukeException.java create mode 100644 suggestions/Duke.java diff --git a/src/main/java/DukeException.java b/src/main/java/DukeException.java new file mode 100644 index 0000000000..83d92ee9b6 --- /dev/null +++ b/src/main/java/DukeException.java @@ -0,0 +1,2 @@ +public class DukeException extends Exception{ +} diff --git a/src/main/java/Task.java b/src/main/java/Task.java index 4a2b62e1bd..454fc978ee 100644 --- a/src/main/java/Task.java +++ b/src/main/java/Task.java @@ -1,5 +1,6 @@ public class Task { public static final String HORIZONTAL_LINE = " ____________________________________________________________"; + public static int BRACKET_LENGTH = 3; public String description; public int id; diff --git a/src/main/java/Todo.java b/src/main/java/Todo.java index 4d72a3cf3f..8877947aa8 100644 --- a/src/main/java/Todo.java +++ b/src/main/java/Todo.java @@ -8,6 +8,6 @@ public Todo(String description) { public String toString() { // return "[T]" + super.toString().replaceFirst("[]", ""); // should use regular expression to avoid magic number, but haven't figured out how to do - return "[T]" + super.toString().substring(3); + return "[T]" + super.toString().substring(BRACKET_LENGTH); } } \ No newline at end of file diff --git a/suggestions/Duke.java b/suggestions/Duke.java new file mode 100644 index 0000000000..4fb0a35f10 --- /dev/null +++ b/suggestions/Duke.java @@ -0,0 +1,127 @@ +import java.util.Objects; +import java.util.Scanner; +public class Duke { + public static final int MAX_TASK = 100; + public static void printWelcomeMessage() { + Task.printHorizontalLine(); + System.out.println(" Hello! I'm Duke"); + System.out.println(" What can I do for you?"); + Task.printHorizontalLine(); + } + public static void printBlahMessage() { + Task.printHorizontalLine(); + System.out.println(" blah"); + Task.printHorizontalLine(); + } + public static void printByeMessage() { + Task.printHorizontalLine(); + System.out.println(" Bye. Hope to see you again soon!"); + Task.printHorizontalLine(); + } + public static void main(String[] args) { + printWelcomeMessage(); + Scanner in = new Scanner(System.in); + Task[] tasks = new Task[MAX_TASK]; + request: + while(true){ + String line = in.nextLine(); + String[] parsedInput = line.split(" "); + switch (parsedInput[0]) { + case "list": + Task.printTaskList(tasks); + break; + case "mark": + int markId = Integer.parseInt(parsedInput[1]) - 1; + tasks[markId].setDone(); + tasks[markId].printMark(); + markTask(tasks, parsedInput); + break; + case "unmark": + int unmarkId = Integer.parseInt(parsedInput[1]) - 1; + tasks[unmarkId].setNotDone(); + tasks[unmarkId].printUnmark(); + unmarkTask(tasks, parsedInput); + break; + case "todo": + String todoDescription = line.replaceFirst("todo ", ""); + tasks[Todo.getNumberOfTasks()] = new Todo(todoDescription); + int todoId = Todo.getNumberOfTasks() - 1; + tasks[todoId].printNewTask(); + addTodo(tasks, line); + break; + case "deadline": + String[] DescriptionBy = line.replaceFirst("deadline ", "").split(" /by "); + String deadlineDescription = DescriptionBy[0]; + String by = DescriptionBy[1]; + tasks[Deadline.getNumberOfTasks()] = new Deadline(deadlineDescription, by); + int deadlineId = Task.getNumberOfTasks() - 1; + tasks[deadlineId].printNewTask(); + addDeadline(tasks, line); + break; + case "event": + String[] DescriptionAt = line.replaceFirst("event ", "").split(" /at "); + String eventDescription = DescriptionAt[0]; + String at = DescriptionAt[1]; + tasks[Event.getNumberOfTasks()] = new Event(eventDescription, at); + int eventId = Task.getNumberOfTasks() - 1; + tasks[eventId].printNewTask(); + addEvent(tasks, line); + break; + case "blah": + printBlahMessage(); +@@ -76,11 +59,52 @@ public static void main(String[] args) { + printByeMessage(); + break request; + default: + tasks[Task.getNumberOfTasks()] = new Task(line); + int taskId = Task.getNumberOfTasks() - 1; + tasks[taskId].printNewTask(); + addTask(tasks, line); + break; + } + } + } + + private static void addTask(Task[] tasks, String line) { + tasks[Task.getNumberOfTasks()] = new Task(line); + int taskId = Task.getNumberOfTasks() - 1; + tasks[taskId].printNewTask(); + } + + private static void addEvent(Task[] tasks, String line) { + String[] DescriptionAt = line.replaceFirst("event ", "").split(" /at "); + String eventDescription = DescriptionAt[0]; + String at = DescriptionAt[1]; + tasks[Event.getNumberOfTasks()] = new Event(eventDescription, at); + int eventId = Task.getNumberOfTasks() - 1; + tasks[eventId].printNewTask(); + } + + private static void addDeadline(Task[] tasks, String line) { + String[] DescriptionBy = line.replaceFirst("deadline ", "").split(" /by "); + String deadlineDescription = DescriptionBy[0]; + String by = DescriptionBy[1]; + tasks[Deadline.getNumberOfTasks()] = new Deadline(deadlineDescription, by); + int deadlineId = Task.getNumberOfTasks() - 1; + tasks[deadlineId].printNewTask(); + } + + private static void addTodo(Task[] tasks, String line) { + String todoDescription = line.replaceFirst("todo ", ""); + tasks[Todo.getNumberOfTasks()] = new Todo(todoDescription); + int todoId = Todo.getNumberOfTasks() - 1; + tasks[todoId].printNewTask(); + } + + private static void unmarkTask(Task[] tasks, String[] parsedInput) { + int unmarkId = Integer.parseInt(parsedInput[1]) - 1; + tasks[unmarkId].setNotDone(); + tasks[unmarkId].printUnmark(); + } + + private static void markTask(Task[] tasks, String[] parsedInput) { + int markId = Integer.parseInt(parsedInput[1]) - 1; + tasks[markId].setDone(); + tasks[markId].printMark(); + } +} From 364477dc731bbd038e110fa530b27d2110824df0 Mon Sep 17 00:00:00 2001 From: alextang809 Date: Mon, 13 Feb 2023 15:16:38 +0800 Subject: [PATCH 22/27] Add instructions --- src/main/java/efficiency_command.txt | 13 +++++++++++++ 1 file changed, 13 insertions(+) create mode 100644 src/main/java/efficiency_command.txt diff --git a/src/main/java/efficiency_command.txt b/src/main/java/efficiency_command.txt new file mode 100644 index 0000000000..63c56440e2 --- /dev/null +++ b/src/main/java/efficiency_command.txt @@ -0,0 +1,13 @@ +在终端中,您可以使用以下命令来移动光标/指针: + +Ctrl + A:将光标移动到命令行的开头。 +Ctrl + E:将光标移动到命令行的结尾。 +Ctrl + F:将光标向前移动一个字符。 +Ctrl + B:将光标向后移动一个字符。 +Alt + F:将光标向前移动一个单词。 +Alt + B:将光标向后移动一个单词。 +Ctrl + L:清屏并将光标移动到命令行的顶部。 +Ctrl + U:删除命令行上光标之前的所有字符。 +Ctrl + K:删除命令行上光标之后的所有字符。 +Ctrl + W:删除光标前的一个单词。 +这些命令可以让您更轻松地在终端中编辑命令并移动光标/指针。使用这些命令可以提高您在终端中的效率和速度。 \ No newline at end of file From e4d574a0340744fd18033b30abb1764ed6c13cb8 Mon Sep 17 00:00:00 2001 From: alextang809 Date: Wed, 19 Apr 2023 16:11:50 +0800 Subject: [PATCH 23/27] Save, Dates and Time, Packages --- src/main/java/Deadline.java | 18 -- src/main/java/Duke.class | Bin 2342 -> 0 bytes src/main/java/Duke.java | 119 ------- src/main/java/DukeException.java | 2 - src/main/java/Task.class | Bin 2106 -> 0 bytes src/main/java/Task.java | 78 ----- src/main/java/Todo.java | 13 - src/main/java/duke/Duke.java | 87 +++++ src/main/java/duke/command/ByeCommand.java | 33 ++ src/main/java/duke/command/Command.java | 54 ++++ .../java/duke/command/DeadlineCommand.java | 34 ++ src/main/java/duke/command/DeleteCommand.java | 34 ++ src/main/java/duke/command/EventCommand.java | 33 ++ src/main/java/duke/command/FindCommand.java | 31 ++ src/main/java/duke/command/ListCommand.java | 28 ++ src/main/java/duke/command/MarkCommand.java | 35 ++ src/main/java/duke/command/TodoCommand.java | 40 +++ src/main/java/duke/command/UnmarkCommand.java | 34 ++ .../java/{ => duke}/efficiency_command.txt | 0 .../java/duke/exception/DukeException.java | 9 + src/main/java/duke/parser/Parser.java | 65 ++++ src/main/java/duke/storage/Storage.java | 111 +++++++ src/main/java/duke/task/Deadline.java | 55 ++++ src/main/java/{ => duke/task}/Event.java | 9 +- src/main/java/duke/task/Task.java | 25 ++ src/main/java/duke/task/TaskList.java | 303 ++++++++++++++++++ src/main/java/duke/task/Todo.java | 18 ++ src/main/java/duke/ui/Ui.java | 55 ++++ suggestions/lab4.java | 16 + 29 files changed, 1108 insertions(+), 231 deletions(-) delete mode 100644 src/main/java/Deadline.java delete mode 100644 src/main/java/Duke.class delete mode 100644 src/main/java/Duke.java delete mode 100644 src/main/java/DukeException.java delete mode 100644 src/main/java/Task.class delete mode 100644 src/main/java/Task.java delete mode 100644 src/main/java/Todo.java create mode 100644 src/main/java/duke/Duke.java create mode 100644 src/main/java/duke/command/ByeCommand.java create mode 100644 src/main/java/duke/command/Command.java create mode 100644 src/main/java/duke/command/DeadlineCommand.java create mode 100644 src/main/java/duke/command/DeleteCommand.java create mode 100644 src/main/java/duke/command/EventCommand.java create mode 100644 src/main/java/duke/command/FindCommand.java create mode 100644 src/main/java/duke/command/ListCommand.java create mode 100644 src/main/java/duke/command/MarkCommand.java create mode 100644 src/main/java/duke/command/TodoCommand.java create mode 100644 src/main/java/duke/command/UnmarkCommand.java rename src/main/java/{ => duke}/efficiency_command.txt (100%) create mode 100644 src/main/java/duke/exception/DukeException.java create mode 100644 src/main/java/duke/parser/Parser.java create mode 100644 src/main/java/duke/storage/Storage.java create mode 100644 src/main/java/duke/task/Deadline.java rename src/main/java/{ => duke/task}/Event.java (60%) create mode 100644 src/main/java/duke/task/Task.java create mode 100644 src/main/java/duke/task/TaskList.java create mode 100644 src/main/java/duke/task/Todo.java create mode 100644 src/main/java/duke/ui/Ui.java create mode 100644 suggestions/lab4.java diff --git a/src/main/java/Deadline.java b/src/main/java/Deadline.java deleted file mode 100644 index bac22ae7f5..0000000000 --- a/src/main/java/Deadline.java +++ /dev/null @@ -1,18 +0,0 @@ -public class Deadline extends Task { - - protected String by; - - public Deadline(String description, String by) { - super(description); - this.by = by; - } - - public String getBy() { - return by; - } - - @Override - public String toString() { - return "[D]" + super.toString() + " (by: " + by + ")"; - } -} \ No newline at end of file diff --git a/src/main/java/Duke.class b/src/main/java/Duke.class deleted file mode 100644 index 167b45c34d7fbf9fb7cff75becb4fd623e63b35e..0000000000000000000000000000000000000000 GIT binary patch literal 0 HcmV?d00001 literal 2342 zcmaJ?U2has7=C8IW_Fpf?LtdepiHIoiN4FO+F@sBmYrFo z*m&iSz#DIy=#3In8i@V?BQf#9L}TKO7hIW`nCO-DIkQ`6>Bia2oUiwN&ig*kd(M9M z?~`uK*)|P#%tj6grzm%2|W@6g6s(v+XlwR3XY*}EZw7G1yFUzI5EPL7I zSQIhrkfEw*z|JjkW|myfC^9^!!f2b*eg>wKx?DDGFXNRBy*QF!vW+U5kdUyas27ZJ z$Ij{Atm!SX=X$#Bxe_|NtImG<^fc{-k)G{SG3-XOj20Dp&?;e9oed?(C9%C_GopH^ zGcmk|y)yQx*e`ewov#!OV)cJ;gArwQ$lMk5|Xpoq-RD(H$#}#-GVUhRdE=75)|9G@1;$f zaqaG|!-Ik&5+p5#0UVVvsNxvj*s6?Ap@gtovP^2zRga0A^#~rokc#6t!5|iOmm1|6 z1nX~7!7w}XONQ8WRAmLTFeAp@if&QBEmT+QcckZrf-}s{GF?x>IrfTrxuD=Y{VGM# z7gAhM@wU(*?h9~kX@mS2x-hBY9lR@{!CwV^MPY~x+O?f@ScQ2{+Z(TN3;p2WN4nFxrU)FITcM`&`n!& z9mj50FiS~%(+R_}oOW%ptEhcSc!RO?u%6eP`cd=5OH_FrcyhR;Ips2SNrvLJ`*f=gTM9X-3 zt}vySe0v$9uIre}Sl}_KQAjp3PNkePE|_AAs7U6BKxeq;9LICLvR;}pyhSJP#v`y| zD8iQEh%;T1(D5=5)4t~vj8rwA>M_5d=RBvpB;n!a0<0NUK__%OZy9b!+Hne%(#ZD2 zHqC5toL(v!b<8*CyHSYSA;xvf%9x%pqM*#e@x|0`mz`ovQossp@Rii_c_TlpNwk<0 zCx6`1UDt4Be8_^?mUz8{{~$bgF~UdRrCypli@`FDpJFdWF$B^EC+^^q`ZnZzaS7FlW*wRFHwUngZ%gp zwtX1<@-w!hI2L)vHl36cCs#4@DTabW$_fTJ9`nbYAu-lCKI@NL!eZRW@wh*ZM23`R z<#S>T@D&e_1ycqN^6ll@zlOI~(9LFI1#K(XyMoqacn#_P=Fn4gT~CG|<5K36khHRX zOt2HcEq<@^&qHt -MfCL(e+Jp}Fy3mS#l0HNMzQ;cNz?C0y06#&)&%Eh>rPXif z#P78H6W#cW_w?WN$oaSp>zoeD$jcaz(I(?Iby&v)qFd(tRbj)`cs#DQg(HE$I-`2k zH9*C9Csq~Y-7ZRkE^D|#1ryW0dRJb`o`FkY{LbfsBcsqb!DwZfMHfXFF}q>gT7(PCHBYp;%T z=pzB!yW={RfLM#7pVN~l200lq3}ZyYTRIGkp5k6S@T9d%%5I$*^ag}%H}imOBsp2; zZZ?Vw0yho*HvY#ijtN}UFsUPjDS>W3_0y3Av^^EKN^N>mXT_OXjWgS69W$x|-M;OT zTeH7%9SW7V9V?1ifeA&`Sh8xCVe*mNe5k%>*p6}F)@w%9_T-#`dPm2*xFpcCWy#W6 zv02AllGVSg;|i_{^zE8E)`IJlP5IcC+gy3lbfhORnaVYxdv+^|4+N%sek*p_8Z~m0 z`xW<7c z=L9;I3J-H@g_Y8+{6;>va#tYnPfDw1waz{YFSr#>9ZK4u4@>4|l{*Ovrdq8iO<8CD zJ*g(NXvXj5on>>c;ih?kn?Rha71zh0nO{kjU7nTU$JBZw*HwX-|8bcT@%Z@bM~)Iq zAUa>JHcni;$hwxTMO%@JDWqA|Uu^Z;t}8uRGxwG)x$RcGjtCya@i881C@N)30^`T0 z(02CS9V-(Y#-P%RW?8zm1A%W&c4Wga09`VjO4ahl^RBy7-^-pY(21Q>j-`V=tBLvg z3H#u3IaT!r#DZC^7Hw(qd@7mz@{3tRMDc{$_^*Z`1oWKaSha3No?VVwu$Ov26b z(D0eS$iJKN&IyvnD34PM&q^!$aRWLV_d~w5V2mr?fL!y$qSK#wS#gf3TaI&_Us^H6 z@h0Ey(MREoq<@A;Pai^ifkgO=ACX9Nafq&T=ny^6X(4cn;{YNYV+a!`#zfjfDp8RnCHziS$eKe2Yl({Ilf1Gj6o_FzpC&-31Lv0`=ey-$D?I+g(NoxQ)?R zVMNm5QykP^1DJO!*$6B)u|Lf@upg%V2s!fxYTys~=s=j6{y@YaLlqs=H>R$=hUJ7G zk$JzsP;%@ij2{aUfKRX-7wPg5mKrXS5-FNjUV%yuCEuo3Xnyb>*`AMtbnlORB3z z?FjDy{Qk8N-~aU+9Ta>Z)CeU4s}(|;YEM(D8IIG;ViuQ?@r8?_ tasks = taskList.getTasks(); + System.out.println(" Bye. Hope to see you again soon!"); + try { + storage.write(tasks); + } catch (IOException e) { + createDirectory(ui, storage, tasks); + } + } +} diff --git a/src/main/java/duke/command/Command.java b/src/main/java/duke/command/Command.java new file mode 100644 index 0000000000..a34298071e --- /dev/null +++ b/src/main/java/duke/command/Command.java @@ -0,0 +1,54 @@ +package duke.command; + +import duke.storage.Storage; +import duke.task.Task; +import duke.task.TaskList; +import duke.ui.Ui; + +import java.io.IOException; +import java.nio.file.Files; +import java.nio.file.Path; +import java.nio.file.Paths; +import java.util.ArrayList; + + +public abstract class Command { + + String keyword; + String statement; + Boolean isExit = false; + + /** + * Execute a specific user's command and change the storage file accordingly. + * @param taskList The list containing tasks. + * @param ui dealing with interactions with the user. + * @param storage The storage file of tasks. + */ + public abstract void execute(TaskList taskList, Ui ui, Storage storage); + + /** + * Decide if the user wants to quit. + */ + public Boolean isExit() { + return isExit; + } + + /** + * Create a directory "data" if not exists to contain the "tasks.txt". + * @param ui dealing with interactions with the user. + * @param tasks the task list. + * @param storage The storage file of tasks. + */ + static void createDirectory(Ui ui, Storage storage, ArrayList tasks) { + ui.showLine(); + System.out.println(" Seems the data directory doesn't exist yet. Try to create for you!"); + try { + Path path = Paths.get("./data"); + Files.createDirectories(path); + storage.write(tasks); + } catch (IOException ex) { + System.out.println(" Sorry, creation failed!"); + } + } + +} diff --git a/src/main/java/duke/command/DeadlineCommand.java b/src/main/java/duke/command/DeadlineCommand.java new file mode 100644 index 0000000000..26229465ad --- /dev/null +++ b/src/main/java/duke/command/DeadlineCommand.java @@ -0,0 +1,34 @@ +package duke.command; + +import duke.storage.Storage; +import duke.task.Task; +import duke.task.TaskList; +import duke.ui.Ui; + +import java.io.IOException; +import java.util.ArrayList; + +import static duke.task.TaskList.tryAddDeadline; + +public class DeadlineCommand extends Command { + public DeadlineCommand(String keyword, String statement) { + this.keyword = keyword; + this.statement = statement; + } + + /** + * Execute user's "deadline" command and change the storage file accordingly. + * @param taskList The list containing tasks. + * @param ui dealing with interactions with the user. + * @param storage The storage file of tasks. + */ + public void execute(TaskList taskList, Ui ui, Storage storage) { + ArrayList tasks = taskList.getTasks(); + tryAddDeadline(tasks, statement); + try { + storage.write(tasks); + } catch (IOException e) { + createDirectory(ui, storage, tasks); + } + } +} diff --git a/src/main/java/duke/command/DeleteCommand.java b/src/main/java/duke/command/DeleteCommand.java new file mode 100644 index 0000000000..4afa7f7188 --- /dev/null +++ b/src/main/java/duke/command/DeleteCommand.java @@ -0,0 +1,34 @@ +package duke.command; + +import duke.storage.Storage; +import duke.task.Task; +import duke.task.TaskList; +import duke.ui.Ui; + +import java.io.IOException; +import java.util.ArrayList; + +import static duke.task.TaskList.tryDeleteTask; + +public class DeleteCommand extends Command { + public DeleteCommand(String keyword, String statement) { + this.keyword = keyword; + this.statement = statement; + } + + /** + * Execute user's "delete" command and change the storage file accordingly. + * @param taskList The list containing tasks. + * @param ui dealing with interactions with the user. + * @param storage The storage file of tasks. + */ + public void execute(TaskList taskList, Ui ui, Storage storage) { + ArrayList tasks = taskList.getTasks(); + tryDeleteTask(tasks, statement); + try { + storage.write(tasks); + } catch (IOException e) { + createDirectory(ui, storage, tasks); + } + } +} diff --git a/src/main/java/duke/command/EventCommand.java b/src/main/java/duke/command/EventCommand.java new file mode 100644 index 0000000000..91996b6b5a --- /dev/null +++ b/src/main/java/duke/command/EventCommand.java @@ -0,0 +1,33 @@ +package duke.command; + +import duke.storage.Storage; +import duke.task.Task; +import duke.task.TaskList; +import duke.ui.Ui; + +import java.io.IOException; +import java.util.ArrayList; +import static duke.task.TaskList.tryAddEvent; + +public class EventCommand extends Command{ + public EventCommand(String keyword, String statement) { + this.keyword = keyword; + this.statement = statement; + } + + /** + * Execute user's "event" command and change the storage file accordingly. + * @param taskList The list containing tasks. + * @param ui dealing with interactions with the user. + * @param storage The storage file of tasks. + */ + public void execute(TaskList taskList, Ui ui, Storage storage) { + ArrayList tasks = taskList.getTasks(); + tryAddEvent(tasks, statement); + try { + storage.write(tasks); + } catch (IOException e) { + createDirectory(ui, storage, tasks); + } + } +} diff --git a/src/main/java/duke/command/FindCommand.java b/src/main/java/duke/command/FindCommand.java new file mode 100644 index 0000000000..f2673f5740 --- /dev/null +++ b/src/main/java/duke/command/FindCommand.java @@ -0,0 +1,31 @@ +package duke.command; + +import duke.storage.Storage; +import duke.task.Task; +import duke.task.TaskList; +import duke.ui.Ui; + +import java.util.ArrayList; + +import static duke.task.TaskList.findTask; + +public class FindCommand extends Command{ + + String statement; + + public FindCommand(String statement) { + this.statement = statement; + } + + /** + * Execute user's "find" command. + * @param taskList The list containing tasks. + * @param ui dealing with interactions with the user. + * @param storage The storage file of tasks. + */ + @Override + public void execute(TaskList taskList, Ui ui, Storage storage) { + ArrayList tasks = taskList.getTasks(); + findTask(tasks, statement); + } +} diff --git a/src/main/java/duke/command/ListCommand.java b/src/main/java/duke/command/ListCommand.java new file mode 100644 index 0000000000..ab6966a63e --- /dev/null +++ b/src/main/java/duke/command/ListCommand.java @@ -0,0 +1,28 @@ +package duke.command; + +import duke.storage.Storage; +import duke.task.Task; +import duke.task.TaskList; +import duke.ui.Ui; + +import java.util.ArrayList; + +import static duke.task.TaskList.printTaskList; + +public class ListCommand extends Command{ + public ListCommand(String keyword, String statement) { + this.keyword = keyword; + this.statement = statement; + } + + /** + * Execute user's "list" command. + * @param taskList The list containing tasks. + * @param ui dealing with interactions with the user. + * @param storage The storage file of tasks. + */ + public void execute(TaskList taskList, Ui ui, Storage storage) { + ArrayList tasks = taskList.getTasks(); + printTaskList(tasks); + } +} diff --git a/src/main/java/duke/command/MarkCommand.java b/src/main/java/duke/command/MarkCommand.java new file mode 100644 index 0000000000..291be6949a --- /dev/null +++ b/src/main/java/duke/command/MarkCommand.java @@ -0,0 +1,35 @@ +package duke.command; + +import duke.storage.Storage; +import duke.task.Task; +import duke.task.TaskList; +import duke.ui.Ui; + +import java.io.IOException; +import java.util.ArrayList; + +import static duke.task.TaskList.tryMarkTask; + + +public class MarkCommand extends Command { + public MarkCommand(String keyword, String statement) { + this.keyword = keyword; + this.statement = statement; + } + + /** + * Execute user's "mark" command and change the storage file accordingly. + * @param taskList The list containing tasks. + * @param ui dealing with interactions with the user. + * @param storage The storage file of tasks. + */ + public void execute(TaskList taskList, Ui ui, Storage storage) { + ArrayList tasks = taskList.getTasks(); + tryMarkTask(tasks, statement); + try { + storage.write(tasks); + } catch (IOException e) { + createDirectory(ui, storage, tasks); + } + } +} diff --git a/src/main/java/duke/command/TodoCommand.java b/src/main/java/duke/command/TodoCommand.java new file mode 100644 index 0000000000..ab4a621ee0 --- /dev/null +++ b/src/main/java/duke/command/TodoCommand.java @@ -0,0 +1,40 @@ +package duke.command; + +import duke.storage.Storage; +import duke.task.Task; +import duke.task.TaskList; +import duke.ui.Ui; + +import java.io.File; +import java.io.IOException; +import java.nio.file.Files; +import java.nio.file.Path; +import java.nio.file.Paths; +import java.util.ArrayList; + +import static duke.task.TaskList.tryAddTodo; + +public class TodoCommand extends Command { + public TodoCommand(String keyword, String statement) { + this.keyword = keyword; + this.statement = statement; + } + + /** + * Execute user's "todoTask" command and change the storage file accordingly. + * @param taskList The list containing tasks. + * @param ui dealing with interactions with the user. + * @param storage The storage file of tasks. + */ + public void execute(TaskList taskList, Ui ui, Storage storage) { + ArrayList tasks = taskList.getTasks(); + tryAddTodo(tasks, statement); + try { + storage.write(tasks); + } catch (IOException e) { + createDirectory(ui, storage, tasks); + } + } + + +} diff --git a/src/main/java/duke/command/UnmarkCommand.java b/src/main/java/duke/command/UnmarkCommand.java new file mode 100644 index 0000000000..43d30dc134 --- /dev/null +++ b/src/main/java/duke/command/UnmarkCommand.java @@ -0,0 +1,34 @@ +package duke.command; + +import duke.storage.Storage; +import duke.task.Task; +import duke.task.TaskList; +import duke.ui.Ui; + +import java.io.IOException; +import java.util.ArrayList; + +import static duke.task.TaskList.tryUnmarkTask; + +public class UnmarkCommand extends Command{ + public UnmarkCommand(String keyword, String statement) { + this.keyword = keyword; + this.statement = statement; + } + + /** + * Execute user's "unmark" command and change the storage file accordingly. + * @param taskList The list containing tasks. + * @param ui dealing with interactions with the user. + * @param storage The storage file of tasks. + */ + public void execute(TaskList taskList, Ui ui, Storage storage) { + ArrayList tasks = taskList.getTasks(); + tryUnmarkTask(tasks, statement); + try { + storage.write(tasks); + } catch (IOException e) { + createDirectory(ui, storage, tasks); + } + } +} diff --git a/src/main/java/efficiency_command.txt b/src/main/java/duke/efficiency_command.txt similarity index 100% rename from src/main/java/efficiency_command.txt rename to src/main/java/duke/efficiency_command.txt diff --git a/src/main/java/duke/exception/DukeException.java b/src/main/java/duke/exception/DukeException.java new file mode 100644 index 0000000000..ecad03fb21 --- /dev/null +++ b/src/main/java/duke/exception/DukeException.java @@ -0,0 +1,9 @@ +package duke.exception; + +/** + * Exceptions specific to Duke. + */ +public class DukeException extends Exception{ +} + + diff --git a/src/main/java/duke/parser/Parser.java b/src/main/java/duke/parser/Parser.java new file mode 100644 index 0000000000..3920821f8a --- /dev/null +++ b/src/main/java/duke/parser/Parser.java @@ -0,0 +1,65 @@ +package duke.parser; + +import duke.command.*; +import duke.exception.DukeException; + + +public class Parser { + + private static String keyword; + private static String statement; + + /** + * Parse the user's input into formatted command. + * @param fullCommand a single user's command line. + */ + public static Command parse(String fullCommand) throws DukeException { + fullCommand = fullCommand.trim(); + if (countWithSplit(fullCommand) == 0) throw new DukeException(); + else if (countWithSplit(fullCommand) == 1){ + keyword = fullCommand; + switch (keyword) { + case "list": + return new ListCommand(keyword, statement); + case "bye": + return new ByeCommand(); + default: + throw new DukeException(); + } + } + else { + keyword = fullCommand.split("\\s+")[0]; + keyword = keyword.toLowerCase(); + statement = fullCommand.replaceFirst(keyword + "\\s+", ""); + switch (keyword) { + case "mark": + return new MarkCommand(keyword, statement); + case "unmark": + return new UnmarkCommand(keyword, statement); + case "todo": + return new TodoCommand(keyword, statement); + case "deadline": + return new DeadlineCommand(keyword, statement); + case "event": + return new EventCommand(keyword, statement); + case "find": + return new FindCommand(statement); + case "delete": + return new DeleteCommand(keyword, statement); + default: + throw new DukeException(); + } + } + } + + public static int countWithSplit(String str) { + if (isNullOrBlank(str)) { + return 0; + } + return str.split("\\s+").length; + } + + public static boolean isNullOrBlank(String param) { + return param == null || param.trim().length() == 0; + } +} diff --git a/src/main/java/duke/storage/Storage.java b/src/main/java/duke/storage/Storage.java new file mode 100644 index 0000000000..a37209f493 --- /dev/null +++ b/src/main/java/duke/storage/Storage.java @@ -0,0 +1,111 @@ +package duke.storage; + +import duke.exception.DukeException; +import duke.task.Deadline; +import duke.task.Event; +import duke.task.Task; +import duke.ui.Ui; + +import java.io.File; +import java.io.FileNotFoundException; +import java.io.FileWriter; +import java.io.IOException; +import java.time.format.DateTimeFormatter; +import java.util.ArrayList; +import java.util.Scanner; + +import static duke.task.TaskList.*; + + +public class Storage { + private static ArrayList tasks; + private File f; + private String filePath; + public Storage(String filePath){ + f = new File(filePath); + this.filePath = filePath; + } + public ArrayList load() throws DukeException { + tasks = new ArrayList<>(); + Scanner s; + int numberOfLine = 0; + try { + s = new Scanner(f); + while (s.hasNext()) { + String line = s.nextLine(); + String[] parsedLine = line.split(" \\| "); + numberOfLine += 1; + switch (parsedLine[0]) { + case "T": + addTodo(tasks, parsedLine[2]); + break; + case "D": + String deadline = parsedLine[2] + " /by " + parsedLine[3]; + addDeadline(tasks, deadline); + break; + case "E": + String event = parsedLine[2] + " /at " + parsedLine[3]; + addEvent(tasks, event); + break; + default: + throw new DukeException(); + } + switch (parsedLine[1]) { + case "1": + markTask(tasks, numberOfLine); + break; + case "0": + unmarkTask(tasks, numberOfLine); + break; + default: + throw new DukeException(); + } + } + } catch (ArrayIndexOutOfBoundsException | DukeException | FileNotFoundException e) { + throw new DukeException(); + } + Ui.showMessage(" Congrats! Your previous tasks have been loaded."); + return tasks; + } + + public void write(ArrayList tasks) throws IOException { + FileWriter fw = new FileWriter(this.filePath); + for (int i = 0; i < tasks.size(); i++) { + String line = ""; + switch (tasks.get(i).getClass().getSimpleName()) { + case "Todo": + line = line + "T | "; + break; + case "Deadline": + line = line + "D | "; + break; + case "Event": + line = line + "E | "; + break; + } + switch (tasks.get(i).getStatusIcon()) { + case "X": + line = line + "1 | "; + break; + case " ": + line = line + "0 | "; + break; + } + line = line + tasks.get(i).getDescription(); + switch (tasks.get(i).getClass().getSimpleName()) { + case "Deadline": + Deadline d = (Deadline) tasks.get(i); + DateTimeFormatter formatter = DateTimeFormatter.ofPattern("yyyy-MM-dd HHmm"); + line = line + " | " + d.getBy().format(formatter); + break; + case "Event": + Event e = (Event) tasks.get(i); + line = line + " | " + e.getAt(); + break; + } + line = line + System.lineSeparator(); + fw.write(line); + } + fw.close(); + } +} diff --git a/src/main/java/duke/task/Deadline.java b/src/main/java/duke/task/Deadline.java new file mode 100644 index 0000000000..3e77f746c1 --- /dev/null +++ b/src/main/java/duke/task/Deadline.java @@ -0,0 +1,55 @@ +package duke.task; + +import java.time.LocalDateTime; +import java.time.format.DateTimeFormatter; +import java.time.format.DateTimeParseException; + +//public class Deadline extends Task { +// +// protected String by; +// +// public Deadline(String description, String by) { +// super(description); +// this.by = by; +// } +// +// public String getBy() { +// return by; +// } +// +// @Override +// public String getTaskSymbol() { +// return "D"; +// } +// +// @Override +// public String toString() { +// return + super.toString() + " (by: " + by + ")"; +// } +//} + + +public class Deadline extends Task { + private LocalDateTime by; + + public Deadline(String description, String by) throws DateTimeParseException { + super(description); + DateTimeFormatter formatter = DateTimeFormatter.ofPattern("yyyy-MM-dd HHmm"); + this.by = LocalDateTime.parse(by, formatter); + } + + public LocalDateTime getBy() { + return this.by; + } + + @Override + public String getTaskSymbol() { + return "D"; + } + + @Override + public String toString() { + DateTimeFormatter formatter = DateTimeFormatter.ofPattern("MMM dd yyyy HH:mm"); + return "[" + getTaskSymbol() + "]" + super.toString() + " (by: " + by.format(formatter) + ")"; + } +} \ No newline at end of file diff --git a/src/main/java/Event.java b/src/main/java/duke/task/Event.java similarity index 60% rename from src/main/java/Event.java rename to src/main/java/duke/task/Event.java index fa545aa009..02ce4155ee 100644 --- a/src/main/java/Event.java +++ b/src/main/java/duke/task/Event.java @@ -1,3 +1,5 @@ +package duke.task; + public class Event extends Task { protected String at; @@ -11,8 +13,13 @@ public String getAt() { return at; } + @Override + public String getTaskSymbol() { + return "E"; + } + @Override public String toString() { - return "[E]" + super.toString()+ " (at: " + at + ")"; + return "[" + getTaskSymbol() + "]" + super.toString()+ " (at: " + at + ")"; } } \ No newline at end of file diff --git a/src/main/java/duke/task/Task.java b/src/main/java/duke/task/Task.java new file mode 100644 index 0000000000..c363d6a2b2 --- /dev/null +++ b/src/main/java/duke/task/Task.java @@ -0,0 +1,25 @@ +package duke.task; + +public abstract class Task { + protected String description; + protected boolean isDone; + + public Task(String description) { + this.description = description; + this.isDone = false; + } + + public String getStatusIcon() { return (isDone ? "X" : " "); } + + public String getDescription() { + return description; + } + + public abstract String getTaskSymbol(); + + public String toString() { return "[" + getStatusIcon() + "] " + description; } + + public void setDone() { isDone = true; } + + public void setNotDone() { isDone = false; } +} \ No newline at end of file diff --git a/src/main/java/duke/task/TaskList.java b/src/main/java/duke/task/TaskList.java new file mode 100644 index 0000000000..164426a615 --- /dev/null +++ b/src/main/java/duke/task/TaskList.java @@ -0,0 +1,303 @@ +package duke.task; + +import duke.exception.DukeException; + +import java.util.ArrayList; +import java.util.regex.Pattern; +import java.util.regex.Matcher; + +public class TaskList { + private final ArrayList tasks; + + public void add(Task task) { + tasks.add(task); + } + public TaskList() { + this.tasks = new ArrayList<>(); + } + + public TaskList(ArrayList tasks) { + this.tasks = tasks; + } + + /** + * Show the adding message of the newly added task. + * + * @param task the new added task. + * @param tasksSize the size of taskList. + */ + public static void printNewTask(Task task, int tasksSize) { + System.out.println(" Got it. I've added this task:"); + System.out.println(" " + task); + System.out.println(" Now you have " + tasksSize + " tasks in the list."); + } + + + public static void printTaskList(ArrayList tasks) { + System.out.println(" Here are the tasks in your list:"); + for (int i = 0; i < tasks.size(); i++) { + System.out.println(" " + (i + 1) + "." + tasks.get(i)); + } + } + + /** + * Show the mark message of the newly marked task. + * + * @param task the new marked task. + */ + public static void printMark(Task task) { + System.out.println(" Nice! I've marked this task as done:"); + System.out.println(" " + task); + } + + /** + * Show the unmark message of the newly unmarked task. + * + * @param task the new unmarked task. + */ + public static void printUnmark(Task task) { + System.out.println(" OK, I've marked this task as not done yet:"); + System.out.println(" " + task); + } + + /** + * Try to add an event, dealing with all the exceptions then adding. + * + * @param tasks the taskList. + * @param statement the description and time of the event. + */ + public static void tryAddEvent(ArrayList tasks, String statement) { + try { + if (statement.equals("")) { + throw new DukeException(); + } + if (!statement.contains(" /at ")) { + throw new DukeException(); + } + addEvent(tasks, statement); + int eventId = tasks.size() - 1; + printNewTask(tasks.get(eventId), tasks.size()); + } catch (DukeException e) { + System.out.println(" T_T OOPS!!! The statement of the event is not correct."); + } + } + + /** + * Directly add an event, having dealt with the exception before. + * + * @param tasks the taskList. + * @param statement the description and time of the event. + */ + public static void addEvent(ArrayList tasks, String statement) { + String[] descriptionAt = statement.split("\\s+/at\\s+"); + String eventDescription = descriptionAt[0]; + String at = descriptionAt[1]; + Event newEvent = new Event(eventDescription, at); + tasks.add(newEvent); + } + + /** + * Try to add a deadline, dealing with all the exceptions then adding. + * + * @param tasks the taskList. + * @param statement the description and time of the deadline. + */ + public static void tryAddDeadline(ArrayList tasks, String statement) { + try { + if (statement.equals("")) { + throw new DukeException(); + } + if (!statement.contains(" /by ")) { + throw new DukeException(); + } + addDeadline(tasks, statement); + int deadlineId = tasks.size() - 1; + printNewTask(tasks.get(deadlineId), tasks.size()); + } catch (DukeException e) { + System.out.println(" T_T OOPS!!! The statement of the deadline is not correct."); + } + } + + /** + * Directly add a deadline, having dealt with the exception before. + * + * @param tasks the taskList. + * @param statement the description and time of the deadline. + */ + public static void addDeadline(ArrayList tasks, String statement) { + String[] descriptionBy = statement.split("\\s+/by\\s+"); + String deadlineDescription = descriptionBy[0]; + String by = descriptionBy[1]; + Deadline newDeadline = new Deadline(deadlineDescription, by); + tasks.add(newDeadline); + } + + /** + * Try to add a todoTask, dealing with all the exceptions then adding. + * + * @param tasks the taskList. + * @param statement the description of todoTask. + */ + public static void tryAddTodo(ArrayList tasks, String statement) { + try { + if (statement.equals("")) { + throw new DukeException(); + } + addTodo(tasks, statement); + int todoId = tasks.size() - 1; + printNewTask(tasks.get(todoId), tasks.size()); + } catch (DukeException e) { + System.out.println(" T_T OOPS!!! The description of a todo cannot be empty."); + } + } + + /** + * Directly add an todoTask, having dealt with the exception before. + * + * @param tasks the taskList. + * @param statement the description of todoTask. + */ + public static void addTodo(ArrayList tasks, String statement) { + Todo newTodo = new Todo(statement); + tasks.add(newTodo); + } + + /** + * Try to mark a task, dealing with all the exceptions then mark. + * + * @param tasks the taskList. + * @param id the unprocessed markId. + */ + public static void tryMarkTask(ArrayList tasks, String id) { + try { + if (id.equals("")) { + throw new DukeException(); + } + if (!isInteger(id)) { + throw new DukeException(); + } + int markId = Integer.parseInt(id); + if ((markId > tasks.size()) || (markId <= 0)) { + throw new DukeException(); + } + markTask(tasks, markId); + printUnmark(tasks.get(markId - 1)); + } catch (DukeException e) { + System.out.println(" T_T OOPS!!! Please input the mark id again."); + } + } + + /** + * Directly mark a task, having dealt with the exception before. + * + * @param tasks the taskList. + * @param markId the ID of the mark task. + */ + public static void markTask(ArrayList tasks, int markId) { + markId = markId - 1; + tasks.get(markId).setDone(); + } + + /** + * Try to unmark a task, dealing with all the exceptions then unmark. + * + * @param tasks the taskList. + * @param id the unprocessed unmarkId. + */ + public static void tryUnmarkTask(ArrayList tasks, String id) { + try { + if (id.equals("")) { + throw new DukeException(); + } + if (!isInteger(id)) { + throw new DukeException(); + } + int unmarkId = Integer.parseInt(id); + if ((unmarkId > tasks.size()) || (unmarkId <= 0)) { + throw new DukeException(); + } + unmarkTask(tasks, unmarkId); + printUnmark(tasks.get(unmarkId - 1)); + } catch (DukeException e) { + System.out.println(" T_T OOPS!!! Please input the unmark id again."); + } + } + + /** + * Directly unmark a task, having dealt with the exception before. + * + * @param tasks the taskList. + * @param unmarkId the ID of the unmark task. + */ + public static void unmarkTask(ArrayList tasks, int unmarkId) { + unmarkId = unmarkId - 1; + tasks.get(unmarkId).setNotDone(); + } + + /** + * Try to delete a task, dealing with all the exceptions then delete. + * + * @param tasks the taskList. + * @param id the unprocessed deleteId. + */ + public static void tryDeleteTask(ArrayList tasks, String id) { + try { + if (id.equals("")) { + throw new DukeException(); + } + if (!isInteger(id)) { + throw new DukeException(); + } + int deleteId = Integer.parseInt(id); + if ((deleteId > tasks.size()) || (deleteId <= 0)) { + throw new DukeException(); + } + deleteTask(tasks, deleteId - 1); + } catch (DukeException e) { + System.out.println(" T_T OOPS!!! Please input the delete id again."); + } + } + + /** + * Directly delete a task, having dealt with the exception before. + * + * @param tasks the taskList. + * @param deleteId the id of the task to be deleted. + */ + private static void deleteTask(ArrayList tasks, int deleteId) { + System.out.println(" Noted. I've removed this task:"); + System.out.println(" " + tasks.get(deleteId)); + System.out.println(" Now you have " + (tasks.size() - 1) + " tasks in the list."); + tasks.remove(deleteId); + } + + public static void findTask(ArrayList tasks, String statement) { + TaskList result = new TaskList(); + for (Task task : tasks) { + if (task.getDescription().contains(statement)) { + result.add(task); + } + } + if (result.getTasks().size() == 0) { + System.out.println(" Sorry, no matching tasks."); + } else { + System.out.println(" Here are the matching tasks in your list:"); + for (int i = 0; i < result.getTasks().size(); i++) { + System.out.println(" " + (i + 1) + "." + result.getTasks().get(i)); + } + } + } + + public ArrayList getTasks() { + return tasks; + } + + public static boolean isInteger(String str){ + Pattern pattern = Pattern.compile("[0-9]*"); + Matcher isNum = pattern.matcher(str); + if( !isNum.matches() ){ + return false; + } + return true; + } +} diff --git a/src/main/java/duke/task/Todo.java b/src/main/java/duke/task/Todo.java new file mode 100644 index 0000000000..8c44c81ebe --- /dev/null +++ b/src/main/java/duke/task/Todo.java @@ -0,0 +1,18 @@ +package duke.task; + +public class Todo extends Task { + + public Todo(String description) { + super(description); + } + + @Override + public String getTaskSymbol() { + return "T"; + } + + @Override + public String toString() { + return "[" + getTaskSymbol() + "]" + super.toString(); + } +} \ No newline at end of file diff --git a/src/main/java/duke/ui/Ui.java b/src/main/java/duke/ui/Ui.java new file mode 100644 index 0000000000..3d17bddd9e --- /dev/null +++ b/src/main/java/duke/ui/Ui.java @@ -0,0 +1,55 @@ +package duke.ui; + + +import java.util.Scanner; + +public class Ui { + public static final String HORIZONTAL_LINE = " ____________________________________________________________"; + + /** + * Show the horizontal divider line. + */ + public static void showLine() { + System.out.println(HORIZONTAL_LINE); + } + + /** + * Show the loading error of the file that stores the tasks, which may not exist. + */ + public void showLoadingError() { + showMessage(" Load failed! Please put the formatted file \"tasks.txt\" in the path"); + } + + + /** + * Show welcome message to the user. + */ + public static void showWelcome() { + showMessage(" Hello! I'm Duke\n" + + " What can I do for you?"); + } + + /** + * Formatting the output message, adding divider line above and below. + * + * @param message the message that needs to be formatted and shown. + */ + public static void showMessage(String message) { + showLine(); + System.out.println(message); + showLine(); + } + + public static void showError(String message) { + if (message == null) { + System.out.println(" T_T OOPS!!! I'm sorry, but I don't know what that means :-("); + } else { + System.out.println(message); + } + } + + public String readCommand() { + Scanner in = new Scanner(System.in); + return in.nextLine(); + } +} diff --git a/suggestions/lab4.java b/suggestions/lab4.java new file mode 100644 index 0000000000..abf2cbea88 --- /dev/null +++ b/suggestions/lab4.java @@ -0,0 +1,16 @@ +class A { + private int x; + public static A zeroValueA = new A(0); + + private A(int x){ + this.x = x; + } + + public static A construct(int x) { + if (x == 0) { + return A.zeroValueA; + } else { + return A(x); + } + } +} From e45bae81bc2bca1190407638bac007ea5e4dbf60 Mon Sep 17 00:00:00 2001 From: alextang809 Date: Wed, 19 Apr 2023 17:24:46 +0800 Subject: [PATCH 24/27] Add stream --- src/main/java/duke/task/TaskList.java | 17 ++++++++--------- 1 file changed, 8 insertions(+), 9 deletions(-) diff --git a/src/main/java/duke/task/TaskList.java b/src/main/java/duke/task/TaskList.java index 164426a615..0219cd2bbe 100644 --- a/src/main/java/duke/task/TaskList.java +++ b/src/main/java/duke/task/TaskList.java @@ -5,6 +5,7 @@ import java.util.ArrayList; import java.util.regex.Pattern; import java.util.regex.Matcher; +import java.util.stream.Collectors; public class TaskList { private final ArrayList tasks; @@ -272,18 +273,16 @@ private static void deleteTask(ArrayList tasks, int deleteId) { } public static void findTask(ArrayList tasks, String statement) { - TaskList result = new TaskList(); - for (Task task : tasks) { - if (task.getDescription().contains(statement)) { - result.add(task); - } - } - if (result.getTasks().size() == 0) { + ArrayList result = (ArrayList) tasks.stream() + .filter(task -> task.getDescription().contains(statement)) + .collect(Collectors.toList()); + + if (result.isEmpty()) { System.out.println(" Sorry, no matching tasks."); } else { System.out.println(" Here are the matching tasks in your list:"); - for (int i = 0; i < result.getTasks().size(); i++) { - System.out.println(" " + (i + 1) + "." + result.getTasks().get(i)); + for (int i = 0; i < result.size(); i++) { + System.out.println(" " + (i + 1) + "." + result.get(i)); } } } From e76dc751415f16a7f0750faee326596ce542da1a Mon Sep 17 00:00:00 2001 From: alextang809 Date: Wed, 19 Apr 2023 18:12:21 +0800 Subject: [PATCH 25/27] Change setDone to default --- src/main/java/duke/task/Task.java | 4 +++- 1 file changed, 3 insertions(+), 1 deletion(-) diff --git a/src/main/java/duke/task/Task.java b/src/main/java/duke/task/Task.java index c363d6a2b2..301752fc3f 100644 --- a/src/main/java/duke/task/Task.java +++ b/src/main/java/duke/task/Task.java @@ -19,7 +19,9 @@ public String getDescription() { public String toString() { return "[" + getStatusIcon() + "] " + description; } - public void setDone() { isDone = true; } + public void setDone() { + this.isDone = true; + } public void setNotDone() { isDone = false; } } \ No newline at end of file From 931245cd2efc37e1b0a2b9d8e2d503e3a2c9bdfd Mon Sep 17 00:00:00 2001 From: alextang809 Date: Sat, 22 Apr 2023 19:15:36 +0800 Subject: [PATCH 26/27] Add gradle, update Time and Deadline format --- build.gradle | 19 ++ data/tasks.txt | 1 + .../dependencies-accessors.lock | Bin 0 -> 17 bytes .../7.1/dependencies-accessors/gc.properties | 0 .../7.1/executionHistory/executionHistory.bin | Bin 0 -> 19562 bytes .../executionHistory/executionHistory.lock | Bin 0 -> 17 bytes .../.gradle/7.1/fileChanges/last-build.bin | Bin 0 -> 1 bytes .../.gradle/7.1/fileHashes/fileHashes.bin | Bin 0 -> 18697 bytes .../.gradle/7.1/fileHashes/fileHashes.lock | Bin 0 -> 17 bytes dukeChatBox/.gradle/7.1/gc.properties | 0 .../buildOutputCleanup.lock | Bin 0 -> 17 bytes .../buildOutputCleanup/cache.properties | 2 + .../buildOutputCleanup/outputFiles.bin | Bin 0 -> 18695 bytes dukeChatBox/.gradle/checksums/checksums.lock | Bin 0 -> 17 bytes dukeChatBox/.gradle/vcs-1/gc.properties | 0 dukeChatBox/.idea/.gitignore | 3 + dukeChatBox/.idea/compiler.xml | 6 + dukeChatBox/.idea/gradle.xml | 17 + dukeChatBox/.idea/jarRepositories.xml | 20 ++ dukeChatBox/.idea/misc.xml | 7 + dukeChatBox/.idea/runConfigurations.xml | 10 + dukeChatBox/.idea/vcs.xml | 6 + dukeChatBox/.idea/workspace.xml | 83 +++++ dukeChatBox/build.gradle | 19 ++ dukeChatBox/gradle/wrapper/gradle-wrapper.jar | Bin 0 -> 59536 bytes .../gradle/wrapper/gradle-wrapper.properties | 5 + dukeChatBox/gradlew | 185 +++++++++++ dukeChatBox/gradlew.bat | 89 ++++++ dukeChatBox/settings.gradle | 2 + dukeChatBox/src/main/java/duke/Duke.java | 87 +++++ .../main/java/duke/command/ByeCommand.java | 33 ++ .../src/main/java/duke/command/Command.java | 54 ++++ .../java/duke/command/DeadlineCommand.java | 34 ++ .../main/java/duke/command/DeleteCommand.java | 34 ++ .../main/java/duke/command/EventCommand.java | 33 ++ .../main/java/duke/command/FindCommand.java | 31 ++ .../main/java/duke/command/ListCommand.java | 28 ++ .../main/java/duke/command/MarkCommand.java | 35 ++ .../main/java/duke/command/TodoCommand.java | 40 +++ .../main/java/duke/command/UnmarkCommand.java | 34 ++ .../src/main/java/duke/efficiency_command.txt | 13 + .../java/duke/exception/DukeException.java | 9 + .../src/main/java/duke/parser/Parser.java | 65 ++++ .../src/main/java/duke/storage/Storage.java | 111 +++++++ .../src/main/java/duke/task/Deadline.java | 55 ++++ .../src/main/java/duke/task/Event.java | 25 ++ dukeChatBox/src/main/java/duke/task/Task.java | 27 ++ .../src/main/java/duke/task/TaskList.java | 302 ++++++++++++++++++ dukeChatBox/src/main/java/duke/task/Todo.java | 18 ++ dukeChatBox/src/main/java/duke/ui/Ui.java | 55 ++++ settings.gradle | 2 + src/main/java/duke/Duke.java | 15 +- .../java/duke/command/DeadlineCommand.java | 3 + src/main/java/duke/task/Deadline.java | 2 +- src/main/java/duke/task/TaskList.java | 3 +- 55 files changed, 1617 insertions(+), 5 deletions(-) create mode 100644 build.gradle create mode 100644 data/tasks.txt create mode 100644 dukeChatBox/.gradle/7.1/dependencies-accessors/dependencies-accessors.lock create mode 100644 dukeChatBox/.gradle/7.1/dependencies-accessors/gc.properties create mode 100644 dukeChatBox/.gradle/7.1/executionHistory/executionHistory.bin create mode 100644 dukeChatBox/.gradle/7.1/executionHistory/executionHistory.lock create mode 100644 dukeChatBox/.gradle/7.1/fileChanges/last-build.bin create mode 100644 dukeChatBox/.gradle/7.1/fileHashes/fileHashes.bin create mode 100644 dukeChatBox/.gradle/7.1/fileHashes/fileHashes.lock create mode 100644 dukeChatBox/.gradle/7.1/gc.properties create mode 100644 dukeChatBox/.gradle/buildOutputCleanup/buildOutputCleanup.lock create mode 100644 dukeChatBox/.gradle/buildOutputCleanup/cache.properties create mode 100644 dukeChatBox/.gradle/buildOutputCleanup/outputFiles.bin create mode 100644 dukeChatBox/.gradle/checksums/checksums.lock create mode 100644 dukeChatBox/.gradle/vcs-1/gc.properties create mode 100644 dukeChatBox/.idea/.gitignore create mode 100644 dukeChatBox/.idea/compiler.xml create mode 100644 dukeChatBox/.idea/gradle.xml create mode 100644 dukeChatBox/.idea/jarRepositories.xml create mode 100644 dukeChatBox/.idea/misc.xml create mode 100644 dukeChatBox/.idea/runConfigurations.xml create mode 100644 dukeChatBox/.idea/vcs.xml create mode 100644 dukeChatBox/.idea/workspace.xml create mode 100644 dukeChatBox/build.gradle create mode 100644 dukeChatBox/gradle/wrapper/gradle-wrapper.jar create mode 100644 dukeChatBox/gradle/wrapper/gradle-wrapper.properties create mode 100755 dukeChatBox/gradlew create mode 100644 dukeChatBox/gradlew.bat create mode 100644 dukeChatBox/settings.gradle create mode 100644 dukeChatBox/src/main/java/duke/Duke.java create mode 100644 dukeChatBox/src/main/java/duke/command/ByeCommand.java create mode 100644 dukeChatBox/src/main/java/duke/command/Command.java create mode 100644 dukeChatBox/src/main/java/duke/command/DeadlineCommand.java create mode 100644 dukeChatBox/src/main/java/duke/command/DeleteCommand.java create mode 100644 dukeChatBox/src/main/java/duke/command/EventCommand.java create mode 100644 dukeChatBox/src/main/java/duke/command/FindCommand.java create mode 100644 dukeChatBox/src/main/java/duke/command/ListCommand.java create mode 100644 dukeChatBox/src/main/java/duke/command/MarkCommand.java create mode 100644 dukeChatBox/src/main/java/duke/command/TodoCommand.java create mode 100644 dukeChatBox/src/main/java/duke/command/UnmarkCommand.java create mode 100644 dukeChatBox/src/main/java/duke/efficiency_command.txt create mode 100644 dukeChatBox/src/main/java/duke/exception/DukeException.java create mode 100644 dukeChatBox/src/main/java/duke/parser/Parser.java create mode 100644 dukeChatBox/src/main/java/duke/storage/Storage.java create mode 100644 dukeChatBox/src/main/java/duke/task/Deadline.java create mode 100644 dukeChatBox/src/main/java/duke/task/Event.java create mode 100644 dukeChatBox/src/main/java/duke/task/Task.java create mode 100644 dukeChatBox/src/main/java/duke/task/TaskList.java create mode 100644 dukeChatBox/src/main/java/duke/task/Todo.java create mode 100644 dukeChatBox/src/main/java/duke/ui/Ui.java create mode 100644 settings.gradle diff --git a/build.gradle b/build.gradle new file mode 100644 index 0000000000..9e476279dc --- /dev/null +++ b/build.gradle @@ -0,0 +1,19 @@ +plugins { + id 'java' +} + +group 'org.example' +version '1.0-SNAPSHOT' + +repositories { + mavenCentral() +} + +dependencies { + testImplementation 'org.junit.jupiter:junit-jupiter-api:5.7.0' + testRuntimeOnly 'org.junit.jupiter:junit-jupiter-engine:5.7.0' +} + +test { + useJUnitPlatform() +} \ No newline at end of file diff --git a/data/tasks.txt b/data/tasks.txt new file mode 100644 index 0000000000..2d8a1dee0f --- /dev/null +++ b/data/tasks.txt @@ -0,0 +1 @@ +T | 0 | CS2103T 05-20 diff --git a/dukeChatBox/.gradle/7.1/dependencies-accessors/dependencies-accessors.lock b/dukeChatBox/.gradle/7.1/dependencies-accessors/dependencies-accessors.lock new file mode 100644 index 0000000000000000000000000000000000000000..2409dd2650b5675a70d6703aa8c02bbdcfdad5a2 GIT binary patch literal 17 ScmZR6%B0w=)p0tO0SW*rDg$W% literal 0 HcmV?d00001 diff --git a/dukeChatBox/.gradle/7.1/dependencies-accessors/gc.properties b/dukeChatBox/.gradle/7.1/dependencies-accessors/gc.properties new file mode 100644 index 0000000000..e69de29bb2 diff --git a/dukeChatBox/.gradle/7.1/executionHistory/executionHistory.bin b/dukeChatBox/.gradle/7.1/executionHistory/executionHistory.bin new file mode 100644 index 0000000000000000000000000000000000000000..e47fb81ee0c71a6184cd0b0074b30ae8815eeeeb GIT binary patch literal 19562 zcmeI%L1@!Z7zgmAtuRGdcM!@15t)MEl6G6$Z3wd3={B9py1FT7Ow+d|Yu3h>WYyhd zJ8W*u?czm{i8xR}4}!O$w{D8a1VPb5@!&x`DIRu^nKTXCz(ZjkME-#!kG#C^d*3fF zxg^do0smTgW7fCb>rJ#E009U<00Izz00bZa0SG_<0uX=z1Rwwb2tWV=5cppNl2#!* zoMHlpJ$9oy&oIHAR)Y;nd-^@Q7VbFR9c}La1NUrQKjie`2muH{00Izz00bZa0SG_< z0uX=z1Rwwb2tWV=5P$##AOHafKmY;|fB*y_009U<00Izz00bZa0SG_<0uX?}zaY@a zFur}(9_2=BAQ`BucSt4RMj#WB06(rA23gHbdVdQVp=7fs41Kw>KUEO zQ&H0h<@%hn5GPWOiUvvhzjD8>UsyU={CKgeI$!(#yl2Z1m;x)rOhrv6B&ukJP$y6` zD@bZiHz^6#xvd5vNE*`N5Q&DGTf(VOs;N;T15Lr^#$YHIji#iK|I6^(rZxG}@{j1Y zA!CwGR85Oil9dq>6LnJcxROfi&WeU?-#&Mur!9V}T}UR{dxVZN-R*8H`v&h!8Hi6S zx}ne6N2;VuL&;_TMy^c(|B&$3#)Ju3YzRjZ<}kBqSnoBBR6VPx=JN8u@`*Y>w_SUf@ z@s+iwt2btsSA(y1`zD4&dR$Qn`+}_`9Pd8G@`T-0Z$)AJEz^bhYyggMNYVp zBZc%PNl9-jUp1kzqem+&*%C^g)o9uy+m!b)ve{}h7kQNa`2U6nd664xlz3y ze{%mHyk*np*^k(g&ez;LFn>F}(sZ_`^P-!l#A)UG)r#nR)Xm*f=Bw%*PXrJ^009IL zKmY**5I_I{1Q0*~0R#|0009ILKmY**5I_I{1Q0*~0R#|0009ILKmY**5I_I{1Q7U( zz@RMm$ldAeV6Nl|%~Y((<{@)9YE@5!@NDgNH*Bge_;2Ld_q!3^zA7a4&Cv35I5}mk zAE|~ft{U(8`i33%+Mo7f$3^mRqWv;c){QaM5ZCpMk(c5@y6bNCac;pZGB|F2*8Ge7_v08KImDF6Tf literal 0 HcmV?d00001 diff --git a/dukeChatBox/.gradle/7.1/gc.properties b/dukeChatBox/.gradle/7.1/gc.properties new file mode 100644 index 0000000000..e69de29bb2 diff --git a/dukeChatBox/.gradle/buildOutputCleanup/buildOutputCleanup.lock b/dukeChatBox/.gradle/buildOutputCleanup/buildOutputCleanup.lock new file mode 100644 index 0000000000000000000000000000000000000000..ac005ab048942a8a75dce75a1175c9de5b0499c5 GIT binary patch literal 17 TcmZQ}aNMgiyT*r|0Rs2{B!U9w literal 0 HcmV?d00001 diff --git a/dukeChatBox/.gradle/buildOutputCleanup/cache.properties b/dukeChatBox/.gradle/buildOutputCleanup/cache.properties new file mode 100644 index 0000000000..1f46a5a41b --- /dev/null +++ b/dukeChatBox/.gradle/buildOutputCleanup/cache.properties @@ -0,0 +1,2 @@ +#Wed Apr 19 18:51:26 SGT 2023 +gradle.version=7.1 diff --git a/dukeChatBox/.gradle/buildOutputCleanup/outputFiles.bin b/dukeChatBox/.gradle/buildOutputCleanup/outputFiles.bin new file mode 100644 index 0000000000000000000000000000000000000000..60a0f87d09cce93a090708286be85c296dca01e9 GIT binary patch literal 18695 zcmeI%ze@sP7{Kw@gs6Iam&XH3YVWz1KZY5^X^c@jZCod-=W`ckgGtDPuzYExAnl8f-6FA%Fk^2q1s} z0tg_000IagfB*srAbXj*zfdvNh~CewAgBmG|c{L#kJbn>PweO-IpoHXC6&ZP7S?b*i*=lo$e zAbnfA-i`4Mdwa|XAb1N{+~H1rUy2RCRDSlZ?@xV{cj@-17ytkO literal 0 HcmV?d00001 diff --git a/dukeChatBox/.gradle/checksums/checksums.lock b/dukeChatBox/.gradle/checksums/checksums.lock new file mode 100644 index 0000000000000000000000000000000000000000..8ca705452aaae0f711a04e5d4b9860c63f4513d6 GIT binary patch literal 17 ScmZS1;i!Jr=hXj>0SW*yRs<#h literal 0 HcmV?d00001 diff --git a/dukeChatBox/.gradle/vcs-1/gc.properties b/dukeChatBox/.gradle/vcs-1/gc.properties new file mode 100644 index 0000000000..e69de29bb2 diff --git a/dukeChatBox/.idea/.gitignore b/dukeChatBox/.idea/.gitignore new file mode 100644 index 0000000000..26d33521af --- /dev/null +++ b/dukeChatBox/.idea/.gitignore @@ -0,0 +1,3 @@ +# Default ignored files +/shelf/ +/workspace.xml diff --git a/dukeChatBox/.idea/compiler.xml b/dukeChatBox/.idea/compiler.xml new file mode 100644 index 0000000000..fb7f4a8a46 --- /dev/null +++ b/dukeChatBox/.idea/compiler.xml @@ -0,0 +1,6 @@ + + + + + + \ No newline at end of file diff --git a/dukeChatBox/.idea/gradle.xml b/dukeChatBox/.idea/gradle.xml new file mode 100644 index 0000000000..bbcf987636 --- /dev/null +++ b/dukeChatBox/.idea/gradle.xml @@ -0,0 +1,17 @@ + + + + + + \ No newline at end of file diff --git a/dukeChatBox/.idea/jarRepositories.xml b/dukeChatBox/.idea/jarRepositories.xml new file mode 100644 index 0000000000..fdc392fe87 --- /dev/null +++ b/dukeChatBox/.idea/jarRepositories.xml @@ -0,0 +1,20 @@ + + + + + + + + + + + \ No newline at end of file diff --git a/dukeChatBox/.idea/misc.xml b/dukeChatBox/.idea/misc.xml new file mode 100644 index 0000000000..65f8b8ed08 --- /dev/null +++ b/dukeChatBox/.idea/misc.xml @@ -0,0 +1,7 @@ + + + + + + + \ No newline at end of file diff --git a/dukeChatBox/.idea/runConfigurations.xml b/dukeChatBox/.idea/runConfigurations.xml new file mode 100644 index 0000000000..797acea53e --- /dev/null +++ b/dukeChatBox/.idea/runConfigurations.xml @@ -0,0 +1,10 @@ + + + + + + \ No newline at end of file diff --git a/dukeChatBox/.idea/vcs.xml b/dukeChatBox/.idea/vcs.xml new file mode 100644 index 0000000000..6c0b863585 --- /dev/null +++ b/dukeChatBox/.idea/vcs.xml @@ -0,0 +1,6 @@ + + + + + + \ No newline at end of file diff --git a/dukeChatBox/.idea/workspace.xml b/dukeChatBox/.idea/workspace.xml new file mode 100644 index 0000000000..4d9fa6a5d9 --- /dev/null +++ b/dukeChatBox/.idea/workspace.xml @@ -0,0 +1,83 @@ + + + + + + + + + + + + + + + + + + + + + + + +