From af7e8f9496e905b5187326f5dd43e1e77acb5a3a Mon Sep 17 00:00:00 2001 From: andrea-twl Date: Sun, 31 Jan 2021 17:11:34 +0800 Subject: [PATCH 01/23] Level 1 complete --- src/com/jetbrains/Duke.java | 24 ++++++++++++++++++++++++ 1 file changed, 24 insertions(+) create mode 100644 src/com/jetbrains/Duke.java diff --git a/src/com/jetbrains/Duke.java b/src/com/jetbrains/Duke.java new file mode 100644 index 0000000000..94e424485e --- /dev/null +++ b/src/com/jetbrains/Duke.java @@ -0,0 +1,24 @@ +package com.jetbrains; + +import java.util.Scanner; + +public class Duke { + public static void main(String[] args) { + String logo = " ____ _ \n" + + "| _ \\ _ _| | _____ \n" + + "| | | | | | | |/ / _ \\\n" + + "| |_| | |_| | < __/\n" + + "|____/ \\__,_|_|\\_\\___|\n"; + System.out.println(logo); + System.out.println("Hello! I'm Duke! \n " + + "Talk to me. \n" + + "********************************"); + Scanner sc = new Scanner(System.in); + String input = sc.next(); + while (!input.equals("bye")) { + System.out.println("Duke: " + input + "\n"); + input = sc.next(); + } + System.out.println("Bye! Come back soon!"); + } +} From c62122005709a80d02b4fb4993238d3d76086015 Mon Sep 17 00:00:00 2001 From: andrea-twl Date: Sun, 31 Jan 2021 17:37:38 +0800 Subject: [PATCH 02/23] Level-2 complete --- src/com/jetbrains/Duke.java | 21 ++++++++++++++++++--- 1 file changed, 18 insertions(+), 3 deletions(-) diff --git a/src/com/jetbrains/Duke.java b/src/com/jetbrains/Duke.java index 94e424485e..76e3c4bc52 100644 --- a/src/com/jetbrains/Duke.java +++ b/src/com/jetbrains/Duke.java @@ -1,6 +1,7 @@ package com.jetbrains; import java.util.Scanner; +import java.util.ArrayList; public class Duke { public static void main(String[] args) { @@ -13,12 +14,26 @@ public static void main(String[] args) { System.out.println("Hello! I'm Duke! \n " + "Talk to me. \n" + "********************************"); + ArrayList list = new ArrayList<>(); Scanner sc = new Scanner(System.in); - String input = sc.next(); + String input = sc.nextLine(); while (!input.equals("bye")) { - System.out.println("Duke: " + input + "\n"); - input = sc.next(); + if (input.equals("list")) { + displayList(list); + System.out.println("\n"); + } else { + list.add(input); + System.out.println("added: " + input + "\n"); + } + input = sc.nextLine(); } + sc.close(); System.out.println("Bye! Come back soon!"); } + + static void displayList(ArrayList list) { + for(int i = 0; i < list.size(); i++) { + System.out.printf("%d. %s%n",i + 1, list.get(i)); + } + } } From b3a532333cfaf3ee5f6bd4e5c60dc2d2b2b4fe52 Mon Sep 17 00:00:00 2001 From: andrea-twl Date: Sun, 31 Jan 2021 18:08:08 +0800 Subject: [PATCH 03/23] Level-3 complete --- src/com/jetbrains/Duke.java | 42 +++++++++++++++++++++++++++++++------ 1 file changed, 36 insertions(+), 6 deletions(-) diff --git a/src/com/jetbrains/Duke.java b/src/com/jetbrains/Duke.java index 76e3c4bc52..36fbc72f7b 100644 --- a/src/com/jetbrains/Duke.java +++ b/src/com/jetbrains/Duke.java @@ -12,28 +12,58 @@ public static void main(String[] args) { + "|____/ \\__,_|_|\\_\\___|\n"; System.out.println(logo); System.out.println("Hello! I'm Duke! \n " + - "Talk to me. \n" + + "What would you like to do today? \n" + "********************************"); - ArrayList list = new ArrayList<>(); + ArrayList list = new ArrayList<>(); Scanner sc = new Scanner(System.in); String input = sc.nextLine(); while (!input.equals("bye")) { if (input.equals("list")) { displayList(list); System.out.println("\n"); + } else if (input.contains("done")) { + String[] doneCommand = input.split(" "); + Task task = list.get(Integer.parseInt(doneCommand[1]) - 1); + System.out.println("Good job! I've marked this task as done:\n " + + task.markDone() + + "\n"); } else { - list.add(input); + list.add(new Task(input)); System.out.println("added: " + input + "\n"); } input = sc.nextLine(); } sc.close(); - System.out.println("Bye! Come back soon!"); + System.out.println("Bye! Stay on task!"); } - static void displayList(ArrayList list) { + static void displayList(ArrayList list) { for(int i = 0; i < list.size(); i++) { - System.out.printf("%d. %s%n",i + 1, list.get(i)); + System.out.printf("%d. %s%n",i + 1, list.get(i).toString()); + } + } +} + +class Task { + String task; + boolean isDone; + + Task(String task) { + this.task = task; + isDone = false; + } + + Task markDone() { + isDone = true; + return this; + } + + @Override + public String toString() { + if (isDone) { + return "[X] " + task; + } else { + return "[ ] " + task; } } } From 25b1d6b8687dc213d11cceadc583730c1625fa27 Mon Sep 17 00:00:00 2001 From: andrea-twl Date: Tue, 2 Feb 2021 03:17:29 +0800 Subject: [PATCH 04/23] level-4 completed (implemented ToDo.java, Deadline.java and Event.java. Also separated Task.java into another file. --- src/com/jetbrains/Deadline.java | 18 +++++++++++++++ src/com/jetbrains/Duke.java | 40 ++++++++++++--------------------- src/com/jetbrains/Event.java | 18 +++++++++++++++ src/com/jetbrains/Task.java | 28 +++++++++++++++++++++++ src/com/jetbrains/ToDo.java | 12 ++++++++++ 5 files changed, 90 insertions(+), 26 deletions(-) create mode 100644 src/com/jetbrains/Deadline.java create mode 100644 src/com/jetbrains/Event.java create mode 100644 src/com/jetbrains/Task.java create mode 100644 src/com/jetbrains/ToDo.java diff --git a/src/com/jetbrains/Deadline.java b/src/com/jetbrains/Deadline.java new file mode 100644 index 0000000000..45591163d8 --- /dev/null +++ b/src/com/jetbrains/Deadline.java @@ -0,0 +1,18 @@ +package com.jetbrains; + +public class Deadline extends Task { + String dueDate; + + Deadline(String input) { + String[] inputs = input.trim().split("/by "); + this.task = inputs[0].substring(9); + this.isDone = false; + this.dueDate = inputs[1]; + } + + @Override + public String toString() { + return String.format("DDLN%s (by: %s)" , + super.toString(), dueDate); + } +} diff --git a/src/com/jetbrains/Duke.java b/src/com/jetbrains/Duke.java index 36fbc72f7b..8ce997fdc6 100644 --- a/src/com/jetbrains/Duke.java +++ b/src/com/jetbrains/Duke.java @@ -11,9 +11,9 @@ public static void main(String[] args) { + "| |_| | |_| | < __/\n" + "|____/ \\__,_|_|\\_\\___|\n"; System.out.println(logo); - System.out.println("Hello! I'm Duke! \n " + + System.out.println("Hello! I'm Duke! \n" + "What would you like to do today? \n" + - "********************************"); + "***********************************"); ArrayList list = new ArrayList<>(); Scanner sc = new Scanner(System.in); String input = sc.nextLine(); @@ -28,8 +28,18 @@ public static void main(String[] args) { task.markDone() + "\n"); } else { - list.add(new Task(input)); - System.out.println("added: " + input + "\n"); + Task task; + if (input.contains("todo")) { + task = new ToDo(input); + } else if (input.contains("deadline")) { + task = new Deadline(input); + } else { + task = new Event(input); + } + list.add(task); + System.out.println("I'll take note! \n added: " + + task + "\nNow you have " + list.size() + + " task(s) in the list. \n" ); } input = sc.nextLine(); } @@ -44,26 +54,4 @@ static void displayList(ArrayList list) { } } -class Task { - String task; - boolean isDone; - Task(String task) { - this.task = task; - isDone = false; - } - - Task markDone() { - isDone = true; - return this; - } - - @Override - public String toString() { - if (isDone) { - return "[X] " + task; - } else { - return "[ ] " + task; - } - } -} diff --git a/src/com/jetbrains/Event.java b/src/com/jetbrains/Event.java new file mode 100644 index 0000000000..faaedfd862 --- /dev/null +++ b/src/com/jetbrains/Event.java @@ -0,0 +1,18 @@ +package com.jetbrains; + +public class Event extends Task { + String eventDate; + + Event(String input) { + String[] inputs = input.trim().split("/at "); + this.task = inputs[0].substring(6); + this.isDone = false; + this.eventDate = inputs[1]; + } + + @Override + public String toString() { + return String.format("EVNT%s (at: %s)" , + super.toString(), eventDate); + } +} diff --git a/src/com/jetbrains/Task.java b/src/com/jetbrains/Task.java new file mode 100644 index 0000000000..a2c961a1c4 --- /dev/null +++ b/src/com/jetbrains/Task.java @@ -0,0 +1,28 @@ +package com.jetbrains; + +class Task { + String task; + boolean isDone; + + Task() { + } + + Task(String task) { + this.task = task; + isDone = false; + } + + Task markDone() { + isDone = true; + return this; + } + + @Override + public String toString() { + if (isDone) { + return "[X] " + task; + } else { + return "[ ] " + task; + } + } +} diff --git a/src/com/jetbrains/ToDo.java b/src/com/jetbrains/ToDo.java new file mode 100644 index 0000000000..5befc2e2a7 --- /dev/null +++ b/src/com/jetbrains/ToDo.java @@ -0,0 +1,12 @@ +package com.jetbrains; + +public class ToDo extends Task { + ToDo(String input) { + this.task = input.trim().substring(5); + this.isDone = false; + } + @Override + public String toString() { + return "TODO" + super.toString(); + } +} From dd45d1b311a8bba5cc63f44d51101211a29c13f5 Mon Sep 17 00:00:00 2001 From: andrea-twl Date: Wed, 3 Feb 2021 16:19:50 +0800 Subject: [PATCH 05/23] Level-5 complete (added DukeIncompleteCommandException.java and DukeInvalidCommandException.java) --- src/com/jetbrains/Deadline.java | 23 ++++++++++++----- src/com/jetbrains/Duke.java | 23 ++++++++++++----- .../DukeIncompleteCommandException.java | 18 +++++++++++++ .../DukeInvalidCommandException.java | 16 ++++++++++++ src/com/jetbrains/Event.java | 25 ++++++++++++++----- src/com/jetbrains/ToDo.java | 10 ++++++-- 6 files changed, 95 insertions(+), 20 deletions(-) create mode 100644 src/com/jetbrains/DukeIncompleteCommandException.java create mode 100644 src/com/jetbrains/DukeInvalidCommandException.java diff --git a/src/com/jetbrains/Deadline.java b/src/com/jetbrains/Deadline.java index 45591163d8..735ddf2ba2 100644 --- a/src/com/jetbrains/Deadline.java +++ b/src/com/jetbrains/Deadline.java @@ -1,18 +1,29 @@ package com.jetbrains; +import java.lang.Throwable; public class Deadline extends Task { - String dueDate; + String by; - Deadline(String input) { - String[] inputs = input.trim().split("/by "); - this.task = inputs[0].substring(9); + Deadline(String input) throws DukeIncompleteCommandException { + input = input.substring(8).trim(); + + if (input.equals("")) { + throw new DukeIncompleteCommandException(); + } + + String[] inputs = input.split("/by"); + + if (!input.contains("/by") || inputs.length < 2) { + throw new DukeIncompleteCommandException("Oh no! Please enter an due date. :P"); + } + this.task = inputs[0]; this.isDone = false; - this.dueDate = inputs[1]; + this.by = inputs[1].trim(); } @Override public String toString() { return String.format("DDLN%s (by: %s)" , - super.toString(), dueDate); + super.toString(), by); } } diff --git a/src/com/jetbrains/Duke.java b/src/com/jetbrains/Duke.java index 8ce997fdc6..651a2b5abb 100644 --- a/src/com/jetbrains/Duke.java +++ b/src/com/jetbrains/Duke.java @@ -2,6 +2,7 @@ import java.util.Scanner; import java.util.ArrayList; +import java.lang.Throwable; public class Duke { public static void main(String[] args) { @@ -18,17 +19,21 @@ public static void main(String[] args) { Scanner sc = new Scanner(System.in); String input = sc.nextLine(); while (!input.equals("bye")) { + Task task; + try { if (input.equals("list")) { displayList(list); System.out.println("\n"); } else if (input.contains("done")) { String[] doneCommand = input.split(" "); - Task task = list.get(Integer.parseInt(doneCommand[1]) - 1); + task = list.get(Integer.parseInt(doneCommand[1]) - 1); System.out.println("Good job! I've marked this task as done:\n " + task.markDone() + "\n"); - } else { - Task task; + } else if (input.contains("todo") || + input.contains("deadline") || + input.contains("event")) { + if (input.contains("todo")) { task = new ToDo(input); } else if (input.contains("deadline")) { @@ -39,10 +44,16 @@ public static void main(String[] args) { list.add(task); System.out.println("I'll take note! \n added: " + task + "\nNow you have " + list.size() + - " task(s) in the list. \n" ); + " task(s) in the list. \n"); + } else { + throw new DukeInvalidCommandException(); + } + } catch (Exception e) { + System.out.println(e.getMessage()); + } + input = sc.nextLine(); } - input = sc.nextLine(); - } + sc.close(); System.out.println("Bye! Stay on task!"); } diff --git a/src/com/jetbrains/DukeIncompleteCommandException.java b/src/com/jetbrains/DukeIncompleteCommandException.java new file mode 100644 index 0000000000..482bebf774 --- /dev/null +++ b/src/com/jetbrains/DukeIncompleteCommandException.java @@ -0,0 +1,18 @@ +package com.jetbrains; + +public class DukeIncompleteCommandException extends Exception { + public String message; + DukeIncompleteCommandException() { + this.message = "Oh no! Task cannot be empty. ):"; + } + DukeIncompleteCommandException(String message) { + this.message = message; + } + @Override + public String getMessage() { + return message; + } + public String toString() { + return message; + } +} diff --git a/src/com/jetbrains/DukeInvalidCommandException.java b/src/com/jetbrains/DukeInvalidCommandException.java new file mode 100644 index 0000000000..77887d2f24 --- /dev/null +++ b/src/com/jetbrains/DukeInvalidCommandException.java @@ -0,0 +1,16 @@ +package com.jetbrains; + +public class DukeInvalidCommandException extends Exception { + public String message = "Oh no! I don't know what that means. ):"; + DukeInvalidCommandException() { + } + + @Override + public String getMessage() { + return message; + } + + public String toString() { + return message; + } +} diff --git a/src/com/jetbrains/Event.java b/src/com/jetbrains/Event.java index faaedfd862..009f2ecbc4 100644 --- a/src/com/jetbrains/Event.java +++ b/src/com/jetbrains/Event.java @@ -1,18 +1,31 @@ package com.jetbrains; +import java.lang.Throwable; public class Event extends Task { - String eventDate; + String at; - Event(String input) { - String[] inputs = input.trim().split("/at "); - this.task = inputs[0].substring(6); + Event(String input) throws DukeIncompleteCommandException { + input = input.substring(5).trim(); + + if (input.equals("")) { + throw new DukeIncompleteCommandException(); + } + + String[] inputs = input.split("/at"); + + if (!input.contains("/at") || inputs.length < 2) { + throw new DukeIncompleteCommandException("Oh no! Please enter an event date. :P"); + } + + this.task = inputs[0]; this.isDone = false; - this.eventDate = inputs[1]; + this.at = inputs[1].trim(); } + @Override public String toString() { return String.format("EVNT%s (at: %s)" , - super.toString(), eventDate); + super.toString(), at); } } diff --git a/src/com/jetbrains/ToDo.java b/src/com/jetbrains/ToDo.java index 5befc2e2a7..f77fd58686 100644 --- a/src/com/jetbrains/ToDo.java +++ b/src/com/jetbrains/ToDo.java @@ -1,10 +1,16 @@ package com.jetbrains; +import java.lang.Throwable; public class ToDo extends Task { - ToDo(String input) { - this.task = input.trim().substring(5); + ToDo(String input) throws DukeIncompleteCommandException { + input = input.substring(4).trim(); + if (input.equals("")) { + throw new DukeIncompleteCommandException(); + } + this.task = input; this.isDone = false; } + @Override public String toString() { return "TODO" + super.toString(); From 26418a372b96dc5963a591a5387c5983b817a444 Mon Sep 17 00:00:00 2001 From: andrea-twl Date: Wed, 3 Feb 2021 16:43:57 +0800 Subject: [PATCH 06/23] Level-6 completed (added delete function) --- src/com/jetbrains/Duke.java | 67 +++++++++++++++++++++---------------- 1 file changed, 39 insertions(+), 28 deletions(-) diff --git a/src/com/jetbrains/Duke.java b/src/com/jetbrains/Duke.java index 651a2b5abb..70d47ad293 100644 --- a/src/com/jetbrains/Duke.java +++ b/src/com/jetbrains/Duke.java @@ -2,7 +2,6 @@ import java.util.Scanner; import java.util.ArrayList; -import java.lang.Throwable; public class Duke { public static void main(String[] args) { @@ -21,38 +20,50 @@ public static void main(String[] args) { while (!input.equals("bye")) { Task task; try { - if (input.equals("list")) { - displayList(list); - System.out.println("\n"); - } else if (input.contains("done")) { - String[] doneCommand = input.split(" "); - task = list.get(Integer.parseInt(doneCommand[1]) - 1); - System.out.println("Good job! I've marked this task as done:\n " + - task.markDone() + - "\n"); - } else if (input.contains("todo") || - input.contains("deadline") || - input.contains("event")) { + if (input.equals("list")) { + displayList(list); + System.out.println("\n"); + } else if (input.contains("done")) { + String[] command = input.split(" "); + task = list.get(Integer.parseInt(command[1]) - 1); + System.out.println("Good job! I've marked this task as done:\n " + + task.markDone() + + "\n"); + } else if (input.contains("delete")) { + String[] command = input.split(" "); + int index = Integer.parseInt(command[1]) - 1; + task = list.get(index); + System.out.println("Alright, I've deleted this task:\n " + + task + + "\n"); + list.remove(index); + System.out.println("Now you have " + list.size() + + " task(s) in the list. \n"); + } else if (input.contains("todo") || + input.contains("deadline") || + input.contains("event")) { - if (input.contains("todo")) { - task = new ToDo(input); - } else if (input.contains("deadline")) { - task = new Deadline(input); - } else { - task = new Event(input); - } - list.add(task); - System.out.println("I'll take note! \n added: " + - task + "\nNow you have " + list.size() + - " task(s) in the list. \n"); + if (input.contains("todo")) { + task = new ToDo(input); + } else if (input.contains("deadline")) { + task = new Deadline(input); + } else { + task = new Event(input); + } + list.add(task); + System.out.println("Alright! I've added this task: \n " + + task + "\nNow you have " + list.size() + + " task(s) in the list. \n"); } else { throw new DukeInvalidCommandException(); } - } catch (Exception e) { - System.out.println(e.getMessage()); - } - input = sc.nextLine(); + } catch (IndexOutOfBoundsException e) { + System.out.println("Oh no! This task does not exist. D:" ); + } catch (Exception e) { + System.out.println(e.getMessage()); } + input = sc.nextLine(); + } sc.close(); System.out.println("Bye! Stay on task!"); From 0a0fc473413407a1aae6025da17f5eb17fd72dec Mon Sep 17 00:00:00 2001 From: andrea-twl Date: Mon, 8 Feb 2021 16:05:34 +0800 Subject: [PATCH 07/23] Level-7 complete (save and load - added saveFile() and loadFIle(), as well as fileReader()) --- data/duke.txt | 4 + src/{com/jetbrains => duke}/Deadline.java | 25 +++++- src/{com/jetbrains => duke}/Duke.java | 77 ++++++++++++++++--- .../DukeIncompleteCommandException.java | 2 +- .../DukeInvalidCommandException.java | 2 +- src/{com/jetbrains => duke}/Event.java | 21 ++++- src/{com/jetbrains => duke}/Task.java | 14 +++- src/{com/jetbrains => duke}/ToDo.java | 17 +++- 8 files changed, 140 insertions(+), 22 deletions(-) create mode 100644 data/duke.txt rename src/{com/jetbrains => duke}/Deadline.java (50%) rename src/{com/jetbrains => duke}/Duke.java (59%) rename src/{com/jetbrains => duke}/DukeIncompleteCommandException.java (94%) rename src/{com/jetbrains => duke}/DukeInvalidCommandException.java (93%) rename src/{com/jetbrains => duke}/Event.java (58%) rename src/{com/jetbrains => duke}/Task.java (52%) rename src/{com/jetbrains => duke}/ToDo.java (53%) diff --git a/data/duke.txt b/data/duke.txt new file mode 100644 index 0000000000..c47f2967fb --- /dev/null +++ b/data/duke.txt @@ -0,0 +1,4 @@ +TODO[ ] be better at skating +EVNT[ ] skate party (at: now) +DDLN[ ] learn new skate tricks (by: 1min's time) +TODO[ ] all kinds of stuff diff --git a/src/com/jetbrains/Deadline.java b/src/duke/Deadline.java similarity index 50% rename from src/com/jetbrains/Deadline.java rename to src/duke/Deadline.java index 735ddf2ba2..48a74cf36e 100644 --- a/src/com/jetbrains/Deadline.java +++ b/src/duke/Deadline.java @@ -1,9 +1,16 @@ -package com.jetbrains; +package duke; -import java.lang.Throwable; public class Deadline extends Task { String by; + Deadline() { + + } + Deadline(boolean isDone, String task, String by) { + this.isDone = isDone; + this.task = task; + this.by = by; + } Deadline(String input) throws DukeIncompleteCommandException { input = input.substring(8).trim(); @@ -16,11 +23,23 @@ public class Deadline extends Task { if (!input.contains("/by") || inputs.length < 2) { throw new DukeIncompleteCommandException("Oh no! Please enter an due date. :P"); } - this.task = inputs[0]; + this.task = inputs[0].trim(); this.isDone = false; this.by = inputs[1].trim(); } + static Deadline fileReader(String line) { + Deadline deadline = new Deadline(); + if (line.charAt(5) == 'X') { + deadline.isDone = true; + } else { + deadline.isDone = false; + } + String[] lines = line.substring(7).trim().split("by: "); + deadline.task = lines[0].substring(0, lines[0].length() - 2).trim(); + deadline.by = lines[1].substring(0, lines[1].length() - 1); + return deadline; + } @Override public String toString() { return String.format("DDLN%s (by: %s)" , diff --git a/src/com/jetbrains/Duke.java b/src/duke/Duke.java similarity index 59% rename from src/com/jetbrains/Duke.java rename to src/duke/Duke.java index 70d47ad293..f9365595d0 100644 --- a/src/com/jetbrains/Duke.java +++ b/src/duke/Duke.java @@ -1,10 +1,17 @@ -package com.jetbrains; +package duke; import java.util.Scanner; import java.util.ArrayList; +import java.io.File; +import java.io.FileWriter; +import java.io.IOException; public class Duke { public static void main(String[] args) { + String filePath = "./data/duke.txt"; + + ArrayList list = loadFile(filePath); + String logo = " ____ _ \n" + "| _ \\ _ _| | _____ \n" + "| | | | | | | |/ / _ \\\n" @@ -14,7 +21,7 @@ public static void main(String[] args) { System.out.println("Hello! I'm Duke! \n" + "What would you like to do today? \n" + "***********************************"); - ArrayList list = new ArrayList<>(); + Scanner sc = new Scanner(System.in); String input = sc.nextLine(); while (!input.equals("bye")) { @@ -37,20 +44,15 @@ public static void main(String[] args) { task + "\n"); list.remove(index); + saveFile(filePath,list); System.out.println("Now you have " + list.size() + " task(s) in the list. \n"); } else if (input.contains("todo") || input.contains("deadline") || input.contains("event")) { - - if (input.contains("todo")) { - task = new ToDo(input); - } else if (input.contains("deadline")) { - task = new Deadline(input); - } else { - task = new Event(input); - } + task = inputToTask(input); list.add(task); + saveFile(filePath, task.toString()); System.out.println("Alright! I've added this task: \n " + task + "\nNow you have " + list.size() + " task(s) in the list. \n"); @@ -74,6 +76,61 @@ static void displayList(ArrayList list) { System.out.printf("%d. %s%n",i + 1, list.get(i).toString()); } } + static Task inputToTask(String input) throws DukeIncompleteCommandException { + Task task; + if (input.contains("todo")) { + task = new ToDo(input); + } else if (input.contains("deadline")) { + task = new Deadline(input); + } else { + task = new Event(input); + } + return task; + } + + static Task fileToTask(String input) { + return Task.fileReader(input); + } + + static ArrayList loadFile(String path) { + File f = new File(path); + ArrayList list = new ArrayList<>(); + try { + f.createNewFile(); + Scanner sc = new Scanner(f); + while (sc.hasNext()) { + try { + String line = sc.nextLine(); + Task task = fileToTask(line); + list.add(task); + } catch (Exception e) {} + } + } catch (IOException e) { + System.out.println(e.getMessage()); + } + return list; + } + + static void saveFile(String path, String input) { + try { + FileWriter fw = new FileWriter(path, true); + fw.write(input + System.lineSeparator()); + fw.close(); + } catch (IOException e) { + } + } + + static void saveFile(String path, ArrayList list) { + try { + FileWriter fw = new FileWriter(path); + for(Task t: list) { + fw.write(t.toString() + System.lineSeparator()); + } + fw.close(); + } catch (Exception e) { + System.out.println(e.getMessage()); + } + } } diff --git a/src/com/jetbrains/DukeIncompleteCommandException.java b/src/duke/DukeIncompleteCommandException.java similarity index 94% rename from src/com/jetbrains/DukeIncompleteCommandException.java rename to src/duke/DukeIncompleteCommandException.java index 482bebf774..4ef6ce6bfc 100644 --- a/src/com/jetbrains/DukeIncompleteCommandException.java +++ b/src/duke/DukeIncompleteCommandException.java @@ -1,4 +1,4 @@ -package com.jetbrains; +package duke; public class DukeIncompleteCommandException extends Exception { public String message; diff --git a/src/com/jetbrains/DukeInvalidCommandException.java b/src/duke/DukeInvalidCommandException.java similarity index 93% rename from src/com/jetbrains/DukeInvalidCommandException.java rename to src/duke/DukeInvalidCommandException.java index 77887d2f24..b3f032550a 100644 --- a/src/com/jetbrains/DukeInvalidCommandException.java +++ b/src/duke/DukeInvalidCommandException.java @@ -1,4 +1,4 @@ -package com.jetbrains; +package duke; public class DukeInvalidCommandException extends Exception { public String message = "Oh no! I don't know what that means. ):"; diff --git a/src/com/jetbrains/Event.java b/src/duke/Event.java similarity index 58% rename from src/com/jetbrains/Event.java rename to src/duke/Event.java index 009f2ecbc4..e0f9c93aa6 100644 --- a/src/com/jetbrains/Event.java +++ b/src/duke/Event.java @@ -1,9 +1,13 @@ -package com.jetbrains; +package duke; import java.lang.Throwable; public class Event extends Task { String at; + Event() { + + } + Event(String input) throws DukeIncompleteCommandException { input = input.substring(5).trim(); @@ -17,11 +21,22 @@ public class Event extends Task { throw new DukeIncompleteCommandException("Oh no! Please enter an event date. :P"); } - this.task = inputs[0]; + this.task = inputs[0].trim(); this.isDone = false; this.at = inputs[1].trim(); } - + static Event fileReader(String line) { + Event event = new Event(); + if (line.charAt(5) == 'X') { + event.isDone = true; + } else { + event.isDone = false; + } + String[] lines = line.substring(7).trim().split("at: "); + event.task = lines[0].substring(0, lines[0].length() - 2).trim(); + event.at = lines[1].substring(0, lines[1].length() - 1); + return event; + } @Override public String toString() { diff --git a/src/com/jetbrains/Task.java b/src/duke/Task.java similarity index 52% rename from src/com/jetbrains/Task.java rename to src/duke/Task.java index a2c961a1c4..1205e42280 100644 --- a/src/com/jetbrains/Task.java +++ b/src/duke/Task.java @@ -1,4 +1,4 @@ -package com.jetbrains; +package duke; class Task { String task; @@ -8,7 +8,7 @@ class Task { } Task(String task) { - this.task = task; + this.task = task.trim(); isDone = false; } @@ -17,6 +17,16 @@ Task markDone() { return this; } + static Task fileReader(String line) { + if (line.contains("TODO")) { + return ToDo.fileReader(line); + } else if (line.contains("DDLN")) { + return Deadline.fileReader(line); + } else { + return Event.fileReader(line); + } + } + @Override public String toString() { if (isDone) { diff --git a/src/com/jetbrains/ToDo.java b/src/duke/ToDo.java similarity index 53% rename from src/com/jetbrains/ToDo.java rename to src/duke/ToDo.java index f77fd58686..412f87510a 100644 --- a/src/com/jetbrains/ToDo.java +++ b/src/duke/ToDo.java @@ -1,15 +1,28 @@ -package com.jetbrains; +package duke; import java.lang.Throwable; public class ToDo extends Task { + ToDo() { + + } ToDo(String input) throws DukeIncompleteCommandException { input = input.substring(4).trim(); if (input.equals("")) { throw new DukeIncompleteCommandException(); } - this.task = input; + this.task = input.trim(); this.isDone = false; } + static ToDo fileReader(String line) { + ToDo todo = new ToDo(); + if (line.charAt(5) == 'X') { + todo.isDone = true; + } else { + todo.isDone = false; + } + todo.task = line.substring(7).trim(); + return todo; + } @Override public String toString() { From 18b425d8dd1f7d4209519228571e0f4eca74d6da Mon Sep 17 00:00:00 2001 From: andrea-twl Date: Tue, 9 Feb 2021 02:05:26 +0800 Subject: [PATCH 08/23] Level-8 complete (added date, recoded loadFile(), handled exceptions) --- data/duke.txt | 3 + src/com/jetbrains/Deadline.java | 29 ------- src/com/jetbrains/Event.java | 31 ------- src/com/jetbrains/Task.java | 28 ------- src/com/jetbrains/ToDo.java | 18 ---- src/duke/Deadline.java | 56 +++++++++++++ src/{com/jetbrains => duke}/Duke.java | 83 ++++++++++++++++--- .../DukeIncompleteCommandException.java | 2 +- .../DukeInvalidCommandException.java | 2 +- src/duke/Event.java | 57 +++++++++++++ src/duke/Task.java | 51 ++++++++++++ src/duke/TimedTask.java | 25 ++++++ src/duke/ToDo.java | 36 ++++++++ 13 files changed, 300 insertions(+), 121 deletions(-) create mode 100644 data/duke.txt delete mode 100644 src/com/jetbrains/Deadline.java delete mode 100644 src/com/jetbrains/Event.java delete mode 100644 src/com/jetbrains/Task.java delete mode 100644 src/com/jetbrains/ToDo.java create mode 100644 src/duke/Deadline.java rename src/{com/jetbrains => duke}/Duke.java (57%) rename src/{com/jetbrains => duke}/DukeIncompleteCommandException.java (94%) rename src/{com/jetbrains => duke}/DukeInvalidCommandException.java (93%) create mode 100644 src/duke/Event.java create mode 100644 src/duke/Task.java create mode 100644 src/duke/TimedTask.java create mode 100644 src/duke/ToDo.java diff --git a/data/duke.txt b/data/duke.txt new file mode 100644 index 0000000000..35a3ac2d20 --- /dev/null +++ b/data/duke.txt @@ -0,0 +1,3 @@ +TODO[ ] complete ip.. +EVNT[ ] skate with janice (at: Feb 9 2021) +DDLN[ ] skating photoshoot (by: 2021-02-27) diff --git a/src/com/jetbrains/Deadline.java b/src/com/jetbrains/Deadline.java deleted file mode 100644 index 735ddf2ba2..0000000000 --- a/src/com/jetbrains/Deadline.java +++ /dev/null @@ -1,29 +0,0 @@ -package com.jetbrains; - -import java.lang.Throwable; -public class Deadline extends Task { - String by; - - Deadline(String input) throws DukeIncompleteCommandException { - input = input.substring(8).trim(); - - if (input.equals("")) { - throw new DukeIncompleteCommandException(); - } - - String[] inputs = input.split("/by"); - - if (!input.contains("/by") || inputs.length < 2) { - throw new DukeIncompleteCommandException("Oh no! Please enter an due date. :P"); - } - this.task = inputs[0]; - this.isDone = false; - this.by = inputs[1].trim(); - } - - @Override - public String toString() { - return String.format("DDLN%s (by: %s)" , - super.toString(), by); - } -} diff --git a/src/com/jetbrains/Event.java b/src/com/jetbrains/Event.java deleted file mode 100644 index 009f2ecbc4..0000000000 --- a/src/com/jetbrains/Event.java +++ /dev/null @@ -1,31 +0,0 @@ -package com.jetbrains; - -import java.lang.Throwable; -public class Event extends Task { - String at; - - Event(String input) throws DukeIncompleteCommandException { - input = input.substring(5).trim(); - - if (input.equals("")) { - throw new DukeIncompleteCommandException(); - } - - String[] inputs = input.split("/at"); - - if (!input.contains("/at") || inputs.length < 2) { - throw new DukeIncompleteCommandException("Oh no! Please enter an event date. :P"); - } - - this.task = inputs[0]; - this.isDone = false; - this.at = inputs[1].trim(); - } - - - @Override - public String toString() { - return String.format("EVNT%s (at: %s)" , - super.toString(), at); - } -} diff --git a/src/com/jetbrains/Task.java b/src/com/jetbrains/Task.java deleted file mode 100644 index a2c961a1c4..0000000000 --- a/src/com/jetbrains/Task.java +++ /dev/null @@ -1,28 +0,0 @@ -package com.jetbrains; - -class Task { - String task; - boolean isDone; - - Task() { - } - - Task(String task) { - this.task = task; - isDone = false; - } - - Task markDone() { - isDone = true; - return this; - } - - @Override - public String toString() { - if (isDone) { - return "[X] " + task; - } else { - return "[ ] " + task; - } - } -} diff --git a/src/com/jetbrains/ToDo.java b/src/com/jetbrains/ToDo.java deleted file mode 100644 index f77fd58686..0000000000 --- a/src/com/jetbrains/ToDo.java +++ /dev/null @@ -1,18 +0,0 @@ -package com.jetbrains; - -import java.lang.Throwable; -public class ToDo extends Task { - ToDo(String input) throws DukeIncompleteCommandException { - input = input.substring(4).trim(); - if (input.equals("")) { - throw new DukeIncompleteCommandException(); - } - this.task = input; - this.isDone = false; - } - - @Override - public String toString() { - return "TODO" + super.toString(); - } -} diff --git a/src/duke/Deadline.java b/src/duke/Deadline.java new file mode 100644 index 0000000000..24b3d3b21f --- /dev/null +++ b/src/duke/Deadline.java @@ -0,0 +1,56 @@ +package duke; + +import java.time.LocalDate; +import java.time.format.DateTimeFormatter; +import java.time.format.DateTimeParseException; + +public class Deadline extends Task { + LocalDate by; + + Deadline() { + + } + static Deadline parseInput(String input) throws DukeIncompleteCommandException, + DateTimeParseException { + + Deadline deadline = new Deadline(); + input = input.substring(8).trim(); + + if (input.equals("")) { + throw new DukeIncompleteCommandException(); + } + + String[] inputs = input.split("/by"); + + if (!input.contains("/by") || inputs.length < 2) { + throw new DukeIncompleteCommandException("Oh no! Please enter an due date. :P\n"); + } + deadline.task = inputs[0].trim(); + deadline.isDone = false; + deadline.by = LocalDate.parse(inputs[1].trim()); + + return deadline; + } + + static Deadline fileReader(String line) { + Deadline deadline = new Deadline(); + if (line.charAt(5) == 'X') { + deadline.isDone = true; + } else { + deadline.isDone = false; + } + String[] lines = line.substring(7).trim().split("by: "); + deadline.task = lines[0].substring(0, lines[0].length() - 2).trim(); + String dateString = lines[1].substring(0, lines[1].length() - 1); + deadline.by = LocalDate.parse(dateString.subSequence(0, dateString.length())); + return deadline; + } + @Override + public String toString() { + return String.format("DDLN%s (by: %s)" , + super.toString(), by); + } + public String stringToSave() { + return String.format("DDLN%s (at: %s)" , super.toString(), by); + } +} diff --git a/src/com/jetbrains/Duke.java b/src/duke/Duke.java similarity index 57% rename from src/com/jetbrains/Duke.java rename to src/duke/Duke.java index 70d47ad293..7858f87f64 100644 --- a/src/com/jetbrains/Duke.java +++ b/src/duke/Duke.java @@ -1,10 +1,18 @@ -package com.jetbrains; +package duke; import java.util.Scanner; import java.util.ArrayList; +import java.io.File; +import java.io.FileWriter; +import java.io.IOException; +import java.time.format.DateTimeParseException; public class Duke { public static void main(String[] args) { + + + ArrayList list = loadFile(); + String logo = " ____ _ \n" + "| _ \\ _ _| | _____ \n" + "| | | | | | | |/ / _ \\\n" @@ -14,7 +22,7 @@ public static void main(String[] args) { System.out.println("Hello! I'm Duke! \n" + "What would you like to do today? \n" + "***********************************"); - ArrayList list = new ArrayList<>(); + Scanner sc = new Scanner(System.in); String input = sc.nextLine(); while (!input.equals("bye")) { @@ -34,23 +42,17 @@ public static void main(String[] args) { int index = Integer.parseInt(command[1]) - 1; task = list.get(index); System.out.println("Alright, I've deleted this task:\n " + - task + - "\n"); + task); list.remove(index); + saveFile(list); System.out.println("Now you have " + list.size() + " task(s) in the list. \n"); } else if (input.contains("todo") || input.contains("deadline") || input.contains("event")) { - - if (input.contains("todo")) { - task = new ToDo(input); - } else if (input.contains("deadline")) { - task = new Deadline(input); - } else { - task = new Event(input); - } + task = Task.parseInput(input); list.add(task); + saveFile(task.stringToSave()); System.out.println("Alright! I've added this task: \n " + task + "\nNow you have " + list.size() + " task(s) in the list. \n"); @@ -58,7 +60,10 @@ public static void main(String[] args) { throw new DukeInvalidCommandException(); } } catch (IndexOutOfBoundsException e) { - System.out.println("Oh no! This task does not exist. D:" ); + System.out.println("Oh no! This task does not exist. D:\n" ); + } catch (DateTimeParseException e) { + System.out.println("Oh no! " + + " Please key in the date in the format YYYY-MM-DD.\n"); } catch (Exception e) { System.out.println(e.getMessage()); } @@ -74,6 +79,58 @@ static void displayList(ArrayList list) { System.out.printf("%d. %s%n",i + 1, list.get(i).toString()); } } + + static Task fileToTask(String input) { + return Task.fileReader(input); + } + + static ArrayList loadFile() { + String path = "./data/duke.txt"; + String directory = "./data"; + File d = new File(directory); + File f = new File(path); + ArrayList list = new ArrayList<>(); + if (!d.exists()){ + d.mkdirs(); + } + try { + f.createNewFile(); + Scanner sc = new Scanner(f); + while (sc.hasNext()) { + try { + String line = sc.nextLine(); + Task task = fileToTask(line); + list.add(task); + } catch (Exception e) {} + } + } catch (IOException e) { + System.out.println(e.getMessage()); + } + return list; + } + + static void saveFile(String input) { + String path = "./data/duke.txt"; + try { + FileWriter fw = new FileWriter(path, true); + fw.write(input + System.lineSeparator()); + fw.close(); + } catch (IOException e) { + } + } + + static void saveFile(ArrayList list) { + String path = "./data/duke.txt"; + try { + FileWriter fw = new FileWriter(path); + for(Task t: list) { + fw.write(t.toString() + System.lineSeparator()); + } + fw.close(); + } catch (Exception e) { + System.out.println(e.getMessage()); + } + } } diff --git a/src/com/jetbrains/DukeIncompleteCommandException.java b/src/duke/DukeIncompleteCommandException.java similarity index 94% rename from src/com/jetbrains/DukeIncompleteCommandException.java rename to src/duke/DukeIncompleteCommandException.java index 482bebf774..4ef6ce6bfc 100644 --- a/src/com/jetbrains/DukeIncompleteCommandException.java +++ b/src/duke/DukeIncompleteCommandException.java @@ -1,4 +1,4 @@ -package com.jetbrains; +package duke; public class DukeIncompleteCommandException extends Exception { public String message; diff --git a/src/com/jetbrains/DukeInvalidCommandException.java b/src/duke/DukeInvalidCommandException.java similarity index 93% rename from src/com/jetbrains/DukeInvalidCommandException.java rename to src/duke/DukeInvalidCommandException.java index 77887d2f24..b3f032550a 100644 --- a/src/com/jetbrains/DukeInvalidCommandException.java +++ b/src/duke/DukeInvalidCommandException.java @@ -1,4 +1,4 @@ -package com.jetbrains; +package duke; public class DukeInvalidCommandException extends Exception { public String message = "Oh no! I don't know what that means. ):"; diff --git a/src/duke/Event.java b/src/duke/Event.java new file mode 100644 index 0000000000..3944f8d3c4 --- /dev/null +++ b/src/duke/Event.java @@ -0,0 +1,57 @@ +package duke; + +import java.time.LocalDate; +import java.time.format.DateTimeFormatter; +import java.time.format.DateTimeParseException; + +public class Event extends Task { + LocalDate at; + + Event() { + + } + + static Event parseInput(String input) throws DukeIncompleteCommandException, + DateTimeParseException { + + Event event = new Event(); + input = input.substring(5).trim(); + + if (input.equals("")) { + throw new DukeIncompleteCommandException(); + } + + String[] inputs = input.split("/at"); + + if (!input.contains("/at") || inputs.length < 2) { + throw new DukeIncompleteCommandException("Oh no! Please enter an event date. :P\n"); + } + + event.task = inputs[0].trim(); + event.isDone = false; + event.at = LocalDate.parse(inputs[1].trim()); + return event; + } + static Event fileReader(String line) { + Event event = new Event(); + if (line.charAt(5) == 'X') { + event.isDone = true; + } else { + event.isDone = false; + } + String[] lines = line.substring(7).trim().split("at: "); + event.task = lines[0].substring(0, lines[0].length() - 2).trim(); + String dateString = lines[1].substring(0, lines[1].length() - 1); + event.at = LocalDate.parse(dateString.subSequence(0, dateString.length())); + return event; + } + + @Override + public String toString() { + return String.format("EVNT%s (at: %s)" , super.toString(), + at.format(DateTimeFormatter.ofPattern("MMM d yyyy"))); + } + public String stringToSave() { + return String.format("EVNT%s (at: %s)" , super.toString(), at); + } +} diff --git a/src/duke/Task.java b/src/duke/Task.java new file mode 100644 index 0000000000..7ac1a07ad7 --- /dev/null +++ b/src/duke/Task.java @@ -0,0 +1,51 @@ +package duke; + +class Task { + String task; + boolean isDone; + + Task() { + } + + Task(String task) { + this.task = task.trim(); + isDone = false; + } + + Task markDone() { + isDone = true; + return this; + } + static Task parseInput(String input) throws DukeIncompleteCommandException { + Task task; + if (input.contains("todo")) { + task = ToDo.parseInput(input); + } else if (input.contains("deadline")) { + task = Deadline.parseInput(input); + } else { + task = Event.parseInput(input); + } + return task; + } + static Task fileReader(String line) { + if (line.contains("TODO")) { + return ToDo.fileReader(line); + } else if (line.contains("DDLN")) { + return Deadline.fileReader(line); + } else { + return Event.fileReader(line); + } + } + + @Override + public String toString() { + if (isDone) { + return "[X] " + task; + } else { + return "[ ] " + task; + } + } + public String stringToSave() { + return ""; + } +} diff --git a/src/duke/TimedTask.java b/src/duke/TimedTask.java new file mode 100644 index 0000000000..7110e9e3a9 --- /dev/null +++ b/src/duke/TimedTask.java @@ -0,0 +1,25 @@ +package duke; + +import java.time.LocalDate; + +public class TimedTask /* */ extends Task{ + LocalDate date; + + TimedTask() { + } + /* + static T fileReader(String line, String regex) { + TimedTask t = new T<>(); + if (line.charAt(5) == 'X') { + t.isDone = true; + } else { + t.isDone = false; + } + String[] lines = line.substring(7).trim().split(regex); + t.task = lines[0].substring(0, lines[0].length() - 2).trim(); + t.date = lines[1].substring(0, lines[1].length() - 1); + return t; + } + */ + +} diff --git a/src/duke/ToDo.java b/src/duke/ToDo.java new file mode 100644 index 0000000000..460aa2117a --- /dev/null +++ b/src/duke/ToDo.java @@ -0,0 +1,36 @@ +package duke; + +import java.lang.Throwable; +public class ToDo extends Task { + ToDo() { + + } + static ToDo parseInput(String input) throws DukeIncompleteCommandException { + ToDo todo = new ToDo(); + input = input.substring(4).trim(); + if (input.equals("")) { + throw new DukeIncompleteCommandException(); + } + todo.task = input.trim(); + todo.isDone = false; + return todo; + } + static ToDo fileReader(String line) { + ToDo todo = new ToDo(); + if (line.charAt(5) == 'X') { + todo.isDone = true; + } else { + todo.isDone = false; + } + todo.task = line.substring(7).trim(); + return todo; + } + + @Override + public String toString() { + return "TODO" + super.toString(); + } + public String stringToSave() { + return "TODO" + super.toString(); + } +} From 20618780f4436add6279249dd6bbb288921cabbe Mon Sep 17 00:00:00 2001 From: andrea-twl Date: Sun, 14 Feb 2021 18:44:54 +0800 Subject: [PATCH 09/23] A-MoreOOP (added Tasklist.java, Storage.java, Parser.java and UI.java) --- src/duke/.idea/.name | 1 + src/duke/.idea/misc.xml | 6 + src/duke/.idea/modules.xml | 8 ++ src/duke/.idea/vcs.xml | 6 + src/duke/.idea/workspace.xml | 77 +++++++++++ src/duke/Deadline.java | 17 ++- src/duke/Duke.java | 124 +---------------- src/duke/DukeIncompleteCommandException.java | 2 +- src/duke/DukeInvalidCommandException.java | 2 +- src/duke/Event.java | 15 +- src/duke/Parser.java | 129 ++++++++++++++++++ src/duke/Storage.java | 70 ++++++++++ src/duke/Task.java | 14 +- src/duke/TaskList.java | 52 +++++++ src/duke/TimedTask.java | 2 +- src/duke/ToDo.java | 6 +- src/duke/Ui.java | 48 +++++++ src/duke/data/duke.txt | 6 + src/duke/out/production/duke/Duke.class | Bin 0 -> 1126 bytes src/duke/out/production/duke/duke/.idea/.name | 1 + .../out/production/duke/duke/.idea/misc.xml | 6 + .../production/duke/duke/.idea/modules.xml | 8 ++ .../out/production/duke/duke/.idea/vcs.xml | 6 + .../production/duke/duke/.idea/workspace.xml | 77 +++++++++++ .../out/production/duke/duke/Deadline.class | Bin 0 -> 2260 bytes src/duke/out/production/duke/duke/Duke.class | Bin 0 -> 898 bytes .../duke/DukeIncompleteCommandException.class | Bin 0 -> 706 bytes .../duke/DukeInvalidCommandException.class | Bin 0 -> 597 bytes src/duke/out/production/duke/duke/Event.class | Bin 0 -> 2246 bytes .../out/production/duke/duke/Parser.class | Bin 0 -> 4036 bytes .../out/production/duke/duke/Storage.class | Bin 0 -> 3124 bytes src/duke/out/production/duke/duke/Task.class | Bin 0 -> 1834 bytes .../out/production/duke/duke/TaskList.class | Bin 0 -> 2372 bytes .../out/production/duke/duke/TimedTask.class | Bin 0 -> 489 bytes src/duke/out/production/duke/duke/ToDo.class | Bin 0 -> 1694 bytes src/duke/out/production/duke/duke/Ui.class | Bin 0 -> 2165 bytes .../out/production/duke/duke/data/duke.txt | 5 + 37 files changed, 537 insertions(+), 151 deletions(-) create mode 100644 src/duke/.idea/.name create mode 100644 src/duke/.idea/misc.xml create mode 100644 src/duke/.idea/modules.xml create mode 100644 src/duke/.idea/vcs.xml create mode 100644 src/duke/.idea/workspace.xml create mode 100644 src/duke/Parser.java create mode 100644 src/duke/Storage.java create mode 100644 src/duke/TaskList.java create mode 100644 src/duke/Ui.java create mode 100644 src/duke/data/duke.txt create mode 100644 src/duke/out/production/duke/Duke.class create mode 100644 src/duke/out/production/duke/duke/.idea/.name create mode 100644 src/duke/out/production/duke/duke/.idea/misc.xml create mode 100644 src/duke/out/production/duke/duke/.idea/modules.xml create mode 100644 src/duke/out/production/duke/duke/.idea/vcs.xml create mode 100644 src/duke/out/production/duke/duke/.idea/workspace.xml create mode 100644 src/duke/out/production/duke/duke/Deadline.class create mode 100644 src/duke/out/production/duke/duke/Duke.class create mode 100644 src/duke/out/production/duke/duke/DukeIncompleteCommandException.class create mode 100644 src/duke/out/production/duke/duke/DukeInvalidCommandException.class create mode 100644 src/duke/out/production/duke/duke/Event.class create mode 100644 src/duke/out/production/duke/duke/Parser.class create mode 100644 src/duke/out/production/duke/duke/Storage.class create mode 100644 src/duke/out/production/duke/duke/Task.class create mode 100644 src/duke/out/production/duke/duke/TaskList.class create mode 100644 src/duke/out/production/duke/duke/TimedTask.class create mode 100644 src/duke/out/production/duke/duke/ToDo.class create mode 100644 src/duke/out/production/duke/duke/Ui.class create mode 100644 src/duke/out/production/duke/duke/data/duke.txt diff --git a/src/duke/.idea/.name b/src/duke/.idea/.name new file mode 100644 index 0000000000..c51b8fbc69 --- /dev/null +++ b/src/duke/.idea/.name @@ -0,0 +1 @@ +DukeIncompleteCommandException.java \ No newline at end of file diff --git a/src/duke/.idea/misc.xml b/src/duke/.idea/misc.xml new file mode 100644 index 0000000000..37e641e915 --- /dev/null +++ b/src/duke/.idea/misc.xml @@ -0,0 +1,6 @@ + + + + + + \ No newline at end of file diff --git a/src/duke/.idea/modules.xml b/src/duke/.idea/modules.xml new file mode 100644 index 0000000000..b7a0289b8f --- /dev/null +++ b/src/duke/.idea/modules.xml @@ -0,0 +1,8 @@ + + + + + + + + \ No newline at end of file diff --git a/src/duke/.idea/vcs.xml b/src/duke/.idea/vcs.xml new file mode 100644 index 0000000000..b2bdec2d71 --- /dev/null +++ b/src/duke/.idea/vcs.xml @@ -0,0 +1,6 @@ + + + + + + \ No newline at end of file diff --git a/src/duke/.idea/workspace.xml b/src/duke/.idea/workspace.xml new file mode 100644 index 0000000000..6072bd02a2 --- /dev/null +++ b/src/duke/.idea/workspace.xml @@ -0,0 +1,77 @@ + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + 1612811109649 + + + + + + + \ No newline at end of file diff --git a/src/duke/Deadline.java b/src/duke/Deadline.java index 24b3d3b21f..e0dcc655a8 100644 --- a/src/duke/Deadline.java +++ b/src/duke/Deadline.java @@ -4,11 +4,10 @@ import java.time.format.DateTimeFormatter; import java.time.format.DateTimeParseException; -public class Deadline extends Task { - LocalDate by; +public class Deadline extends TimedTask { Deadline() { - + this.isDone = false; } static Deadline parseInput(String input) throws DukeIncompleteCommandException, DateTimeParseException { @@ -27,7 +26,7 @@ static Deadline parseInput(String input) throws DukeIncompleteCommandException, } deadline.task = inputs[0].trim(); deadline.isDone = false; - deadline.by = LocalDate.parse(inputs[1].trim()); + deadline.date = LocalDate.parse(inputs[1].trim()); return deadline; } @@ -42,15 +41,15 @@ static Deadline fileReader(String line) { String[] lines = line.substring(7).trim().split("by: "); deadline.task = lines[0].substring(0, lines[0].length() - 2).trim(); String dateString = lines[1].substring(0, lines[1].length() - 1); - deadline.by = LocalDate.parse(dateString.subSequence(0, dateString.length())); + deadline.date = LocalDate.parse(dateString.subSequence(0, dateString.length())); return deadline; } @Override public String toString() { - return String.format("DDLN%s (by: %s)" , - super.toString(), by); + return String.format("DDLN%s (by: %s)" , super.toString(), + date.format(DateTimeFormatter.ofPattern("MMM d yyyy"))); } - public String stringToSave() { - return String.format("DDLN%s (at: %s)" , super.toString(), by); + public String toFileString() { + return String.format("DDLN%s (by: %s)" , super.toString(), date); } } diff --git a/src/duke/Duke.java b/src/duke/Duke.java index fdc4cfd873..0b6a657a5c 100644 --- a/src/duke/Duke.java +++ b/src/duke/Duke.java @@ -2,132 +2,22 @@ import java.util.Scanner; import java.util.ArrayList; -import java.io.File; -import java.io.FileWriter; -import java.io.IOException; import java.time.format.DateTimeParseException; public class Duke { public static void main(String[] args) { - ArrayList list = loadFile(); - String logo = " ____ _ \n" - + "| _ \\ _ _| | _____ \n" - + "| | | | | | | |/ / _ \\\n" - + "| |_| | |_| | < __/\n" - + "|____/ \\__,_|_|\\_\\___|\n"; - System.out.println(logo); - System.out.println("Hello! I'm Duke! \n" + - "What would you like to do today? \n" + - "***********************************"); - - Scanner sc = new Scanner(System.in); - String input = sc.nextLine(); - while (!input.equals("bye")) { - Task task; - try { - if (input.equals("list")) { - displayList(list); - System.out.println("\n"); - } else if (input.contains("done")) { - String[] command = input.split(" "); - task = list.get(Integer.parseInt(command[1]) - 1); - System.out.println("Good job! I've marked this task as done:\n " + - task.markDone() + - "\n"); - } else if (input.contains("delete")) { - String[] command = input.split(" "); - int index = Integer.parseInt(command[1]) - 1; - task = list.get(index); - System.out.println("Alright, I've deleted this task:\n " + - task); - list.remove(index); - saveFile(list); - System.out.println("Now you have " + list.size() + - " task(s) in the list. \n"); - } else if (input.contains("todo") || - input.contains("deadline") || - input.contains("event")) { - task = Task.parseInput(input); - list.add(task); - saveFile(task.stringToSave()); - System.out.println("Alright! I've added this task: \n " + - task + "\nNow you have " + list.size() + - " task(s) in the list. \n"); - } else { - throw new DukeInvalidCommandException(); - } - } catch (IndexOutOfBoundsException e) { - System.out.println("Oh no! This task does not exist. D:\n" ); - } catch (DateTimeParseException e) { - System.out.println("Oh no! " + - " Please key in the date in the format YYYY-MM-DD.\n"); - } catch (Exception e) { - System.out.println(e.getMessage()); - } - input = sc.nextLine(); - } - - sc.close(); - System.out.println("Bye! Stay on task!"); - } - - static void displayList(ArrayList list) { - for(int i = 0; i < list.size(); i++) { - System.out.printf("%d. %s%n",i + 1, list.get(i).toString()); - } - } - - static Task fileToTask(String input) { - return Task.fileReader(input); - } - - static ArrayList loadFile() { String path = "./data/duke.txt"; String directory = "./data"; - File d = new File(directory); - File f = new File(path); - ArrayList list = new ArrayList<>(); - if (!d.exists()){ - d.mkdirs(); - } - try { - f.createNewFile(); - Scanner sc = new Scanner(f); - while (sc.hasNext()) { - try { - String line = sc.nextLine(); - Task task = fileToTask(line); - list.add(task); - } catch (Exception e) {} - } - } catch (IOException e) { - System.out.println(e.getMessage()); - } - return list; - } - static void saveFile(String input) { - String path = "./data/duke.txt"; - try { - FileWriter fw = new FileWriter(path, true); - fw.write(input + System.lineSeparator()); - fw.close(); - } catch (IOException e) { - } - } + Storage storage = new Storage(path, directory); + TaskList taskList = new TaskList(storage); + taskList.loadList(); + Parser parser = new Parser(taskList); + Ui.printWelcome(); + parser.parseAll(); - static void saveFile(ArrayList list) { - String path = "./data/duke.txt"; - try { - FileWriter fw = new FileWriter(path); - for(Task t: list) { - fw.write(t.toString() + System.lineSeparator()); - } - fw.close(); - } catch (Exception e) { - System.out.println(e.getMessage()); - } } + } diff --git a/src/duke/DukeIncompleteCommandException.java b/src/duke/DukeIncompleteCommandException.java index 4ef6ce6bfc..b2b4b9f14f 100644 --- a/src/duke/DukeIncompleteCommandException.java +++ b/src/duke/DukeIncompleteCommandException.java @@ -3,7 +3,7 @@ public class DukeIncompleteCommandException extends Exception { public String message; DukeIncompleteCommandException() { - this.message = "Oh no! Task cannot be empty. ):"; + this.message = "Oh no! Task cannot be empty. ):\n"; } DukeIncompleteCommandException(String message) { this.message = message; diff --git a/src/duke/DukeInvalidCommandException.java b/src/duke/DukeInvalidCommandException.java index b3f032550a..7bfd640a47 100644 --- a/src/duke/DukeInvalidCommandException.java +++ b/src/duke/DukeInvalidCommandException.java @@ -1,7 +1,7 @@ package duke; public class DukeInvalidCommandException extends Exception { - public String message = "Oh no! I don't know what that means. ):"; + public String message = "Oh no! I don't know what that means. ):\n"; DukeInvalidCommandException() { } diff --git a/src/duke/Event.java b/src/duke/Event.java index 3944f8d3c4..ce1d8fd7fa 100644 --- a/src/duke/Event.java +++ b/src/duke/Event.java @@ -4,11 +4,10 @@ import java.time.format.DateTimeFormatter; import java.time.format.DateTimeParseException; -public class Event extends Task { - LocalDate at; +public class Event extends TimedTask { Event() { - + this.isDone = false; } static Event parseInput(String input) throws DukeIncompleteCommandException, @@ -29,7 +28,7 @@ static Event parseInput(String input) throws DukeIncompleteCommandException, event.task = inputs[0].trim(); event.isDone = false; - event.at = LocalDate.parse(inputs[1].trim()); + event.date = LocalDate.parse(inputs[1].trim()); return event; } static Event fileReader(String line) { @@ -42,16 +41,16 @@ static Event fileReader(String line) { String[] lines = line.substring(7).trim().split("at: "); event.task = lines[0].substring(0, lines[0].length() - 2).trim(); String dateString = lines[1].substring(0, lines[1].length() - 1); - event.at = LocalDate.parse(dateString.subSequence(0, dateString.length())); + event.date = LocalDate.parse(dateString.subSequence(0, dateString.length())); return event; } @Override public String toString() { return String.format("EVNT%s (at: %s)" , super.toString(), - at.format(DateTimeFormatter.ofPattern("MMM d yyyy"))); + date.format(DateTimeFormatter.ofPattern("MMM d yyyy"))); } - public String stringToSave() { - return String.format("EVNT%s (at: %s)" , super.toString(), at); + public String toFileString() { + return String.format("EVNT%s (at: %s)" , super.toString(), date); } } diff --git a/src/duke/Parser.java b/src/duke/Parser.java new file mode 100644 index 0000000000..578e89f522 --- /dev/null +++ b/src/duke/Parser.java @@ -0,0 +1,129 @@ +package duke; + +import java.time.LocalDate; +import java.time.format.DateTimeParseException; +import java.util.Scanner; + +public class Parser { + TaskList taskList; + + Parser(TaskList taskList) { + this.taskList = taskList; + } + + void parseAll() { + Scanner sc = new Scanner(System.in); + String line = sc.nextLine(); + while (!line.equals("bye")) { + parseLine(line); + line = sc.nextLine(); + } + sc.close(); + } + void parseLine(String input) { + try { + if (input.equals("list") || input.contains("done") + || input.contains("delete")) { + parseGeneralCommand(input); + } else if (input.contains("todo") || + input.contains("deadline") || + input.contains("event")) { + parseAddTaskCommand(input); + } else { + throw new DukeInvalidCommandException(); + } + } catch (DukeInvalidCommandException e) { + System.out.println(e.getMessage()); + } catch (DukeIncompleteCommandException e) { + System.out.println(e.getMessage()); + } catch (DateTimeParseException e) { + Ui.printDateFormatError(); + } + } + + void parseGeneralCommand(String input) throws DukeIncompleteCommandException { + String[] inputs; + int index; + if (input.equals("list")) { + taskList.displayList(); + } else if (input.contains("done")) { + inputs = input.split(" "); + index = Integer.parseInt(inputs[1]) - 1; + taskList.markDone(index); + } else { + inputs = input.split(" "); + index = Integer.parseInt(inputs[1]) - 1; + taskList.delete(index); + } + } + + void parseAddTaskCommand(String input) throws DukeIncompleteCommandException, + DateTimeParseException { + TimedTask timedTask = new TimedTask(); + String editedInput; + String regex; + if (input.contains("todo")) { + editedInput = input.substring(4).trim(); + regex = ""; + } else if (input.contains("deadline")) { + editedInput = input.substring(8).trim(); + regex = "/by"; + timedTask = new Deadline(); + } else { + editedInput = input.substring(4).trim(); + regex = "/at"; + timedTask = new Event(); + } + if (editedInput.equals("")) { + throw new DukeIncompleteCommandException(); + } + if (regex.equals("")) { + Task task = new ToDo(editedInput); + taskList.add(task); + } else { + String[] editedInputs = input.split(regex); + timedTask.task = editedInputs[0].trim(); + try { + timedTask.date = LocalDate.parse(editedInputs[1].trim()); + taskList.add(timedTask); + } catch (DateTimeParseException e) { + throw e; + } + } + } + static Task parseFile(String line) { + if (line.contains("TODO")) { + Task task = new ToDo(); + if (line.charAt(5) == 'X') { + task.isDone = true; + } else { + task.isDone = false; + } + task.task = line.substring(7).trim(); + return task; + } else { + TimedTask timedTask; + String regex; + if (line.contains("DDLN")) { + timedTask = new Deadline(); + regex = "by: "; + } else { + timedTask = new Event(); + regex = "at: "; + } + if (line.charAt(5) == 'X') { + timedTask.isDone = true; + } else { + timedTask.isDone = false; + } + String[] lines = line.substring(7).trim().split(regex); + timedTask.task = lines[0].substring(0, lines[0].length() - 2).trim(); + String dateString = lines[1].substring(0, lines[1].length() - 1); + timedTask.date = LocalDate.parse(dateString.subSequence(0, dateString.length())); + return timedTask; + } + } + +} + + diff --git a/src/duke/Storage.java b/src/duke/Storage.java new file mode 100644 index 0000000000..0ff900996d --- /dev/null +++ b/src/duke/Storage.java @@ -0,0 +1,70 @@ +package duke; + +import java.io.File; +import java.io.FileWriter; +import java.io.IOException; +import java.util.ArrayList; +import java.util.Scanner; + +public class Storage { + String path; + String directory; + + Storage() { + } + + Storage(String path, String directory) { + this.path = path; + this.directory = directory; + } + + ArrayList loadFile() { + // String path = "./data/duke.txt"; + // String directory = "./data"; + File d = new File(directory); + File f = new File(path); + ArrayList list = new ArrayList<>(); + if (!d.exists()){ + d.mkdirs(); + } + try { + f.createNewFile(); + Scanner sc = new Scanner(f); + while (sc.hasNext()) { + try { + String line = sc.nextLine(); + Task task = Parser.parseFile(line); + list.add(task); + } catch (Exception e) {} + } + } catch (IOException e) { + System.out.println(e.getMessage()); + } + return list; + } + + void saveFile(String input) { + // String path = "./data/duke.txt"; + try { + FileWriter fw = new FileWriter(path, true); + fw.write(input + System.lineSeparator()); + fw.close(); + } catch (IOException e) { + System.out.println("An error has occurred, unable to save."); + e.getMessage(); + } + } + + void saveFile(ArrayList list) { + // String path = "./data/duke.txt"; + try { + FileWriter fw = new FileWriter(path); + for(Task t: list) { + fw.write(t.toFileString() + System.lineSeparator()); + } + fw.close(); + } catch (Exception e) { + System.out.println(e.getMessage()); + } + } +} diff --git a/src/duke/Task.java b/src/duke/Task.java index 7ac1a07ad7..393a0e38c5 100644 --- a/src/duke/Task.java +++ b/src/duke/Task.java @@ -27,15 +27,7 @@ static Task parseInput(String input) throws DukeIncompleteCommandException { } return task; } - static Task fileReader(String line) { - if (line.contains("TODO")) { - return ToDo.fileReader(line); - } else if (line.contains("DDLN")) { - return Deadline.fileReader(line); - } else { - return Event.fileReader(line); - } - } + @Override public String toString() { @@ -45,7 +37,7 @@ public String toString() { return "[ ] " + task; } } - public String stringToSave() { - return ""; + public String toFileString() { + return toString(); } } diff --git a/src/duke/TaskList.java b/src/duke/TaskList.java new file mode 100644 index 0000000000..a3fb027b63 --- /dev/null +++ b/src/duke/TaskList.java @@ -0,0 +1,52 @@ +package duke; + +import java.util.ArrayList; + +public class TaskList { + ArrayList list; + Storage storage; + + TaskList(Storage storage) { + this.storage = storage; + } + + TaskList(ArrayList list, Storage storage) { + this.list = list; + this.storage = storage; + } + + void loadList() { + this.list = this.storage.loadFile(); + } + + void displayList() { + for(int i = 0; i < list.size(); i++) { + System.out.printf("%d. %s%n",i + 1, list.get(i).toString()); + } + System.out.println("\n"); + } + + void markDone(int index) { + Task task = list.get(index); + task.markDone(); + Ui.printDone(task); + } + void delete (int index) { + Task task = list.get(index); + try { + list.remove(index); + } catch (IndexOutOfBoundsException e) { + Ui.printIndexError(); + } + storage.saveFile(list); + Ui.printDelete(task, list.size()); + } + + void add(Task task) { + list.add(task); + storage.saveFile(task.toFileString()); + Ui.printAdd(task, list.size()); + } + + +} diff --git a/src/duke/TimedTask.java b/src/duke/TimedTask.java index 7110e9e3a9..587fc16423 100644 --- a/src/duke/TimedTask.java +++ b/src/duke/TimedTask.java @@ -2,7 +2,7 @@ import java.time.LocalDate; -public class TimedTask /* */ extends Task{ +public class TimedTask extends Task{ LocalDate date; TimedTask() { diff --git a/src/duke/ToDo.java b/src/duke/ToDo.java index 460aa2117a..7758fac9eb 100644 --- a/src/duke/ToDo.java +++ b/src/duke/ToDo.java @@ -3,7 +3,10 @@ import java.lang.Throwable; public class ToDo extends Task { ToDo() { + } + ToDo(String task) { + super(task); } static ToDo parseInput(String input) throws DukeIncompleteCommandException { ToDo todo = new ToDo(); @@ -30,7 +33,4 @@ static ToDo fileReader(String line) { public String toString() { return "TODO" + super.toString(); } - public String stringToSave() { - return "TODO" + super.toString(); - } } diff --git a/src/duke/Ui.java b/src/duke/Ui.java new file mode 100644 index 0000000000..7dce9be0e4 --- /dev/null +++ b/src/duke/Ui.java @@ -0,0 +1,48 @@ +package duke; + +public class Ui { + + static void printWelcome() { + String logo = " ____ _ \n" + + "| _ \\ _ _| | _____ \n" + + "| | | | | | | |/ / _ \\\n" + + "| |_| | |_| | < __/\n" + + "|____/ \\__,_|_|\\_\\___|\n"; + System.out.println(logo); + System.out.println("Hello! I'm Duke! \n" + + "What would you like to do today? \n" + + "***********************************"); + } + + static void printBye() { + System.out.println("Bye! Stay on task!"); + } + + static void printDone(Task task) { + System.out.println("Good job! I've marked this task as done:\n " + + task + "\n"); + } + + static void printDelete(Task task, int size) { + System.out.println("Alright, I've deleted this task:\n " + + task); + + System.out.println("Now you have " + size + + " task(s) in the list. \n"); + } + + static void printAdd(Task task, int size) { + System.out.println("Alright! I've added this task: \n " + + task + "\nNow you have " + size + + " task(s) in the list. \n"); + } + + static void printIndexError() { + System.out.println("Oh no! This task does not exist. D:\n" ); + } + + static void printDateFormatError() { + System.out.println("Oh no! " + + " Please key in the date in the format YYYY-MM-DD.\n"); + } +} diff --git a/src/duke/data/duke.txt b/src/duke/data/duke.txt new file mode 100644 index 0000000000..29e2d5d0b2 --- /dev/null +++ b/src/duke/data/duke.txt @@ -0,0 +1,6 @@ +TODO[ ] rea +EVNT[ ] play with bingrae (at: 2000-09-08) +TODO[ ] yoz +DDLN[ ] deadline hello (by: 2000-09-08) +EVNT[ ] event y (at: 2003-08-15) +TODO[ ] yellow diff --git a/src/duke/out/production/duke/Duke.class b/src/duke/out/production/duke/Duke.class new file mode 100644 index 0000000000000000000000000000000000000000..e6182872ef3a0bb8effafc837fa99fbaa26b3d56 GIT binary patch literal 1126 zcmaJ=ZBG+H5Pp_IuRRaJA|SrtsemmY=esc_ez1mMa=s)b^@AjrrL1M?^|ra&l92R= z_&4-}CVcP*_@j)oca6}raWA{GGxN+dGrPCH|D62-@DeX6 zTHc3)W6{(M`E40V{fZ%1t~3fLFeGk3!ySx&8@unifxAzWWZ&(lsK6!j(C4|Hff;j( z%2wCirl`QP`-akN}`dTl|XrVdHW_%agjdz}Lj@9~3>EG1txdD!5w zH2T0esgEQToA*s{m7+UbQksSG=h0Ft4f6B2MfkZfZgPgIrA(spdml8;VAoYIZi*dg zN-3IbTLwjk|5_=X=$Lok34NpvlbJl$ZERrE!UJ>4TMR4bgfco&ZQ*6S*}?DdrdIJO z!`F+4GXQ3!yF5A!MY7^6)$VnxqXk~D3{C}vq(6m$B!4kbmGbX^ytEBY? zX&y;Na%%l2*tgVulUCyf&0DlO834<;O + + + + + \ No newline at end of file diff --git a/src/duke/out/production/duke/duke/.idea/modules.xml b/src/duke/out/production/duke/duke/.idea/modules.xml new file mode 100644 index 0000000000..b7a0289b8f --- /dev/null +++ b/src/duke/out/production/duke/duke/.idea/modules.xml @@ -0,0 +1,8 @@ + + + + + + + + \ No newline at end of file diff --git a/src/duke/out/production/duke/duke/.idea/vcs.xml b/src/duke/out/production/duke/duke/.idea/vcs.xml new file mode 100644 index 0000000000..b2bdec2d71 --- /dev/null +++ b/src/duke/out/production/duke/duke/.idea/vcs.xml @@ -0,0 +1,6 @@ + + + + + + \ No newline at end of file diff --git a/src/duke/out/production/duke/duke/.idea/workspace.xml b/src/duke/out/production/duke/duke/.idea/workspace.xml new file mode 100644 index 0000000000..6072bd02a2 --- /dev/null +++ b/src/duke/out/production/duke/duke/.idea/workspace.xml @@ -0,0 +1,77 @@ + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + 1612811109649 + + + + + + + \ No newline at end of file diff --git a/src/duke/out/production/duke/duke/Deadline.class b/src/duke/out/production/duke/duke/Deadline.class new file mode 100644 index 0000000000000000000000000000000000000000..0d330189c9b1c5f499ea56ad74675b1f35b9bb1f GIT binary patch literal 2260 zcmZ`)T~`xV6y29e$RvzFgIN5+Q9$wmq-w1S)>etMsR>X*t!S&ABm;~jGclQ1Y5PZf z>*`Bi+qFt`)m44(Z)pDstE>CY1PBmVi_F}6&pl`FbM`s&_kVxB1#kmDMbHH$gn))1 zx&?YmjSVxkY*ozCvQgg<=)P&$mU~M;iN)`Sp&}eYL_-fWfn%O=+B8aK%Qk6i)zglA z5f3A@R3hj@e+chsh+;sX|EclZNRBWeIIVG!@I>2}bkXOA+8ZP6COr=-dXeW?Y@lgoZG+f6GfdQ`~E(MXw zIz^+LW;`;l8nrr~siUF$p7&pzkpi00a1$RBf`m@29SvowKGE9H2sG zRm}3OusN+uo4Xq3@EL8&roHB_dos<)gNzj27Xl|@nWJQt)sVxyKo3Q@lX8JG2QKU@ zh>AslzH~Y}KUUXc62w?N9>UT-ar+XJjkT=dD=A#nb^I!*_*x*6%jNWvzRAA`RzM{_ z((nzw6}YgM>{X{$G2E0)x9r9_Z^^o|XPnhV!{w_jaJ@bMJB4mb=uuwSR#)*v!*?*4 zJKt*0n^&|WuXboYned|YRuZ_;0aAM}>@?tE<*}@@PKlD}%W|B|H!20Qwrmv2+=+VH zyKmGixo&L++;xlX)0f>hhGv*xPn{XN+MsAgI^c;Px)QW}Yqiui&EysX479^tGA_=u*Sa|5!I>ccyCGom?Iw3QDiKM%f=DP^2>s4g7gqV( z3x&U71UN~<9P(>iX}&eqVR5D6DK=;=J^e##X>YuNy7CIgvWb4RiQXoT-%CV?nmF|m zJ#R3~BmG?>dcKK~oc9=iiSWeR;4e5PPov3Kn0%Ls8pP4hb)FvRkB_M&# fUH^BON-4#m4*vK1mEr|w)}A1TcK!X}MgQ@C$o&Wd literal 0 HcmV?d00001 diff --git a/src/duke/out/production/duke/duke/Duke.class b/src/duke/out/production/duke/duke/Duke.class new file mode 100644 index 0000000000000000000000000000000000000000..4c3ffbd018ae2c64f6db152f9a596181cbef59cf GIT binary patch literal 898 zcmZuwYi|-k6g>kA3(HboS^*zbt1ZwLwDk$5iP89JttM0q@zVesy6wV}Wia}yj9-e8 z#2?^~GTyt3R?|WQ8WOH22VA0~ zB#;U+-%5XK`v!`*${g1O@=K0C`~k@gtm(LE;uiDhLFGG#^h{_{_1<>--iY)Rv2Nl{ z&}zcG&s|r?hCnhXcuCp?v=`ohwv6SB?St8G*WDp8uIdPQzOgSoz;m@=-0V zXBmOCzh2RG2g-fAr4R}Yrm2m#H}m`UD~H7E@+R{ z<`7>4xI!z#fQ~AyW|)8)w&;|^Hg+h&#b2ONCa{;+t$gzJ0;%rS_8jSh1+v|pIr2@d zq@CjO0>y4go1@%}eZ%!q>=d`pT5S*|(?($snMp4xjWSlSh77gLQnMU(Q3yua58I(m tbAu}G(f2+L6Q`_Q`W2!4b?o5*VP%x?5RYiY8nHjd6H+bcKgSLNp`M0fNr80sY2d-#(p|7pK z54;V33?1hi|&fD6n*p>ROcu=qAsI-q4o+^E0{0HJW-iIp5hXc6b%|l6OD;w zs=t9HCQXG>c0{!^hsh$Q3@tliDo@ZqOm<{2G+IJA=B(2m+B0g;$UIUq ZF&4T9!Ka3dn1*5Xf5Z8?!)uYm`WK|MgUJ8@ literal 0 HcmV?d00001 diff --git a/src/duke/out/production/duke/duke/DukeInvalidCommandException.class b/src/duke/out/production/duke/duke/DukeInvalidCommandException.class new file mode 100644 index 0000000000000000000000000000000000000000..11483aaa3e32ce3a71c02f15672ede11d9d9dfbc GIT binary patch literal 597 zcma)2%T7Wu5Iu#<8$khIyW&P*0c)Qd)Pw|efni^`4OF$&hOE028Q#UTvvQ4Gs)!6Gu|3-9%vu@KB!?y5M zkS`t`+gBroz2;xK#GLF&d-K$E}%9LhUUx_Pg>z1>*ddFI9tIph$}d(asqi zS_MU6y0mo4vlN|Bm61^<|Kg<2)+bIzQJ4n17}u(w`USNpMKnTB>(^b literal 0 HcmV?d00001 diff --git a/src/duke/out/production/duke/duke/Event.class b/src/duke/out/production/duke/duke/Event.class new file mode 100644 index 0000000000000000000000000000000000000000..f4ea508aae4659e5d28a71b3f0e1b5c2a5fec579 GIT binary patch literal 2246 zcmZ`)YgZFj6y29e$Rvz{L44qA0MR^vv|1m4wG{$wYCtq86>Y6UGQdbO6O#$mwtvKL zU4H4;cC8XvbydIjFLd>vu)4bMOn{&vtYqfid+s@VpR>>5@BjXM3t${SN6-N!gn))1 zIt7jv>+5DJZM$W)|GZ_@fXm2n>1f( zZcIZQ2?4d>*sfvO#CN9k`t+Jn%@Mh27fhm5F(Pp3-kNSZ1NuVAG-{^KT$@$huys?W zT`wB0Ii^o6L?qBLS;W+PoOdC4#rs&p6>SNbYg95D3kS>hR<<_r7SQjcbMq_H8QPY zns0_Xp-YLe%I+(H6S2%;!pdrx!@NKjWw@JkfwS*jI8YK5 z3j*CUi}U&6njVuNhHLQ<9vqOjFEZIzc@1An>8h^dS3$)$?3%f`IlZXAYW> ze2eb{2KSS_;#A9qo0934%{c2VS$TGiv$9~ge6iF(>w zG^&^!|8bw*xK#8o`TJpj05!oJoSaNio zS(@%HBRQvDEtqmkhL?k2Oa{dO`>TU<9h?L5+X(@aZ@0M10f|Ur3nHOxBJ?{~9a!P- zQ7HTkBf$9?=3HOpO7pF;28$~d&#+Ew>FFO@OZ%s9pe}9UNH(E1aI}HrcN5W54fMZ4 z*BhMYiT*AT9cW-^&U;*bh49GR;Ac|J26(p8O8R!s!(Y&q3=sOS zP(2EXo{*o6=#*qG2`V1Rbg>vC*Xbq)B;(i>AE9j%^v;6O}uOGdsAAy&9 e{->Bqsl-!l{2%lywF_Kt@po#^-;ZAOpZ*6_`2%tQ literal 0 HcmV?d00001 diff --git a/src/duke/out/production/duke/duke/Parser.class b/src/duke/out/production/duke/duke/Parser.class new file mode 100644 index 0000000000000000000000000000000000000000..7eaee2cbd257e17e4fa8cc7ba9460055c97ed0ce GIT binary patch literal 4036 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 literal 0 HcmV?d00001 diff --git a/src/duke/out/production/duke/duke/TaskList.class b/src/duke/out/production/duke/duke/TaskList.class new file mode 100644 index 0000000000000000000000000000000000000000..da891bcaef2ad381af84ffc810b4c824d8869db9 GIT binary patch literal 2372 zcmZ`*-&Yey7`+n$OTvT*VnDHqQX~XQRBW|Et%}mdBG^WuYHeM}8dt(D-E64XpAY>T z`UmvIXM1W&dro`$-2O*BJ+*gcH_Kw_LuPkozq#MN_xpA>fBf^yZvfuJH)$l$W*{li zjt+r+kIYT8STmh!adG95wdxCW%-D|YUl3@^k1eIpiIjn~L>Ht$rqWomiZ{*r+Pqz7 ztWoz}&#YPk-ShfUIhaqYeccjS>=Q`VbnJn7ovY#7wc;huGq)7PbQ-=-RZBSZB*LI6HJlpZhzGs>1)17#gtVSx6LnHMOCyf&rHISDWLqVWt$IO!BTUE=W zLz`x;VJ$uo$mL6+0&RB~K?4RbA@Ld}nYn7I%)0}Fx=b55DUgc%Pos#_5>q%sKE6wO zwo?`8Yq_Lz1glK(2F@BdC)oh!TNdpW#4}6Xz+>I@Td_pa|Vd&3{fJm#1 z7bM=sMLM8?YmO2Yg9*8fEh#0JC1!DjO4dzp?TYKLRv9XZ)KbD6-ZAj5L4-)TwshxXI~4E$<|VExXFEJ=-QBbdED8+A%T%!*FE;$e2bbN3Q>kBlylQRuw#&-S z;eCk@)H{;ZDM}7QuX>*Asg}JdaSKZ%TsJqZpg{*hbuTrz;xUI0C2r%6KvzK5s#!iY zX5)lQ0ppJ(?%`whf?27&WLeAkJIb>A5~eD?^j(!duv1Z6Rn#u3q?W`3m9$eQy`=C` zWxMK_e#2w-<9oeNGcgMJyN z!&?peC(}AsCslv)bn4_$4gKRW3W2JgJ>vQYRDMiV{Hk=c=@ zzGc9EBKGO50iKMq)+3znXqJkdZJQY+Ql^Ri?{V@6ywW?|{wor<+Xj>Ow=q(_om5W; zn;8Ec#U@Ubn|OWsTOppl_)`T>H}RHAABfM%U<3Go-sDn|G$)OtTOI~SvHeWHm=%M;tUx}!Sq{0QAUiXIH{yLl|;c`j0) z!(*LXvb0-xqV<0sW&4?PRlBKpw($PF<)<(fwsC`VL#;JYo(Qh}+gN@^!s>H9fQ8VB zc@My7Bfv1c1Y11Z{qH<;>?>*nphc+I9Fb_Z<19g68|JkJQY=pI1!^E O&4UL5z9N1CU;hhpc=UMy literal 0 HcmV?d00001 diff --git a/src/duke/out/production/duke/duke/TimedTask.class b/src/duke/out/production/duke/duke/TimedTask.class new file mode 100644 index 0000000000000000000000000000000000000000..f5f0ea8eeef0dafbc62d12091d2f02b69bc0ea38 GIT binary patch literal 489 zcma)2Jx{|h5PfdaCJm-7rR8H}YZ>ssgo=<5h$&)e)ZJ~YVwxsW>hQZ@LSo7Aa;nNiPBTKfYt}@T+P*iSZyxlDp%edgA)RPkROL+B z$!Un>+yBgtjuW(KV1Uu-V2`3lhgL#Jm$GxZZLNO#3id)t4f_=BFM$v~Ev82qcO>+2 kKswiUT^j-MOCWgu5wQB!XInGvZcFpdKbooSaBXq)1yheus{jB1 literal 0 HcmV?d00001 diff --git a/src/duke/out/production/duke/duke/ToDo.class b/src/duke/out/production/duke/duke/ToDo.class new file mode 100644 index 0000000000000000000000000000000000000000..7074ef883cb08559c6cba605a16a56ef715b944b GIT binary patch literal 1694 zcmaKs%W@k<6o&t{E+dV{v7;n*Vq%*ljNzaI`HjP7=RRM}{pcW?o-0!dnS1kSIHvCH710E3>v zyo1+pnF+Yx^`#%40^Z$!;x=_T|H#6kz_mfbRc5^%G*zeTyV|X&PDcitg*W8UkV{hJau#UF{<~p)XqM#}Dm!3Z0D%3L2%xYy^8%B{#gj){YF%cZCwmjdB zqL84XTI8Fqd4c<&-`RJ24Y}|0Bv(^S>F>#&XZG=7QXhB>J6Vfnggq_`*j?ERS-WnZ z87++^8a7XPk!4b=mJ*n%YuRk?$Zj0MKCU?f+20cNp(|T%kElKwc~)2bUeh&6aCRDG zSTi%l(Ym9Q<{-)Lj;jw;E1XW_QycfNZQ(Oh%KHM#C*$V@PZb9}DnwM>E!otn_e|iY z;VfdqNc0}3!gs^vno{k4w>(04d3V9iHvyBe8`;<$i@O2^f1EdLh%UJX@x8;?SaBQ%1-gB;uV5v20F_xHir_<4WX>#BLaYyd2BE(fsY3}@d{ThLVv0YHd}b(1+#<+7xmG!87#m_5ACP} wGn?iji4{t*f*FFFr=62S&Z)S42~-9ls<_K{hVEN@YIwk%&DAcxKpmI<0a;jJC;$Ke literal 0 HcmV?d00001 diff --git a/src/duke/out/production/duke/duke/Ui.class b/src/duke/out/production/duke/duke/Ui.class new file mode 100644 index 0000000000000000000000000000000000000000..66dc673686a3645533eeebfed879f5f59e64d18c GIT binary patch literal 2165 zcma)7>rxvx7(D`lm&GxuNeGZO5e*Pb0r%bp)1+KNaAGbkx9OA_kMOE^@p{GVu1VbC zLHZi)k9LM1eSkhxr=PTIV}hscdMs(B?;M@)BJE#)U;YW;DfVsjpf`oSG;X1v;m)Zz z7kN+kC;9E;Q(1`^`j=eajh->|&g2d(SPUUA)5DXeJ+Lo0FY_b%Q-8rPj8&P_^tE4} z=e3!hHdb-V`4XYZdHX_h=lM~&JXfZrqcV-k7xn;b45pAy<2EwabnZ68NY+W7YLMD{ zCF6ms@;ia+N4rrVMZI9-4&F;4o5nEiG7NXIVMv{6gy$2ts|Pxxjp;ekA+c&>`IdecO%i{ z%IA>?YZF;Y(|8&W@IJ%+x~R!j=tfl1km1ox$ssZMJ%SW+H^pbcFrKAU zKhjiOdsysh){76d#bXBEN!iWV!W6^gc9r`Sj=icI8o}hY3~4Ij@~s<23w&+Sw(x}E zX=2HDJSjrSYqH5*a&`Cz-Z)RU@d#byxeI+IJVUemWT|N=0E5h_g)@Rh1JC^<%}x zD%MhXp>w-VS-W!8_0JU*PV8}9TkE0{si4X5OXo323}ey_;X9rTCre7z8fS%@q3f8r z2Hb0&$u8zUcG$=F&b2B|C{~5%?YfaHSlD35zf{WMr|MWA#&gN*BB)7+3aV9!BBWyU z<)W=GDn?cKieY-$3*3`xG#6tWlbjAvVr-$rFtw%Lm=j$UM9)ll&xE;FrFy2kiFS+O zRYIFc5suTTWRYtL%>G||RG&rPm%*wh!cc}Od`C)dcb{T04Wi1vv{Z!s1VePD=a z{NNG~-yzMAOP~{$rj=1}Lp&0L6JnyFkM1H-TcohH#X8~i78$(-@lL$M8;gBR@}@gD zGi}aHn{%mq$R@jlEJqS%>Hkf4$aELTJelW7>od~YgXj2``f*C;GWqk;v_;dtHti<1 OY2Bu^9ej^HjQs;_FXyEI literal 0 HcmV?d00001 diff --git a/src/duke/out/production/duke/duke/data/duke.txt b/src/duke/out/production/duke/duke/data/duke.txt new file mode 100644 index 0000000000..2c84e94347 --- /dev/null +++ b/src/duke/out/production/duke/duke/data/duke.txt @@ -0,0 +1,5 @@ +TODO[ ] rea +EVNT[ ] play with bingrae (at: 2000-09-08) +TODO[ ] yoz +DDLN[ ] deadline hello (by: 2000-09-08) +EVNT[ ] event y (at: 2003-08-15) From b785eecf7096fc0a53a25b03fd8429a29aaa961c Mon Sep 17 00:00:00 2001 From: andrea-twl Date: Wed, 17 Feb 2021 03:48:14 +0800 Subject: [PATCH 10/23] A-JUnit (added ParserTest.java, TodoTest.java and DukeTest.java) --- src/duke/.idea/modules.xml | 1 + src/duke/.idea/workspace.xml | 49 +++++++++++++++++- src/duke/Event.java | 6 ++- src/duke/Parser.java | 12 ++--- src/duke/Task.java | 4 +- src/duke/ToDo.java | 2 +- src/duke/data/duke.txt | 4 ++ .../production/duke/duke/.idea/modules.xml | 1 + .../production/duke/duke/.idea/workspace.xml | 28 +++++++++- src/duke/out/production/duke/duke/Event.class | Bin 2246 -> 935 bytes .../out/production/duke/duke/Parser.class | Bin 4036 -> 3990 bytes src/duke/out/production/duke/duke/Task.class | Bin 1834 -> 1799 bytes .../out/production/duke/duke/TimedTask.class | Bin 489 -> 298 bytes src/duke/out/production/duke/duke/ToDo.class | Bin 1694 -> 1608 bytes .../out/production/duke/duke/data/duke.txt | 5 ++ src/duke/out/test/test/DukeTest.class | Bin 0 -> 249 bytes src/duke/out/test/test/ParserTest.class | Bin 0 -> 1321 bytes src/duke/out/test/test/ToDoTest.class | Bin 0 -> 705 bytes src/test/java/DukeTest.java | 27 ++++++++++ src/test/java/ParserTest.java | 24 +++++++++ src/test/java/ToDoTest.java | 13 +++++ 21 files changed, 161 insertions(+), 15 deletions(-) create mode 100644 src/duke/out/test/test/DukeTest.class create mode 100644 src/duke/out/test/test/ParserTest.class create mode 100644 src/duke/out/test/test/ToDoTest.class create mode 100644 src/test/java/DukeTest.java create mode 100644 src/test/java/ParserTest.java create mode 100644 src/test/java/ToDoTest.java diff --git a/src/duke/.idea/modules.xml b/src/duke/.idea/modules.xml index b7a0289b8f..719caab61a 100644 --- a/src/duke/.idea/modules.xml +++ b/src/duke/.idea/modules.xml @@ -3,6 +3,7 @@ + \ No newline at end of file diff --git a/src/duke/.idea/workspace.xml b/src/duke/.idea/workspace.xml index 6072bd02a2..87adeb1d1e 100644 --- a/src/duke/.idea/workspace.xml +++ b/src/duke/.idea/workspace.xml @@ -24,14 +24,18 @@