From ecd0cda4edf4f8f90a7247d87e427f212f11d285 Mon Sep 17 00:00:00 2001
From: KuanHsienn <141622026+KuanHsienn@users.noreply.github.com>
Date: Wed, 18 Sep 2024 13:47:07 +0800
Subject: [PATCH 001/619] Update README.md
---
README.md | 4 ++--
1 file changed, 2 insertions(+), 2 deletions(-)
diff --git a/README.md b/README.md
index e243ece764..7eeb8deef8 100644
--- a/README.md
+++ b/README.md
@@ -1,6 +1,6 @@
-# Duke project template
+# EventManagerCLI
-This is a project template for a greenfield Java project. It's named after the Java mascot _Duke_. Given below are instructions on how to use it.
+This is a project template for a greenfield Java project. It's named after the Java mascot EventManagerCLI. Given below are instructions on how to use it.
## Setting up in Intellij
From 701e10e34748dbd3ade264d51b951283a02f22ee Mon Sep 17 00:00:00 2001
From: jemehgoh
Date: Tue, 1 Oct 2024 12:46:23 +0800
Subject: [PATCH 002/619] Add Ui class and greetUser method
---
src/main/java/seedu/duke/ui/Ui.java | 13 +++++++++++++
1 file changed, 13 insertions(+)
create mode 100644 src/main/java/seedu/duke/ui/Ui.java
diff --git a/src/main/java/seedu/duke/ui/Ui.java b/src/main/java/seedu/duke/ui/Ui.java
new file mode 100644
index 0000000000..d967546616
--- /dev/null
+++ b/src/main/java/seedu/duke/ui/Ui.java
@@ -0,0 +1,13 @@
+package seedu.duke.ui;
+
+/**
+ * Represents the program's user interface
+ */
+public class Ui {
+ /**
+ * Greets user upon program startup
+ */
+ public void greetUser() {
+ System.out.println("Welcome to EventManagerCLI.");
+ }
+}
From e4d5a6ddb9bd029f79be29557b36bb6a6c259e55 Mon Sep 17 00:00:00 2001
From: jemehgoh
Date: Tue, 1 Oct 2024 19:16:36 +0800
Subject: [PATCH 003/619] Rewrite main function in Duke to use Ui class
---
src/main/java/seedu/duke/Duke.java | 17 +++++------------
1 file changed, 5 insertions(+), 12 deletions(-)
diff --git a/src/main/java/seedu/duke/Duke.java b/src/main/java/seedu/duke/Duke.java
index 5c74e68d59..fe35fe8b1e 100644
--- a/src/main/java/seedu/duke/Duke.java
+++ b/src/main/java/seedu/duke/Duke.java
@@ -1,21 +1,14 @@
package seedu.duke;
-import java.util.Scanner;
+import seedu.duke.ui.Ui;
public class Duke {
+ private static final Ui ui = new Ui();
+
/**
- * Main entry-point for the java.duke.Duke application.
+ * Main entry-point for the EventManagerCLI application.
*/
public static void main(String[] args) {
- String logo = " ____ _ \n"
- + "| _ \\ _ _| | _____ \n"
- + "| | | | | | | |/ / _ \\\n"
- + "| |_| | |_| | < __/\n"
- + "|____/ \\__,_|_|\\_\\___|\n";
- System.out.println("Hello from\n" + logo);
- System.out.println("What is your name?");
-
- Scanner in = new Scanner(System.in);
- System.out.println("Hello " + in.nextLine());
+ ui.greetUser();
}
}
From 8d80e0f6d940d42cebc7da9e28af6d7e0b5fb3d1 Mon Sep 17 00:00:00 2001
From: jemehgoh
Date: Tue, 1 Oct 2024 19:20:08 +0800
Subject: [PATCH 004/619] Rename Duke class to Main
---
src/main/java/seedu/duke/{Duke.java => Main.java} | 2 +-
1 file changed, 1 insertion(+), 1 deletion(-)
rename src/main/java/seedu/duke/{Duke.java => Main.java} (92%)
diff --git a/src/main/java/seedu/duke/Duke.java b/src/main/java/seedu/duke/Main.java
similarity index 92%
rename from src/main/java/seedu/duke/Duke.java
rename to src/main/java/seedu/duke/Main.java
index fe35fe8b1e..d81e967bd7 100644
--- a/src/main/java/seedu/duke/Duke.java
+++ b/src/main/java/seedu/duke/Main.java
@@ -2,7 +2,7 @@
import seedu.duke.ui.Ui;
-public class Duke {
+public class Main {
private static final Ui ui = new Ui();
/**
From 0873f95114525516686dbf4903c8caf3a07fbe7e Mon Sep 17 00:00:00 2001
From: jemehgoh
Date: Tue, 1 Oct 2024 23:22:12 +0800
Subject: [PATCH 005/619] Update build.gradle to account for change in main
class name
---
build.gradle | 2 +-
1 file changed, 1 insertion(+), 1 deletion(-)
diff --git a/build.gradle b/build.gradle
index ea82051fab..4eabb40270 100644
--- a/build.gradle
+++ b/build.gradle
@@ -29,7 +29,7 @@ test {
}
application {
- mainClass.set("seedu.duke.Duke")
+ mainClass.set("seedu.duke.Main")
}
shadowJar {
From 6a69515986059edc217e6e14613890256b7122aa Mon Sep 17 00:00:00 2001
From: jemehgoh
Date: Tue, 1 Oct 2024 23:23:36 +0800
Subject: [PATCH 006/619] Update text redirection tests to follow changes in
code behaviour
---
text-ui-test/EXPECTED.TXT | 10 +---------
text-ui-test/input.txt | 2 +-
2 files changed, 2 insertions(+), 10 deletions(-)
diff --git a/text-ui-test/EXPECTED.TXT b/text-ui-test/EXPECTED.TXT
index 892cb6cae7..282a9429be 100644
--- a/text-ui-test/EXPECTED.TXT
+++ b/text-ui-test/EXPECTED.TXT
@@ -1,9 +1 @@
-Hello from
- ____ _
-| _ \ _ _| | _____
-| | | | | | | |/ / _ \
-| |_| | |_| | < __/
-|____/ \__,_|_|\_\___|
-
-What is your name?
-Hello James Gosling
+Welcome to EventManagerCLI.
diff --git a/text-ui-test/input.txt b/text-ui-test/input.txt
index f6ec2e9f95..8b13789179 100644
--- a/text-ui-test/input.txt
+++ b/text-ui-test/input.txt
@@ -1 +1 @@
-James Gosling
\ No newline at end of file
+
From 261f7febc337dca8f4abc9cecaea3ac8a1015596 Mon Sep 17 00:00:00 2001
From: fuyixuan
Date: Wed, 2 Oct 2024 13:15:34 +0800
Subject: [PATCH 007/619] update AboutUs
---
docs/AboutUs.md | 11 ++++-------
1 file changed, 4 insertions(+), 7 deletions(-)
diff --git a/docs/AboutUs.md b/docs/AboutUs.md
index 0f072953ea..3490c1b351 100644
--- a/docs/AboutUs.md
+++ b/docs/AboutUs.md
@@ -1,9 +1,6 @@
# About us
-Display | Name | Github Profile | Portfolio
---------|:----:|:--------------:|:---------:
-![](https://via.placeholder.com/100.png?text=Photo) | John Doe | [Github](https://github.com/) | [Portfolio](docs/team/johndoe.md)
-![](https://via.placeholder.com/100.png?text=Photo) | Don Joe | [Github](https://github.com/) | [Portfolio](docs/team/johndoe.md)
-![](https://via.placeholder.com/100.png?text=Photo) | Ron John | [Github](https://github.com/) | [Portfolio](docs/team/johndoe.md)
-![](https://via.placeholder.com/100.png?text=Photo) | John Roe | [Github](https://github.com/) | [Portfolio](docs/team/johndoe.md)
-![](https://via.placeholder.com/100.png?text=Photo) | Don Roe | [Github](https://github.com/) | [Portfolio](docs/team/johndoe.md)
+Display | Name | Github Profile | Portfolio
+--------|:---------:|:--------------:|:---------:
+![](https://via.placeholder.com/100.png?text=Photo) | FU Yixuan | [Github](https://github.com/MatchaRRR) | [Portfolio](docs/team/yixuan.md)
+
From 69e199cfce89f9927fe0dfb330245ee874294569 Mon Sep 17 00:00:00 2001
From: jemehgoh
Date: Wed, 2 Oct 2024 13:15:53 +0800
Subject: [PATCH 008/619] Update personal details in AboutUs
---
docs/AboutUs.md | 11 ++++-------
1 file changed, 4 insertions(+), 7 deletions(-)
diff --git a/docs/AboutUs.md b/docs/AboutUs.md
index 0f072953ea..9f2a303d2d 100644
--- a/docs/AboutUs.md
+++ b/docs/AboutUs.md
@@ -1,9 +1,6 @@
# About us
-Display | Name | Github Profile | Portfolio
---------|:----:|:--------------:|:---------:
-![](https://via.placeholder.com/100.png?text=Photo) | John Doe | [Github](https://github.com/) | [Portfolio](docs/team/johndoe.md)
-![](https://via.placeholder.com/100.png?text=Photo) | Don Joe | [Github](https://github.com/) | [Portfolio](docs/team/johndoe.md)
-![](https://via.placeholder.com/100.png?text=Photo) | Ron John | [Github](https://github.com/) | [Portfolio](docs/team/johndoe.md)
-![](https://via.placeholder.com/100.png?text=Photo) | John Roe | [Github](https://github.com/) | [Portfolio](docs/team/johndoe.md)
-![](https://via.placeholder.com/100.png?text=Photo) | Don Roe | [Github](https://github.com/) | [Portfolio](docs/team/johndoe.md)
+Display | Name | Github Profile | Portfolio
+--------|:----------:|:--------------:|:---------:
+![](https://via.placeholder.com/100.png?text=Photo) | Jeremy Goh | [Github](https://github.com/jemehgoh) | [Portfolio](docs/team/johndoe.md)
+
From 1ce1df29e3546288f55ea5319120721c9a55a53e Mon Sep 17 00:00:00 2001
From: glenn-chew
Date: Wed, 2 Oct 2024 13:20:08 +0800
Subject: [PATCH 009/619] Update AboutUs with personal details
---
docs/AboutUs.md | 10 +++-------
1 file changed, 3 insertions(+), 7 deletions(-)
diff --git a/docs/AboutUs.md b/docs/AboutUs.md
index 0f072953ea..d25d371c24 100644
--- a/docs/AboutUs.md
+++ b/docs/AboutUs.md
@@ -1,9 +1,5 @@
# About us
-Display | Name | Github Profile | Portfolio
---------|:----:|:--------------:|:---------:
-![](https://via.placeholder.com/100.png?text=Photo) | John Doe | [Github](https://github.com/) | [Portfolio](docs/team/johndoe.md)
-![](https://via.placeholder.com/100.png?text=Photo) | Don Joe | [Github](https://github.com/) | [Portfolio](docs/team/johndoe.md)
-![](https://via.placeholder.com/100.png?text=Photo) | Ron John | [Github](https://github.com/) | [Portfolio](docs/team/johndoe.md)
-![](https://via.placeholder.com/100.png?text=Photo) | John Roe | [Github](https://github.com/) | [Portfolio](docs/team/johndoe.md)
-![](https://via.placeholder.com/100.png?text=Photo) | Don Roe | [Github](https://github.com/) | [Portfolio](docs/team/johndoe.md)
+Display | Name | Github Profile | Portfolio
+--------|:----------:|:--------------:|:---------:
+![](https://via.placeholder.com/100.png?text=Photo) | Glenn Chew | [Github](https://github.com/glenn-chew) | [Portfolio](docs/team/johndoe.md)
From 2f33efc2dd8258b10c9d90652eddaa2de91cbf97 Mon Sep 17 00:00:00 2001
From: LTK-1606
Date: Wed, 2 Oct 2024 13:23:06 +0800
Subject: [PATCH 010/619] Update aboutus with my details
---
docs/AboutUs.md | 11 ++++-------
1 file changed, 4 insertions(+), 7 deletions(-)
diff --git a/docs/AboutUs.md b/docs/AboutUs.md
index 0f072953ea..ba807a323d 100644
--- a/docs/AboutUs.md
+++ b/docs/AboutUs.md
@@ -1,9 +1,6 @@
# About us
-Display | Name | Github Profile | Portfolio
---------|:----:|:--------------:|:---------:
-![](https://via.placeholder.com/100.png?text=Photo) | John Doe | [Github](https://github.com/) | [Portfolio](docs/team/johndoe.md)
-![](https://via.placeholder.com/100.png?text=Photo) | Don Joe | [Github](https://github.com/) | [Portfolio](docs/team/johndoe.md)
-![](https://via.placeholder.com/100.png?text=Photo) | Ron John | [Github](https://github.com/) | [Portfolio](docs/team/johndoe.md)
-![](https://via.placeholder.com/100.png?text=Photo) | John Roe | [Github](https://github.com/) | [Portfolio](docs/team/johndoe.md)
-![](https://via.placeholder.com/100.png?text=Photo) | Don Roe | [Github](https://github.com/) | [Portfolio](docs/team/johndoe.md)
+Display | Name | Github Profile | Portfolio
+--------|:------------:|:-------------------------------:|:---------:
+![](https://via.placeholder.com/100.png?text=Photo) | Lim Tze Kang | [LTK-1606](https://github.com/LTK-1606) | [Portfolio](docs/team/johndoe.md)
+
From 5c86d106dfa899d736b3633f5ca603f5718690a2 Mon Sep 17 00:00:00 2001
From: KuanHsienn
Date: Wed, 2 Oct 2024 13:27:13 +0800
Subject: [PATCH 011/619] Modify About Us
---
docs/AboutUs.md | 11 ++++-------
1 file changed, 4 insertions(+), 7 deletions(-)
diff --git a/docs/AboutUs.md b/docs/AboutUs.md
index 0f072953ea..da3991f350 100644
--- a/docs/AboutUs.md
+++ b/docs/AboutUs.md
@@ -1,9 +1,6 @@
# About us
-Display | Name | Github Profile | Portfolio
---------|:----:|:--------------:|:---------:
-![](https://via.placeholder.com/100.png?text=Photo) | John Doe | [Github](https://github.com/) | [Portfolio](docs/team/johndoe.md)
-![](https://via.placeholder.com/100.png?text=Photo) | Don Joe | [Github](https://github.com/) | [Portfolio](docs/team/johndoe.md)
-![](https://via.placeholder.com/100.png?text=Photo) | Ron John | [Github](https://github.com/) | [Portfolio](docs/team/johndoe.md)
-![](https://via.placeholder.com/100.png?text=Photo) | John Roe | [Github](https://github.com/) | [Portfolio](docs/team/johndoe.md)
-![](https://via.placeholder.com/100.png?text=Photo) | Don Roe | [Github](https://github.com/) | [Portfolio](docs/team/johndoe.md)
+Display | Name | Github Profile | Portfolio
+--------|:----------------:|:--------------:|:---------:
+![](https://via.placeholder.com/100.png?text=Photo) | Liang Kuan Hsien | https://github.com/KuanHsienn/tp.git | [Portfolio](docs/team/johndoe.md)
+
From 51355b37e8b67be1d5bd1910cbf7b1220024c7da Mon Sep 17 00:00:00 2001
From: jemehgoh
Date: Wed, 2 Oct 2024 13:44:15 +0800
Subject: [PATCH 012/619] Change main package name from seedu.duke to
seedu.manager
---
build.gradle | 2 +-
src/main/java/seedu/{duke => manager}/Main.java | 2 +-
src/main/java/seedu/{duke => manager}/ui/Ui.java | 2 +-
src/test/java/seedu/{duke => manager}/DukeTest.java | 2 +-
4 files changed, 4 insertions(+), 4 deletions(-)
rename src/main/java/seedu/{duke => manager}/Main.java (89%)
rename src/main/java/seedu/{duke => manager}/ui/Ui.java (89%)
rename src/test/java/seedu/{duke => manager}/DukeTest.java (89%)
diff --git a/build.gradle b/build.gradle
index 4eabb40270..f0dd47388b 100644
--- a/build.gradle
+++ b/build.gradle
@@ -29,7 +29,7 @@ test {
}
application {
- mainClass.set("seedu.duke.Main")
+ mainClass.set("seedu.manager.Main")
}
shadowJar {
diff --git a/src/main/java/seedu/duke/Main.java b/src/main/java/seedu/manager/Main.java
similarity index 89%
rename from src/main/java/seedu/duke/Main.java
rename to src/main/java/seedu/manager/Main.java
index d81e967bd7..4ad54a8b26 100644
--- a/src/main/java/seedu/duke/Main.java
+++ b/src/main/java/seedu/manager/Main.java
@@ -1,6 +1,6 @@
package seedu.duke;
-import seedu.duke.ui.Ui;
+import seedu.manager.ui.Ui;
public class Main {
private static final Ui ui = new Ui();
diff --git a/src/main/java/seedu/duke/ui/Ui.java b/src/main/java/seedu/manager/ui/Ui.java
similarity index 89%
rename from src/main/java/seedu/duke/ui/Ui.java
rename to src/main/java/seedu/manager/ui/Ui.java
index d967546616..bbe06007f3 100644
--- a/src/main/java/seedu/duke/ui/Ui.java
+++ b/src/main/java/seedu/manager/ui/Ui.java
@@ -1,4 +1,4 @@
-package seedu.duke.ui;
+package seedu.manager.ui;
/**
* Represents the program's user interface
diff --git a/src/test/java/seedu/duke/DukeTest.java b/src/test/java/seedu/manager/DukeTest.java
similarity index 89%
rename from src/test/java/seedu/duke/DukeTest.java
rename to src/test/java/seedu/manager/DukeTest.java
index 2dda5fd651..7b9f930b03 100644
--- a/src/test/java/seedu/duke/DukeTest.java
+++ b/src/test/java/seedu/manager/DukeTest.java
@@ -1,4 +1,4 @@
-package seedu.duke;
+package seedu.manager;
import static org.junit.jupiter.api.Assertions.assertTrue;
From 81a44d7ef95b749af871d7c5f2ba76be460f9153 Mon Sep 17 00:00:00 2001
From: jemehgoh
Date: Wed, 2 Oct 2024 13:46:49 +0800
Subject: [PATCH 013/619] Update package at top of Main
---
src/main/java/seedu/manager/Main.java | 2 +-
1 file changed, 1 insertion(+), 1 deletion(-)
diff --git a/src/main/java/seedu/manager/Main.java b/src/main/java/seedu/manager/Main.java
index 4ad54a8b26..a5dedf0bcf 100644
--- a/src/main/java/seedu/manager/Main.java
+++ b/src/main/java/seedu/manager/Main.java
@@ -1,4 +1,4 @@
-package seedu.duke;
+package seedu.manager;
import seedu.manager.ui.Ui;
From 45155adf828b7793d3536d6e860ea5172c765800 Mon Sep 17 00:00:00 2001
From: jemehgoh
Date: Wed, 2 Oct 2024 13:53:44 +0800
Subject: [PATCH 014/619] Extract welcome message in Ui to a Messages container
class
---
src/main/java/seedu/manager/common/Messages.java | 8 ++++++++
src/main/java/seedu/manager/ui/Ui.java | 5 ++++-
2 files changed, 12 insertions(+), 1 deletion(-)
create mode 100644 src/main/java/seedu/manager/common/Messages.java
diff --git a/src/main/java/seedu/manager/common/Messages.java b/src/main/java/seedu/manager/common/Messages.java
new file mode 100644
index 0000000000..caaaaf2954
--- /dev/null
+++ b/src/main/java/seedu/manager/common/Messages.java
@@ -0,0 +1,8 @@
+package seedu.manager.common;
+
+/**
+ * Represents a container class for messages for the user
+ */
+public class Messages {
+ public static final String WELCOME_MESSAGE = "Welcome to EventManagerCLI.";
+}
diff --git a/src/main/java/seedu/manager/ui/Ui.java b/src/main/java/seedu/manager/ui/Ui.java
index bbe06007f3..c02dc8e909 100644
--- a/src/main/java/seedu/manager/ui/Ui.java
+++ b/src/main/java/seedu/manager/ui/Ui.java
@@ -1,13 +1,16 @@
package seedu.manager.ui;
+import seedu.manager.common.Messages;
+
/**
* Represents the program's user interface
*/
public class Ui {
+
/**
* Greets user upon program startup
*/
public void greetUser() {
- System.out.println("Welcome to EventManagerCLI.");
+ System.out.println(Messages.WELCOME_MESSAGE);
}
}
From 9a481124a3ae3a0fdd8bc538ad6148aee35f446d Mon Sep 17 00:00:00 2001
From: jemehgoh
Date: Fri, 4 Oct 2024 15:11:38 +0800
Subject: [PATCH 015/619] Move welcome message back into Ui class
---
src/main/java/seedu/manager/common/Messages.java | 8 --------
src/main/java/seedu/manager/ui/Ui.java | 6 ++----
2 files changed, 2 insertions(+), 12 deletions(-)
delete mode 100644 src/main/java/seedu/manager/common/Messages.java
diff --git a/src/main/java/seedu/manager/common/Messages.java b/src/main/java/seedu/manager/common/Messages.java
deleted file mode 100644
index caaaaf2954..0000000000
--- a/src/main/java/seedu/manager/common/Messages.java
+++ /dev/null
@@ -1,8 +0,0 @@
-package seedu.manager.common;
-
-/**
- * Represents a container class for messages for the user
- */
-public class Messages {
- public static final String WELCOME_MESSAGE = "Welcome to EventManagerCLI.";
-}
diff --git a/src/main/java/seedu/manager/ui/Ui.java b/src/main/java/seedu/manager/ui/Ui.java
index c02dc8e909..329cb6c6d9 100644
--- a/src/main/java/seedu/manager/ui/Ui.java
+++ b/src/main/java/seedu/manager/ui/Ui.java
@@ -1,16 +1,14 @@
package seedu.manager.ui;
-import seedu.manager.common.Messages;
-
/**
* Represents the program's user interface
*/
public class Ui {
-
+ public static final String WELCOME_MESSAGE = "Welcome to EventManagerCLI.";
/**
* Greets user upon program startup
*/
public void greetUser() {
- System.out.println(Messages.WELCOME_MESSAGE);
+ System.out.println(WELCOME_MESSAGE);
}
}
From a160487536b2407ad1825447b845d327257f8917 Mon Sep 17 00:00:00 2001
From: jemehgoh
Date: Fri, 4 Oct 2024 23:06:30 +0800
Subject: [PATCH 016/619] Move ui package out of seedu.manager package
---
src/main/java/seedu/manager/Main.java | 2 +-
src/main/java/{seedu/manager => }/ui/Ui.java | 2 +-
2 files changed, 2 insertions(+), 2 deletions(-)
rename src/main/java/{seedu/manager => }/ui/Ui.java (91%)
diff --git a/src/main/java/seedu/manager/Main.java b/src/main/java/seedu/manager/Main.java
index a5dedf0bcf..ad393076ea 100644
--- a/src/main/java/seedu/manager/Main.java
+++ b/src/main/java/seedu/manager/Main.java
@@ -1,6 +1,6 @@
package seedu.manager;
-import seedu.manager.ui.Ui;
+import ui.Ui;
public class Main {
private static final Ui ui = new Ui();
diff --git a/src/main/java/seedu/manager/ui/Ui.java b/src/main/java/ui/Ui.java
similarity index 91%
rename from src/main/java/seedu/manager/ui/Ui.java
rename to src/main/java/ui/Ui.java
index 329cb6c6d9..e98bd0383f 100644
--- a/src/main/java/seedu/manager/ui/Ui.java
+++ b/src/main/java/ui/Ui.java
@@ -1,4 +1,4 @@
-package seedu.manager.ui;
+package ui;
/**
* Represents the program's user interface
From d0a3071120739e415dedc13e0f91693ad63a5c40 Mon Sep 17 00:00:00 2001
From: jemehgoh
Date: Sat, 5 Oct 2024 10:22:35 +0800
Subject: [PATCH 017/619] Create new abstract Command class for executable
commands
---
src/main/java/command/Command.java | 12 ++++++++++++
1 file changed, 12 insertions(+)
create mode 100644 src/main/java/command/Command.java
diff --git a/src/main/java/command/Command.java b/src/main/java/command/Command.java
new file mode 100644
index 0000000000..5405f597d7
--- /dev/null
+++ b/src/main/java/command/Command.java
@@ -0,0 +1,12 @@
+package command;
+
+/**
+ * Represents an executable command
+ */
+public abstract class Command {
+
+ /**
+ * Handles the command execution
+ */
+ public abstract void execute();
+}
From 2d76d0b4330d54369ce1fc4ecb0752ec326e5b0a Mon Sep 17 00:00:00 2001
From: jemehgoh
Date: Sat, 5 Oct 2024 10:31:32 +0800
Subject: [PATCH 018/619] Add a new EchoCommand class to echo user input
---
src/main/java/command/EchoCommand.java | 25 +++++++++++++++++++++++++
1 file changed, 25 insertions(+)
create mode 100644 src/main/java/command/EchoCommand.java
diff --git a/src/main/java/command/EchoCommand.java b/src/main/java/command/EchoCommand.java
new file mode 100644
index 0000000000..c5ac281da0
--- /dev/null
+++ b/src/main/java/command/EchoCommand.java
@@ -0,0 +1,25 @@
+package command;
+
+/**
+ * Represents an executable echo command
+ */
+public class EchoCommand extends Command{
+ private final String userInput;
+
+ /**
+ * Constructs a new EchoCommand with the given user input
+ *
+ * @param userInput The user input
+ */
+ public EchoCommand(String userInput) {
+ this.userInput = userInput;
+ }
+
+ /**
+ * Executes echo command by printing user input
+ */
+ @Override
+ public void execute() {
+ System.out.println(this.userInput);
+ }
+}
From d95f083f73772618221e0b73759ac8d0bbebe736 Mon Sep 17 00:00:00 2001
From: jemehgoh
Date: Sat, 5 Oct 2024 10:54:31 +0800
Subject: [PATCH 019/619] Add a new Parser class to handle the parsing of user
input
---
src/main/java/parser/Parser.java | 19 +++++++++++++++++++
1 file changed, 19 insertions(+)
create mode 100644 src/main/java/parser/Parser.java
diff --git a/src/main/java/parser/Parser.java b/src/main/java/parser/Parser.java
new file mode 100644
index 0000000000..6e175028c9
--- /dev/null
+++ b/src/main/java/parser/Parser.java
@@ -0,0 +1,19 @@
+package parser;
+
+import command.Command;
+import command.EchoCommand;
+
+/**
+ * Represents the command parser for EventManagerCLI
+ */
+public class Parser {
+
+ /**
+ * Returns an EchoCommand with a given user command string
+ *
+ * @param command The given command string from the user
+ */
+ public Command parseCommand (String command){
+ return new EchoCommand(command);
+ }
+}
From 1687c4020207c343320a83593cbe1510f696cf9c Mon Sep 17 00:00:00 2001
From: jemehgoh
Date: Sat, 5 Oct 2024 10:55:29 +0800
Subject: [PATCH 020/619] Add a unit test to check if the parser returns an
EchoCommand
---
src/test/java/parser/ParserTest.java | 18 ++++++++++++++++++
1 file changed, 18 insertions(+)
create mode 100644 src/test/java/parser/ParserTest.java
diff --git a/src/test/java/parser/ParserTest.java b/src/test/java/parser/ParserTest.java
new file mode 100644
index 0000000000..1925a5d651
--- /dev/null
+++ b/src/test/java/parser/ParserTest.java
@@ -0,0 +1,18 @@
+package parser;
+
+import command.Command;
+import command.EchoCommand;
+import org.junit.jupiter.api.Test;
+
+import static org.junit.jupiter.api.Assertions.assertTrue;
+
+class ParserTest {
+
+ @Test
+ public void parseCommand_nonEmptyString_echo() {
+ Parser parser = new Parser();
+ Command command = parser.parseCommand("Hello world!");
+
+ assertTrue(command instanceof EchoCommand);
+ }
+}
From 1d107b32407bd335b5b2537733c29c0b192b35fd Mon Sep 17 00:00:00 2001
From: jemehgoh
Date: Sat, 5 Oct 2024 11:06:23 +0800
Subject: [PATCH 021/619] Move ui package back under seedu.manager
---
src/main/java/seedu/manager/Main.java | 2 +-
src/main/java/{ => seedu/manager}/ui/Ui.java | 2 +-
2 files changed, 2 insertions(+), 2 deletions(-)
rename src/main/java/{ => seedu/manager}/ui/Ui.java (91%)
diff --git a/src/main/java/seedu/manager/Main.java b/src/main/java/seedu/manager/Main.java
index ad393076ea..a5dedf0bcf 100644
--- a/src/main/java/seedu/manager/Main.java
+++ b/src/main/java/seedu/manager/Main.java
@@ -1,6 +1,6 @@
package seedu.manager;
-import ui.Ui;
+import seedu.manager.ui.Ui;
public class Main {
private static final Ui ui = new Ui();
diff --git a/src/main/java/ui/Ui.java b/src/main/java/seedu/manager/ui/Ui.java
similarity index 91%
rename from src/main/java/ui/Ui.java
rename to src/main/java/seedu/manager/ui/Ui.java
index e98bd0383f..329cb6c6d9 100644
--- a/src/main/java/ui/Ui.java
+++ b/src/main/java/seedu/manager/ui/Ui.java
@@ -1,4 +1,4 @@
-package ui;
+package seedu.manager.ui;
/**
* Represents the program's user interface
From 932c0531bd79e95865b8e2452fdd6ddda534b890 Mon Sep 17 00:00:00 2001
From: jemehgoh
Date: Sat, 5 Oct 2024 11:06:59 +0800
Subject: [PATCH 022/619] Make WELCOME_MESSAGE private
---
src/main/java/seedu/manager/ui/Ui.java | 3 ++-
1 file changed, 2 insertions(+), 1 deletion(-)
diff --git a/src/main/java/seedu/manager/ui/Ui.java b/src/main/java/seedu/manager/ui/Ui.java
index 329cb6c6d9..7407cc0e9d 100644
--- a/src/main/java/seedu/manager/ui/Ui.java
+++ b/src/main/java/seedu/manager/ui/Ui.java
@@ -4,7 +4,8 @@
* Represents the program's user interface
*/
public class Ui {
- public static final String WELCOME_MESSAGE = "Welcome to EventManagerCLI.";
+ private static final String WELCOME_MESSAGE = "Welcome to EventManagerCLI.";
+
/**
* Greets user upon program startup
*/
From 084853fc22abe1c8e984c1cc2cda4dab34b04b5d Mon Sep 17 00:00:00 2001
From: jemehgoh
Date: Sat, 5 Oct 2024 11:22:26 +0800
Subject: [PATCH 023/619] Add a scanner to Ui to take in user input
---
src/main/java/seedu/manager/ui/Ui.java | 8 ++++++++
1 file changed, 8 insertions(+)
diff --git a/src/main/java/seedu/manager/ui/Ui.java b/src/main/java/seedu/manager/ui/Ui.java
index 7407cc0e9d..b25becd193 100644
--- a/src/main/java/seedu/manager/ui/Ui.java
+++ b/src/main/java/seedu/manager/ui/Ui.java
@@ -1,11 +1,19 @@
package seedu.manager.ui;
+import java.util.Scanner;
+
/**
* Represents the program's user interface
*/
public class Ui {
private static final String WELCOME_MESSAGE = "Welcome to EventManagerCLI.";
+ private final Scanner userInput;
+
+ public Ui() {
+ this.userInput = new Scanner(System.in);
+ }
+
/**
* Greets user upon program startup
*/
From 6814eca594affe3b027512d8c0aca736763436d2 Mon Sep 17 00:00:00 2001
From: jemehgoh
Date: Sat, 5 Oct 2024 13:24:16 +0800
Subject: [PATCH 024/619] Add getCommand method to Ui class to handle user
input
---
src/main/java/seedu/manager/Main.java | 1 +
src/main/java/seedu/manager/ui/Ui.java | 10 ++++++++++
2 files changed, 11 insertions(+)
diff --git a/src/main/java/seedu/manager/Main.java b/src/main/java/seedu/manager/Main.java
index a5dedf0bcf..33cb910fd3 100644
--- a/src/main/java/seedu/manager/Main.java
+++ b/src/main/java/seedu/manager/Main.java
@@ -10,5 +10,6 @@ public class Main {
*/
public static void main(String[] args) {
ui.greetUser();
+ ui.getCommand();
}
}
diff --git a/src/main/java/seedu/manager/ui/Ui.java b/src/main/java/seedu/manager/ui/Ui.java
index b25becd193..c728af1518 100644
--- a/src/main/java/seedu/manager/ui/Ui.java
+++ b/src/main/java/seedu/manager/ui/Ui.java
@@ -7,6 +7,7 @@
*/
public class Ui {
private static final String WELCOME_MESSAGE = "Welcome to EventManagerCLI.";
+ private static final String COMMAND_PROMPT_MESSAGE = "Enter a command: ";
private final Scanner userInput;
@@ -20,4 +21,13 @@ public Ui() {
public void greetUser() {
System.out.println(WELCOME_MESSAGE);
}
+
+ /**
+ * Gets input from the user, and prints that input back to the user
+ */
+ public void getCommand() {
+ System.out.print(COMMAND_PROMPT_MESSAGE);
+ String rawInput = this.userInput.nextLine();
+ System.out.println(rawInput);
+ }
}
From 601cea8d8df2c5d201a7a45817a264a6fef4921a Mon Sep 17 00:00:00 2001
From: jemehgoh
Date: Sat, 5 Oct 2024 13:28:54 +0800
Subject: [PATCH 025/619] Add a sayBye method to the Ui class
---
src/main/java/seedu/manager/Main.java | 1 +
src/main/java/seedu/manager/ui/Ui.java | 8 ++++++++
2 files changed, 9 insertions(+)
diff --git a/src/main/java/seedu/manager/Main.java b/src/main/java/seedu/manager/Main.java
index 33cb910fd3..cf8ae334d7 100644
--- a/src/main/java/seedu/manager/Main.java
+++ b/src/main/java/seedu/manager/Main.java
@@ -11,5 +11,6 @@ public class Main {
public static void main(String[] args) {
ui.greetUser();
ui.getCommand();
+ ui.sayBye();
}
}
diff --git a/src/main/java/seedu/manager/ui/Ui.java b/src/main/java/seedu/manager/ui/Ui.java
index c728af1518..a079a55af1 100644
--- a/src/main/java/seedu/manager/ui/Ui.java
+++ b/src/main/java/seedu/manager/ui/Ui.java
@@ -8,6 +8,7 @@
public class Ui {
private static final String WELCOME_MESSAGE = "Welcome to EventManagerCLI.";
private static final String COMMAND_PROMPT_MESSAGE = "Enter a command: ";
+ private static final String GOODBYE_MESSAGE = "Thank you for using EventManagerCLI. Goodbye!";
private final Scanner userInput;
@@ -30,4 +31,11 @@ public void getCommand() {
String rawInput = this.userInput.nextLine();
System.out.println(rawInput);
}
+
+ /**
+ * Prints a final message to the user before program shutdown
+ */
+ public void sayBye() {
+ System.out.println(GOODBYE_MESSAGE);
+ }
}
From 8325bbccd463fce955e793bd7be1b7a7cf89b5f5 Mon Sep 17 00:00:00 2001
From: jemehgoh
Date: Sat, 5 Oct 2024 13:33:46 +0800
Subject: [PATCH 026/619] Update text redirection tests to account for new Ui
functionality
---
text-ui-test/EXPECTED.TXT | 2 ++
text-ui-test/input.txt | 2 +-
2 files changed, 3 insertions(+), 1 deletion(-)
diff --git a/text-ui-test/EXPECTED.TXT b/text-ui-test/EXPECTED.TXT
index 282a9429be..1e21feb24a 100644
--- a/text-ui-test/EXPECTED.TXT
+++ b/text-ui-test/EXPECTED.TXT
@@ -1 +1,3 @@
Welcome to EventManagerCLI.
+Enter a command: hello world
+Thank you for using EventManagerCLI. Goodbye!
diff --git a/text-ui-test/input.txt b/text-ui-test/input.txt
index 8b13789179..3b18e512db 100644
--- a/text-ui-test/input.txt
+++ b/text-ui-test/input.txt
@@ -1 +1 @@
-
+hello world
From 4fff6886bfbadde45310a36fa1cee4abbd28fecf Mon Sep 17 00:00:00 2001
From: jemehgoh
Date: Sat, 5 Oct 2024 13:58:55 +0800
Subject: [PATCH 027/619] Update user guide to account for new startup
procedure
---
docs/UserGuide.md | 14 ++++++++++----
1 file changed, 10 insertions(+), 4 deletions(-)
diff --git a/docs/UserGuide.md b/docs/UserGuide.md
index d6cf4c3b3a..43c1ce1af8 100644
--- a/docs/UserGuide.md
+++ b/docs/UserGuide.md
@@ -2,14 +2,20 @@
## Introduction
-{Give a product intro}
+EventManager CLI is a CLI application that allows organisers of small-scale events to track
+the participants and logistics of such events.
## Quick Start
-{Give steps to get started quickly}
-
1. Ensure that you have Java 17 or above installed.
-1. Down the latest version of `Duke` from [here](http://link.to/duke).
+2. Down the latest version of `EventManagerCLI` from [here](http://link.to/duke).
+3. Open a new terminal in the folder that you put the JAR file in, and run the program with the
+command ```java -jar EventManagerCLI.jar```.
+The following message would be printed:
+```
+Welcome to EventManagerCLI.
+Enter a command:
+```
## Features
From c187692a3bc400c419bf24638da208dfab710031 Mon Sep 17 00:00:00 2001
From: jemehgoh
Date: Sun, 6 Oct 2024 15:01:44 +0800
Subject: [PATCH 028/619] Move command and parser packages under manager
package
---
src/main/java/{ => seedu/manager}/command/Command.java | 2 +-
src/main/java/{ => seedu/manager}/command/EchoCommand.java | 2 +-
src/main/java/{ => seedu/manager}/parser/Parser.java | 6 +++---
src/test/java/{ => seedu/manager}/parser/ParserTest.java | 7 ++++---
4 files changed, 9 insertions(+), 8 deletions(-)
rename src/main/java/{ => seedu/manager}/command/Command.java (84%)
rename src/main/java/{ => seedu/manager}/command/EchoCommand.java (94%)
rename src/main/java/{ => seedu/manager}/parser/Parser.java (75%)
rename src/test/java/{ => seedu/manager}/parser/ParserTest.java (70%)
diff --git a/src/main/java/command/Command.java b/src/main/java/seedu/manager/command/Command.java
similarity index 84%
rename from src/main/java/command/Command.java
rename to src/main/java/seedu/manager/command/Command.java
index 5405f597d7..531084755c 100644
--- a/src/main/java/command/Command.java
+++ b/src/main/java/seedu/manager/command/Command.java
@@ -1,4 +1,4 @@
-package command;
+package seedu.manager.command;
/**
* Represents an executable command
diff --git a/src/main/java/command/EchoCommand.java b/src/main/java/seedu/manager/command/EchoCommand.java
similarity index 94%
rename from src/main/java/command/EchoCommand.java
rename to src/main/java/seedu/manager/command/EchoCommand.java
index c5ac281da0..ccee451f6b 100644
--- a/src/main/java/command/EchoCommand.java
+++ b/src/main/java/seedu/manager/command/EchoCommand.java
@@ -1,4 +1,4 @@
-package command;
+package seedu.manager.command;
/**
* Represents an executable echo command
diff --git a/src/main/java/parser/Parser.java b/src/main/java/seedu/manager/parser/Parser.java
similarity index 75%
rename from src/main/java/parser/Parser.java
rename to src/main/java/seedu/manager/parser/Parser.java
index 6e175028c9..4a37da55e9 100644
--- a/src/main/java/parser/Parser.java
+++ b/src/main/java/seedu/manager/parser/Parser.java
@@ -1,7 +1,7 @@
-package parser;
+package seedu.manager.parser;
-import command.Command;
-import command.EchoCommand;
+import seedu.manager.command.Command;
+import seedu.manager.command.EchoCommand;
/**
* Represents the command parser for EventManagerCLI
diff --git a/src/test/java/parser/ParserTest.java b/src/test/java/seedu/manager/parser/ParserTest.java
similarity index 70%
rename from src/test/java/parser/ParserTest.java
rename to src/test/java/seedu/manager/parser/ParserTest.java
index 1925a5d651..8efa057775 100644
--- a/src/test/java/parser/ParserTest.java
+++ b/src/test/java/seedu/manager/parser/ParserTest.java
@@ -1,8 +1,9 @@
-package parser;
+package seedu.manager.parser;
-import command.Command;
-import command.EchoCommand;
+import seedu.manager.command.Command;
+import seedu.manager.command.EchoCommand;
import org.junit.jupiter.api.Test;
+import seedu.manager.parser.Parser;
import static org.junit.jupiter.api.Assertions.assertTrue;
From bc4de9ae9b4e747974ffaaaaad878238649552cb Mon Sep 17 00:00:00 2001
From: jemehgoh
Date: Sun, 6 Oct 2024 15:11:09 +0800
Subject: [PATCH 029/619] Add a CommandOutput class to handle command output
---
.../seedu/manager/command/CommandOutput.java | 37 +++++++++++++++++++
1 file changed, 37 insertions(+)
create mode 100644 src/main/java/seedu/manager/command/CommandOutput.java
diff --git a/src/main/java/seedu/manager/command/CommandOutput.java b/src/main/java/seedu/manager/command/CommandOutput.java
new file mode 100644
index 0000000000..69b9969877
--- /dev/null
+++ b/src/main/java/seedu/manager/command/CommandOutput.java
@@ -0,0 +1,37 @@
+package seedu.manager.command;
+
+/**
+ * Represents the output of the executed command
+ */
+public class CommandOutput {
+ private final String message;
+ private final boolean canExit;
+
+ /**
+ * Constructs a new CommandOutput with a given message and whether the program can be exited from
+ *
+ * @param message The given message
+ * @param canExit Whether the program can be exited from
+ */
+ public CommandOutput(String message, boolean canExit) {
+ this.message = message;
+ this.canExit = canExit;
+ }
+
+ /**
+ * Prints the message of the command output.
+ */
+ public void printMessage() {
+ System.out.println(this.message);
+ }
+
+ /**
+ * Returns true if the program can be exited from,
+ * returns false otherwise.
+ *
+ * @return Whether the program can be exited from
+ */
+ public boolean ifCanExit() {
+ return canExit;
+ }
+}
From 02f91f5feffd797e00b53b66c5d94201db6132dc Mon Sep 17 00:00:00 2001
From: jemehgoh
Date: Sun, 6 Oct 2024 15:16:59 +0800
Subject: [PATCH 030/619] Remove redundant import from ParserTest
---
src/test/java/seedu/manager/parser/ParserTest.java | 1 -
1 file changed, 1 deletion(-)
diff --git a/src/test/java/seedu/manager/parser/ParserTest.java b/src/test/java/seedu/manager/parser/ParserTest.java
index 8efa057775..a5d0dced68 100644
--- a/src/test/java/seedu/manager/parser/ParserTest.java
+++ b/src/test/java/seedu/manager/parser/ParserTest.java
@@ -3,7 +3,6 @@
import seedu.manager.command.Command;
import seedu.manager.command.EchoCommand;
import org.junit.jupiter.api.Test;
-import seedu.manager.parser.Parser;
import static org.junit.jupiter.api.Assertions.assertTrue;
From 86a78e2f4cc46d6f77e31d448146b7300ec5bcb0 Mon Sep 17 00:00:00 2001
From: jemehgoh
Date: Sun, 6 Oct 2024 15:27:00 +0800
Subject: [PATCH 031/619] Update Ui to use Parser and Command to parse and
execute commands
---
src/main/java/seedu/manager/command/Command.java | 4 ++--
.../java/seedu/manager/command/EchoCommand.java | 6 +++---
src/main/java/seedu/manager/ui/Ui.java | 13 ++++++++++++-
3 files changed, 17 insertions(+), 6 deletions(-)
diff --git a/src/main/java/seedu/manager/command/Command.java b/src/main/java/seedu/manager/command/Command.java
index 531084755c..528f1564ed 100644
--- a/src/main/java/seedu/manager/command/Command.java
+++ b/src/main/java/seedu/manager/command/Command.java
@@ -6,7 +6,7 @@
public abstract class Command {
/**
- * Handles the command execution
+ * Returns the output of the executable command
*/
- public abstract void execute();
+ public abstract CommandOutput execute();
}
diff --git a/src/main/java/seedu/manager/command/EchoCommand.java b/src/main/java/seedu/manager/command/EchoCommand.java
index ccee451f6b..7176869e1b 100644
--- a/src/main/java/seedu/manager/command/EchoCommand.java
+++ b/src/main/java/seedu/manager/command/EchoCommand.java
@@ -16,10 +16,10 @@ public EchoCommand(String userInput) {
}
/**
- * Executes echo command by printing user input
+ * Returns the command output, with the user input as the output message
*/
@Override
- public void execute() {
- System.out.println(this.userInput);
+ public CommandOutput execute() {
+ return new CommandOutput(this.userInput, false);
}
}
diff --git a/src/main/java/seedu/manager/ui/Ui.java b/src/main/java/seedu/manager/ui/Ui.java
index a079a55af1..14ea23a665 100644
--- a/src/main/java/seedu/manager/ui/Ui.java
+++ b/src/main/java/seedu/manager/ui/Ui.java
@@ -1,5 +1,9 @@
package seedu.manager.ui;
+import seedu.manager.command.Command;
+import seedu.manager.command.CommandOutput;
+import seedu.manager.parser.Parser;
+
import java.util.Scanner;
/**
@@ -11,9 +15,14 @@ public class Ui {
private static final String GOODBYE_MESSAGE = "Thank you for using EventManagerCLI. Goodbye!";
private final Scanner userInput;
+ private final Parser parser;
+ /**
+ * Constructs a new Ui
+ */
public Ui() {
this.userInput = new Scanner(System.in);
+ this.parser = new Parser();
}
/**
@@ -29,7 +38,9 @@ public void greetUser() {
public void getCommand() {
System.out.print(COMMAND_PROMPT_MESSAGE);
String rawInput = this.userInput.nextLine();
- System.out.println(rawInput);
+ Command command = parser.parseCommand(rawInput);
+ CommandOutput output = command.execute();
+ output.printMessage();
}
/**
From fd55930eb0df6b8d348bcea76e79ac320cf52c5e Mon Sep 17 00:00:00 2001
From: jemehgoh
Date: Sun, 6 Oct 2024 16:03:20 +0800
Subject: [PATCH 032/619] Add ExitCommand class to handle program exit
---
src/main/java/seedu/manager/command/ExitCommand.java | 12 ++++++++++++
1 file changed, 12 insertions(+)
create mode 100644 src/main/java/seedu/manager/command/ExitCommand.java
diff --git a/src/main/java/seedu/manager/command/ExitCommand.java b/src/main/java/seedu/manager/command/ExitCommand.java
new file mode 100644
index 0000000000..37f21d2447
--- /dev/null
+++ b/src/main/java/seedu/manager/command/ExitCommand.java
@@ -0,0 +1,12 @@
+package seedu.manager.command;
+
+/**
+ *
+ */
+public class ExitCommand extends Command {
+ public static final String COMMAND_WORD = "exit";
+
+ public CommandOutput execute() {
+ return new CommandOutput("Thank you for using EventManagerCLI. Goodbye!", true);
+ }
+}
From 2975988fe1a727e07d0cd0977c2b43c70355723e Mon Sep 17 00:00:00 2001
From: jemehgoh
Date: Sun, 6 Oct 2024 16:04:05 +0800
Subject: [PATCH 033/619] Change name of ifCanExit getter to follow coding
standard
---
src/main/java/seedu/manager/command/CommandOutput.java | 2 +-
1 file changed, 1 insertion(+), 1 deletion(-)
diff --git a/src/main/java/seedu/manager/command/CommandOutput.java b/src/main/java/seedu/manager/command/CommandOutput.java
index 69b9969877..95d7213e6b 100644
--- a/src/main/java/seedu/manager/command/CommandOutput.java
+++ b/src/main/java/seedu/manager/command/CommandOutput.java
@@ -31,7 +31,7 @@ public void printMessage() {
*
* @return Whether the program can be exited from
*/
- public boolean ifCanExit() {
+ public boolean getCanExit() {
return canExit;
}
}
From 31cbb6692372947a6aa6380c7af77694ba3bed46 Mon Sep 17 00:00:00 2001
From: jemehgoh
Date: Sun, 6 Oct 2024 16:04:25 +0800
Subject: [PATCH 034/619] Fix spacing in EchoCommand
---
src/main/java/seedu/manager/command/EchoCommand.java | 2 +-
1 file changed, 1 insertion(+), 1 deletion(-)
diff --git a/src/main/java/seedu/manager/command/EchoCommand.java b/src/main/java/seedu/manager/command/EchoCommand.java
index 7176869e1b..d2f3498544 100644
--- a/src/main/java/seedu/manager/command/EchoCommand.java
+++ b/src/main/java/seedu/manager/command/EchoCommand.java
@@ -3,7 +3,7 @@
/**
* Represents an executable echo command
*/
-public class EchoCommand extends Command{
+public class EchoCommand extends Command {
private final String userInput;
/**
From b1d4e68a3008bd8ec7f3133d370f7dbf50794fbe Mon Sep 17 00:00:00 2001
From: jemehgoh
Date: Sun, 6 Oct 2024 16:04:53 +0800
Subject: [PATCH 035/619] Update Parser to handle exit command
---
src/main/java/seedu/manager/parser/Parser.java | 16 +++++++++++++---
1 file changed, 13 insertions(+), 3 deletions(-)
diff --git a/src/main/java/seedu/manager/parser/Parser.java b/src/main/java/seedu/manager/parser/Parser.java
index 4a37da55e9..fe1f5d692b 100644
--- a/src/main/java/seedu/manager/parser/Parser.java
+++ b/src/main/java/seedu/manager/parser/Parser.java
@@ -2,6 +2,7 @@
import seedu.manager.command.Command;
import seedu.manager.command.EchoCommand;
+import seedu.manager.command.ExitCommand;
/**
* Represents the command parser for EventManagerCLI
@@ -9,11 +10,20 @@
public class Parser {
/**
- * Returns an EchoCommand with a given user command string
+ * Returns a command based on the given user command string
*
* @param command The given command string from the user
*/
- public Command parseCommand (String command){
- return new EchoCommand(command);
+ public Command parseCommand(String command){
+ String[] commandParts = command.split(" ", 2);
+ String commandWord = commandParts[0];
+
+ switch (commandWord) {
+ case ExitCommand.COMMAND_WORD:
+ return new ExitCommand();
+
+ default:
+ return new EchoCommand(command);
+ }
}
}
From 1a724d2a878db5819951a049c1ecc977d3bddc18 Mon Sep 17 00:00:00 2001
From: jemehgoh
Date: Sun, 6 Oct 2024 16:05:23 +0800
Subject: [PATCH 036/619] Update Ui and Main to handle exit command
---
src/main/java/seedu/manager/Main.java | 1 -
src/main/java/seedu/manager/ui/Ui.java | 22 ++++++++++------------
2 files changed, 10 insertions(+), 13 deletions(-)
diff --git a/src/main/java/seedu/manager/Main.java b/src/main/java/seedu/manager/Main.java
index cf8ae334d7..33cb910fd3 100644
--- a/src/main/java/seedu/manager/Main.java
+++ b/src/main/java/seedu/manager/Main.java
@@ -11,6 +11,5 @@ public class Main {
public static void main(String[] args) {
ui.greetUser();
ui.getCommand();
- ui.sayBye();
}
}
diff --git a/src/main/java/seedu/manager/ui/Ui.java b/src/main/java/seedu/manager/ui/Ui.java
index 14ea23a665..62ac70aed6 100644
--- a/src/main/java/seedu/manager/ui/Ui.java
+++ b/src/main/java/seedu/manager/ui/Ui.java
@@ -36,17 +36,15 @@ public void greetUser() {
* Gets input from the user, and prints that input back to the user
*/
public void getCommand() {
- System.out.print(COMMAND_PROMPT_MESSAGE);
- String rawInput = this.userInput.nextLine();
- Command command = parser.parseCommand(rawInput);
- CommandOutput output = command.execute();
- output.printMessage();
- }
-
- /**
- * Prints a final message to the user before program shutdown
- */
- public void sayBye() {
- System.out.println(GOODBYE_MESSAGE);
+ boolean isGettingCommands = true;
+
+ while (isGettingCommands) {
+ System.out.print(COMMAND_PROMPT_MESSAGE);
+ String rawInput = this.userInput.nextLine();
+ Command command = parser.parseCommand(rawInput);
+ CommandOutput output = command.execute();
+ output.printMessage();
+ isGettingCommands = !output.getCanExit();
+ }
}
}
From fe9dd663fc5f3f56f51b91ff0a8248296f36fb03 Mon Sep 17 00:00:00 2001
From: jemehgoh
Date: Sun, 6 Oct 2024 16:06:12 +0800
Subject: [PATCH 037/619] Update text redirection tests to account for exit
command
---
text-ui-test/EXPECTED.TXT | 2 +-
text-ui-test/input.txt | 1 +
2 files changed, 2 insertions(+), 1 deletion(-)
diff --git a/text-ui-test/EXPECTED.TXT b/text-ui-test/EXPECTED.TXT
index 1e21feb24a..d7531cfcea 100644
--- a/text-ui-test/EXPECTED.TXT
+++ b/text-ui-test/EXPECTED.TXT
@@ -1,3 +1,3 @@
Welcome to EventManagerCLI.
Enter a command: hello world
-Thank you for using EventManagerCLI. Goodbye!
+Enter a command: Thank you for using EventManagerCLI. Goodbye!
diff --git a/text-ui-test/input.txt b/text-ui-test/input.txt
index 3b18e512db..1fc922a43a 100644
--- a/text-ui-test/input.txt
+++ b/text-ui-test/input.txt
@@ -1 +1,2 @@
hello world
+exit
From 31b76cdc908da7b6cf357cd0b5d513897ea2d020 Mon Sep 17 00:00:00 2001
From: jemehgoh
Date: Sun, 6 Oct 2024 16:11:36 +0800
Subject: [PATCH 038/619] Change assert statement in ParserTest to
assertInstanceOf
---
src/test/java/seedu/manager/parser/ParserTest.java | 3 ++-
1 file changed, 2 insertions(+), 1 deletion(-)
diff --git a/src/test/java/seedu/manager/parser/ParserTest.java b/src/test/java/seedu/manager/parser/ParserTest.java
index a5d0dced68..1b53ec65b6 100644
--- a/src/test/java/seedu/manager/parser/ParserTest.java
+++ b/src/test/java/seedu/manager/parser/ParserTest.java
@@ -13,6 +13,7 @@ public void parseCommand_nonEmptyString_echo() {
Parser parser = new Parser();
Command command = parser.parseCommand("Hello world!");
- assertTrue(command instanceof EchoCommand);
+ assertInstanceOf(EchoCommand.class, command);
+ }
}
}
From 92199e9a6167b219a88e8fb776f5b203e81fb634 Mon Sep 17 00:00:00 2001
From: jemehgoh
Date: Sun, 6 Oct 2024 16:11:49 +0800
Subject: [PATCH 039/619] Add unit test for exit command
---
src/test/java/seedu/manager/parser/ParserTest.java | 10 +++++++++-
1 file changed, 9 insertions(+), 1 deletion(-)
diff --git a/src/test/java/seedu/manager/parser/ParserTest.java b/src/test/java/seedu/manager/parser/ParserTest.java
index 1b53ec65b6..2471b56221 100644
--- a/src/test/java/seedu/manager/parser/ParserTest.java
+++ b/src/test/java/seedu/manager/parser/ParserTest.java
@@ -3,8 +3,9 @@
import seedu.manager.command.Command;
import seedu.manager.command.EchoCommand;
import org.junit.jupiter.api.Test;
+import seedu.manager.command.ExitCommand;
-import static org.junit.jupiter.api.Assertions.assertTrue;
+import static org.junit.jupiter.api.Assertions.assertInstanceOf;
class ParserTest {
@@ -15,5 +16,12 @@ public void parseCommand_nonEmptyString_echo() {
assertInstanceOf(EchoCommand.class, command);
}
+
+ @Test
+ public void parseCommand_exitWord_exit() {
+ Parser parser = new Parser();
+ Command command = parser.parseCommand("exit");
+
+ assertInstanceOf(ExitCommand.class, command);
}
}
From cb6db085a6a5dcf9dfa76b692edbb80777408446 Mon Sep 17 00:00:00 2001
From: jemehgoh
Date: Sun, 6 Oct 2024 16:19:25 +0800
Subject: [PATCH 040/619] Remove unused GOODBYE_MESSAGE constant
---
src/main/java/seedu/manager/ui/Ui.java | 1 -
1 file changed, 1 deletion(-)
diff --git a/src/main/java/seedu/manager/ui/Ui.java b/src/main/java/seedu/manager/ui/Ui.java
index 62ac70aed6..be3d4f2ecb 100644
--- a/src/main/java/seedu/manager/ui/Ui.java
+++ b/src/main/java/seedu/manager/ui/Ui.java
@@ -12,7 +12,6 @@
public class Ui {
private static final String WELCOME_MESSAGE = "Welcome to EventManagerCLI.";
private static final String COMMAND_PROMPT_MESSAGE = "Enter a command: ";
- private static final String GOODBYE_MESSAGE = "Thank you for using EventManagerCLI. Goodbye!";
private final Scanner userInput;
private final Parser parser;
From 0eb6c3c003b1d6606c3f1dabc553ef74cde5c5a5 Mon Sep 17 00:00:00 2001
From: jemehgoh
Date: Mon, 7 Oct 2024 08:46:21 +0800
Subject: [PATCH 041/619] Extract out exit message and add Javadoc headers
---
src/main/java/seedu/manager/command/ExitCommand.java | 10 ++++++++--
1 file changed, 8 insertions(+), 2 deletions(-)
diff --git a/src/main/java/seedu/manager/command/ExitCommand.java b/src/main/java/seedu/manager/command/ExitCommand.java
index 37f21d2447..3b0c384d14 100644
--- a/src/main/java/seedu/manager/command/ExitCommand.java
+++ b/src/main/java/seedu/manager/command/ExitCommand.java
@@ -1,12 +1,18 @@
package seedu.manager.command;
/**
- *
+ * Represents an executable exit command
*/
public class ExitCommand extends Command {
public static final String COMMAND_WORD = "exit";
+ private static final String EXIT_MESSAGE = "Thank you for using EventManagerCLI. Goodbye!";
+ /**
+ * Returns a command output with an exit message
+ *
+ * @return The command output with an exit message
+ */
public CommandOutput execute() {
- return new CommandOutput("Thank you for using EventManagerCLI. Goodbye!", true);
+ return new CommandOutput(EXIT_MESSAGE, true);
}
}
From 34ebd7bd9938a5d3c6462e9c1419c283196fdc8b Mon Sep 17 00:00:00 2001
From: jemehgoh
Date: Mon, 7 Oct 2024 08:53:44 +0800
Subject: [PATCH 042/619] Update user guide to account for exit command
---
docs/UserGuide.md | 17 ++++-------------
1 file changed, 4 insertions(+), 13 deletions(-)
diff --git a/docs/UserGuide.md b/docs/UserGuide.md
index 43c1ce1af8..a9b21e76d6 100644
--- a/docs/UserGuide.md
+++ b/docs/UserGuide.md
@@ -21,19 +21,10 @@ Enter a command:
{Give detailed description of each feature}
-### Adding a todo: `todo`
-Adds a new item to the list of todo items.
+### Exiting the program: `exit`
+Exits the program.
-Format: `todo n/TODO_NAME d/DEADLINE`
-
-* The `DEADLINE` can be in a natural language format.
-* The `TODO_NAME` cannot contain punctuation.
-
-Example of usage:
-
-`todo n/Write the rest of the User Guide d/next week`
-
-`todo n/Refactor the User Guide to remove passive voice d/13/04/2020`
+Format: `exit`
## FAQ
@@ -45,4 +36,4 @@ Example of usage:
{Give a 'cheat sheet' of commands here}
-* Add todo `todo n/TODO_NAME d/DEADLINE`
+* Exit program `exit`
From 44709ef56d363f9fa45c1628a0d12dffc4b71b55 Mon Sep 17 00:00:00 2001
From: jemehgoh
Date: Mon, 7 Oct 2024 09:52:44 +0800
Subject: [PATCH 043/619] Rename getCommand method and update Javadoc header
---
src/main/java/seedu/manager/Main.java | 2 +-
src/main/java/seedu/manager/ui/Ui.java | 4 ++--
2 files changed, 3 insertions(+), 3 deletions(-)
diff --git a/src/main/java/seedu/manager/Main.java b/src/main/java/seedu/manager/Main.java
index 33cb910fd3..1e3c9ca6b8 100644
--- a/src/main/java/seedu/manager/Main.java
+++ b/src/main/java/seedu/manager/Main.java
@@ -10,6 +10,6 @@ public class Main {
*/
public static void main(String[] args) {
ui.greetUser();
- ui.getCommand();
+ ui.getCommands();
}
}
diff --git a/src/main/java/seedu/manager/ui/Ui.java b/src/main/java/seedu/manager/ui/Ui.java
index be3d4f2ecb..b50bb91ad9 100644
--- a/src/main/java/seedu/manager/ui/Ui.java
+++ b/src/main/java/seedu/manager/ui/Ui.java
@@ -32,9 +32,9 @@ public void greetUser() {
}
/**
- * Gets input from the user, and prints that input back to the user
+ * Gets input from the user, and executes commands based on that input
*/
- public void getCommand() {
+ public void getCommands() {
boolean isGettingCommands = true;
while (isGettingCommands) {
From 9c3fdcaf00b82842b722f82c608224ecfd13ca50 Mon Sep 17 00:00:00 2001
From: jemehgoh
Date: Mon, 7 Oct 2024 20:37:38 +0800
Subject: [PATCH 044/619] Remove duplicate Command, Parser, EchoCommand and
ParserTest classes
---
src/main/java/command/Command.java | 12 ------------
src/main/java/command/EchoCommand.java | 25 -------------------------
src/main/java/parser/Parser.java | 19 -------------------
src/test/java/parser/ParserTest.java | 18 ------------------
4 files changed, 74 deletions(-)
delete mode 100644 src/main/java/command/Command.java
delete mode 100644 src/main/java/command/EchoCommand.java
delete mode 100644 src/main/java/parser/Parser.java
delete mode 100644 src/test/java/parser/ParserTest.java
diff --git a/src/main/java/command/Command.java b/src/main/java/command/Command.java
deleted file mode 100644
index 5405f597d7..0000000000
--- a/src/main/java/command/Command.java
+++ /dev/null
@@ -1,12 +0,0 @@
-package command;
-
-/**
- * Represents an executable command
- */
-public abstract class Command {
-
- /**
- * Handles the command execution
- */
- public abstract void execute();
-}
diff --git a/src/main/java/command/EchoCommand.java b/src/main/java/command/EchoCommand.java
deleted file mode 100644
index c5ac281da0..0000000000
--- a/src/main/java/command/EchoCommand.java
+++ /dev/null
@@ -1,25 +0,0 @@
-package command;
-
-/**
- * Represents an executable echo command
- */
-public class EchoCommand extends Command{
- private final String userInput;
-
- /**
- * Constructs a new EchoCommand with the given user input
- *
- * @param userInput The user input
- */
- public EchoCommand(String userInput) {
- this.userInput = userInput;
- }
-
- /**
- * Executes echo command by printing user input
- */
- @Override
- public void execute() {
- System.out.println(this.userInput);
- }
-}
diff --git a/src/main/java/parser/Parser.java b/src/main/java/parser/Parser.java
deleted file mode 100644
index 6e175028c9..0000000000
--- a/src/main/java/parser/Parser.java
+++ /dev/null
@@ -1,19 +0,0 @@
-package parser;
-
-import command.Command;
-import command.EchoCommand;
-
-/**
- * Represents the command parser for EventManagerCLI
- */
-public class Parser {
-
- /**
- * Returns an EchoCommand with a given user command string
- *
- * @param command The given command string from the user
- */
- public Command parseCommand (String command){
- return new EchoCommand(command);
- }
-}
diff --git a/src/test/java/parser/ParserTest.java b/src/test/java/parser/ParserTest.java
deleted file mode 100644
index 1925a5d651..0000000000
--- a/src/test/java/parser/ParserTest.java
+++ /dev/null
@@ -1,18 +0,0 @@
-package parser;
-
-import command.Command;
-import command.EchoCommand;
-import org.junit.jupiter.api.Test;
-
-import static org.junit.jupiter.api.Assertions.assertTrue;
-
-class ParserTest {
-
- @Test
- public void parseCommand_nonEmptyString_echo() {
- Parser parser = new Parser();
- Command command = parser.parseCommand("Hello world!");
-
- assertTrue(command instanceof EchoCommand);
- }
-}
From 13af35d67938bd083a78f55a8bf03c0388cf801a Mon Sep 17 00:00:00 2001
From: fuyixuan
Date: Tue, 8 Oct 2024 00:37:23 +0800
Subject: [PATCH 045/619] Implement an EventList class and an Event abstract
class
---
src/main/java/seedu/manager/Main.java | 2 +
src/main/java/seedu/manager/event/Event.java | 36 ++++++++++++++++
.../java/seedu/manager/event/EventList.java | 42 +++++++++++++++++++
.../seedu/manager/event/LectureEvent.java | 8 ++++
4 files changed, 88 insertions(+)
create mode 100644 src/main/java/seedu/manager/event/Event.java
create mode 100644 src/main/java/seedu/manager/event/EventList.java
create mode 100644 src/main/java/seedu/manager/event/LectureEvent.java
diff --git a/src/main/java/seedu/manager/Main.java b/src/main/java/seedu/manager/Main.java
index 1e3c9ca6b8..dbf2d6327d 100644
--- a/src/main/java/seedu/manager/Main.java
+++ b/src/main/java/seedu/manager/Main.java
@@ -1,9 +1,11 @@
package seedu.manager;
+import seedu.manager.event.EventList;
import seedu.manager.ui.Ui;
public class Main {
private static final Ui ui = new Ui();
+ private static final EventList events = new EventList();
/**
* Main entry-point for the EventManagerCLI application.
diff --git a/src/main/java/seedu/manager/event/Event.java b/src/main/java/seedu/manager/event/Event.java
new file mode 100644
index 0000000000..8ff7f5550f
--- /dev/null
+++ b/src/main/java/seedu/manager/event/Event.java
@@ -0,0 +1,36 @@
+package seedu.manager.event;
+
+public abstract class Event {
+ private final String eventName;
+ private String startTime;
+ private String endTime;
+ private String venue;
+ private String description;
+ public Event(String eventName, String startTime, String endTime, String venue) {
+ this.eventName = eventName;
+ this.startTime = startTime;
+ this.endTime = endTime;
+ this.venue = venue;
+ }
+ public String getEventName() {
+ return eventName;
+ }
+ public String getStartTime() {
+ return startTime;
+ }
+ public String getEndTime() {
+ return endTime;
+ }
+ public String getVenue() {
+ return venue;
+ }
+ public void setStartTime(String startTime) {
+ this.startTime = startTime;
+ }
+ public void setEndTime(String endTime) {
+ this.endTime = endTime;
+ }
+ public void setVenue(String venue) {
+ this.venue = venue;
+ }
+}
diff --git a/src/main/java/seedu/manager/event/EventList.java b/src/main/java/seedu/manager/event/EventList.java
new file mode 100644
index 0000000000..3f265abed6
--- /dev/null
+++ b/src/main/java/seedu/manager/event/EventList.java
@@ -0,0 +1,42 @@
+package seedu.manager.event;
+
+import java.util.ArrayList;
+
+
+/**
+ * The EventList class manages a list of Event objects.
+ * It provides methods to manage an event list.
+ */
+public class EventList {
+ private final ArrayList eventList;
+
+ /**
+ * Constructor that initializes EventList with a given list of event.
+ *
+ * @param eventList The initial list of tasks.
+ */
+ public EventList(ArrayList eventList) {
+ this.eventList = eventList;
+ }
+
+ /**
+ * Default constructor that initializes an empty event list.
+ */
+ public EventList(){
+ eventList = new ArrayList<>();
+ }
+
+ /**
+ * @return The list of events.
+ */
+ public ArrayList getList() {
+ return eventList;
+ }
+
+ /**
+ * @return The size of the event list.
+ */
+ public int getListSize() {
+ return eventList.size();
+ }
+}
diff --git a/src/main/java/seedu/manager/event/LectureEvent.java b/src/main/java/seedu/manager/event/LectureEvent.java
new file mode 100644
index 0000000000..ab7f6ab6e7
--- /dev/null
+++ b/src/main/java/seedu/manager/event/LectureEvent.java
@@ -0,0 +1,8 @@
+package seedu.manager.event;
+
+
+public class LectureEvent extends Event {
+ public LectureEvent(String eventName, String startTime, String endTime, String venue) {
+ super(eventName, startTime, endTime, venue);
+ }
+}
From 89656a608f5650d61cecc7537e57365abb20adcc Mon Sep 17 00:00:00 2001
From: glenn-chew
Date: Tue, 8 Oct 2024 02:26:20 +0800
Subject: [PATCH 046/619] Add MenuCommand class to display menu message
---
.../seedu/manager/command/MenuCommand.java | 26 +++++++++++++++++++
1 file changed, 26 insertions(+)
create mode 100644 src/main/java/seedu/manager/command/MenuCommand.java
diff --git a/src/main/java/seedu/manager/command/MenuCommand.java b/src/main/java/seedu/manager/command/MenuCommand.java
new file mode 100644
index 0000000000..d450021b9c
--- /dev/null
+++ b/src/main/java/seedu/manager/command/MenuCommand.java
@@ -0,0 +1,26 @@
+package seedu.manager.command;
+
+/**
+ * Represents an executable menu command
+ */
+public class MenuCommand extends Command {
+ private static final String COMMAND_WORD = "menu";
+ private static final String MENU_MESSAGE = "Here are the possible commands:\n\n"
+ + "add -e EVENT_NAME -st START_TIME -et END_TIME -v VENUE -d DESCRIPTION: "
+ + "Add an event to the event list.\n"
+ + "list: List events.\n"
+ + "remove -e EVENT_NAME: Remove an event from the event list.\n"
+ + "add -p PARTICIPANT_NAME -e EVENT_NAME: Add a participant an event.\n"
+ + "view -e EVENT_NAME: View the list of participants of an event.\n"
+ + "remove -p PARTICIPANT_NAME -e EVENT_NAME: Remove a participant from an event. \n";
+
+ /**
+ * Returns a command output with the menu message
+ *
+ * @return The command output with the menu message
+ */
+ @Override
+ public CommandOutput execute() {
+ return new CommandOutput(MENU_MESSAGE, false);
+ }
+}
\ No newline at end of file
From b9a21f0b82cab5a8e6b991d84f261547efd84358 Mon Sep 17 00:00:00 2001
From: glenn-chew
Date: Tue, 8 Oct 2024 02:51:38 +0800
Subject: [PATCH 047/619] Change COMMAND_WORD to public
---
src/main/java/seedu/manager/command/MenuCommand.java | 4 ++--
1 file changed, 2 insertions(+), 2 deletions(-)
diff --git a/src/main/java/seedu/manager/command/MenuCommand.java b/src/main/java/seedu/manager/command/MenuCommand.java
index d450021b9c..64a3308fc0 100644
--- a/src/main/java/seedu/manager/command/MenuCommand.java
+++ b/src/main/java/seedu/manager/command/MenuCommand.java
@@ -4,7 +4,7 @@
* Represents an executable menu command
*/
public class MenuCommand extends Command {
- private static final String COMMAND_WORD = "menu";
+ public static final String COMMAND_WORD = "menu";
private static final String MENU_MESSAGE = "Here are the possible commands:\n\n"
+ "add -e EVENT_NAME -st START_TIME -et END_TIME -v VENUE -d DESCRIPTION: "
+ "Add an event to the event list.\n"
@@ -23,4 +23,4 @@ public class MenuCommand extends Command {
public CommandOutput execute() {
return new CommandOutput(MENU_MESSAGE, false);
}
-}
\ No newline at end of file
+}
From 5315720e30af5a918441ad1bc56d638c51c50fab Mon Sep 17 00:00:00 2001
From: glenn-chew
Date: Tue, 8 Oct 2024 03:11:01 +0800
Subject: [PATCH 048/619] Update menu message
---
src/main/java/seedu/manager/command/MenuCommand.java | 2 +-
1 file changed, 1 insertion(+), 1 deletion(-)
diff --git a/src/main/java/seedu/manager/command/MenuCommand.java b/src/main/java/seedu/manager/command/MenuCommand.java
index 64a3308fc0..c28cf95b25 100644
--- a/src/main/java/seedu/manager/command/MenuCommand.java
+++ b/src/main/java/seedu/manager/command/MenuCommand.java
@@ -12,7 +12,7 @@ public class MenuCommand extends Command {
+ "remove -e EVENT_NAME: Remove an event from the event list.\n"
+ "add -p PARTICIPANT_NAME -e EVENT_NAME: Add a participant an event.\n"
+ "view -e EVENT_NAME: View the list of participants of an event.\n"
- + "remove -p PARTICIPANT_NAME -e EVENT_NAME: Remove a participant from an event. \n";
+ + "remove -p PARTICIPANT_NAME -e EVENT_NAME: Remove a participant from an event.\n";
/**
* Returns a command output with the menu message
From 731bc39d25456cfa86c49323a8452a5f4636cf41 Mon Sep 17 00:00:00 2001
From: glenn-chew
Date: Tue, 8 Oct 2024 03:11:49 +0800
Subject: [PATCH 049/619] Update Parser to handle menu command
---
src/main/java/seedu/manager/parser/Parser.java | 3 +++
1 file changed, 3 insertions(+)
diff --git a/src/main/java/seedu/manager/parser/Parser.java b/src/main/java/seedu/manager/parser/Parser.java
index fe1f5d692b..8be9e631fa 100644
--- a/src/main/java/seedu/manager/parser/Parser.java
+++ b/src/main/java/seedu/manager/parser/Parser.java
@@ -3,6 +3,7 @@
import seedu.manager.command.Command;
import seedu.manager.command.EchoCommand;
import seedu.manager.command.ExitCommand;
+import seedu.manager.command.MenuCommand;
/**
* Represents the command parser for EventManagerCLI
@@ -21,6 +22,8 @@ public Command parseCommand(String command){
switch (commandWord) {
case ExitCommand.COMMAND_WORD:
return new ExitCommand();
+ case MenuCommand.COMMAND_WORD:
+ return new MenuCommand();
default:
return new EchoCommand(command);
From fbba63741db13b338361142defb90b88f3ac3d54 Mon Sep 17 00:00:00 2001
From: glenn-chew
Date: Tue, 8 Oct 2024 03:12:22 +0800
Subject: [PATCH 050/619] Add unit test for menu command
---
src/test/java/seedu/manager/parser/ParserTest.java | 9 +++++++++
1 file changed, 9 insertions(+)
diff --git a/src/test/java/seedu/manager/parser/ParserTest.java b/src/test/java/seedu/manager/parser/ParserTest.java
index 2471b56221..d8a4f5a7bc 100644
--- a/src/test/java/seedu/manager/parser/ParserTest.java
+++ b/src/test/java/seedu/manager/parser/ParserTest.java
@@ -4,6 +4,7 @@
import seedu.manager.command.EchoCommand;
import org.junit.jupiter.api.Test;
import seedu.manager.command.ExitCommand;
+import seedu.manager.command.MenuCommand;
import static org.junit.jupiter.api.Assertions.assertInstanceOf;
@@ -24,4 +25,12 @@ public void parseCommand_exitWord_exit() {
assertInstanceOf(ExitCommand.class, command);
}
+
+ @Test
+ public void parseCommand_menuWord_menu() {
+ Parser parser = new Parser();
+ Command command = parser.parseCommand("menu");
+
+ assertInstanceOf(MenuCommand.class, command);
+ }
}
From 380f0cc744867af8b29136f1da24dbee95a0f861 Mon Sep 17 00:00:00 2001
From: glenn-chew
Date: Tue, 8 Oct 2024 03:13:01 +0800
Subject: [PATCH 051/619] Update test input and expected output for menu
command
---
text-ui-test/EXPECTED.TXT | 9 +++++++++
text-ui-test/input.txt | 1 +
2 files changed, 10 insertions(+)
diff --git a/text-ui-test/EXPECTED.TXT b/text-ui-test/EXPECTED.TXT
index d7531cfcea..400f9d63f8 100644
--- a/text-ui-test/EXPECTED.TXT
+++ b/text-ui-test/EXPECTED.TXT
@@ -1,3 +1,12 @@
Welcome to EventManagerCLI.
Enter a command: hello world
+Enter a command: Here are the possible commands:
+
+add -e EVENT_NAME -st START_TIME -et END_TIME -v VENUE -d DESCRIPTION: Add an event to the event list.
+list: List events.
+remove -e EVENT_NAME: Remove an event from the event list.
+add -p PARTICIPANT_NAME -e EVENT_NAME: Add a participant an event.
+view -e EVENT_NAME: View the list of participants of an event.
+remove -p PARTICIPANT_NAME -e EVENT_NAME: Remove a participant from an event.
+
Enter a command: Thank you for using EventManagerCLI. Goodbye!
diff --git a/text-ui-test/input.txt b/text-ui-test/input.txt
index 1fc922a43a..f6aab5a964 100644
--- a/text-ui-test/input.txt
+++ b/text-ui-test/input.txt
@@ -1,2 +1,3 @@
hello world
+menu
exit
From 68775557244b9172b3b8366299da79d23321d2a0 Mon Sep 17 00:00:00 2001
From: glenn-chew
Date: Tue, 8 Oct 2024 14:35:46 +0800
Subject: [PATCH 052/619] Update menu message and change to text block
---
.../seedu/manager/command/MenuCommand.java | 18 ++++++++++--------
1 file changed, 10 insertions(+), 8 deletions(-)
diff --git a/src/main/java/seedu/manager/command/MenuCommand.java b/src/main/java/seedu/manager/command/MenuCommand.java
index 64a3308fc0..3010d5851c 100644
--- a/src/main/java/seedu/manager/command/MenuCommand.java
+++ b/src/main/java/seedu/manager/command/MenuCommand.java
@@ -5,14 +5,16 @@
*/
public class MenuCommand extends Command {
public static final String COMMAND_WORD = "menu";
- private static final String MENU_MESSAGE = "Here are the possible commands:\n\n"
- + "add -e EVENT_NAME -st START_TIME -et END_TIME -v VENUE -d DESCRIPTION: "
- + "Add an event to the event list.\n"
- + "list: List events.\n"
- + "remove -e EVENT_NAME: Remove an event from the event list.\n"
- + "add -p PARTICIPANT_NAME -e EVENT_NAME: Add a participant an event.\n"
- + "view -e EVENT_NAME: View the list of participants of an event.\n"
- + "remove -p PARTICIPANT_NAME -e EVENT_NAME: Remove a participant from an event. \n";
+ private static final String MENU_MESSAGE = """
+ Here are the possible commands:
+
+ add -e EVENT_NAME: Add an event to the event list.
+ list: List events.
+ remove -e EVENT_NAME: Remove an event from the event list.
+ add -p PARTICIPANT_NAME -e EVENT_NAME: Add a participant an event.
+ view -e EVENT_NAME: View the list of participants of an event.
+ remove -p PARTICIPANT_NAME -e EVENT_NAME: Remove a participant from an event.
+ """;
/**
* Returns a command output with the menu message
From 427288dc8ff0afbf69cc459391c68f453a5abeb7 Mon Sep 17 00:00:00 2001
From: glenn-chew
Date: Tue, 8 Oct 2024 14:48:59 +0800
Subject: [PATCH 053/619] Update expected test output for new menu message
---
text-ui-test/EXPECTED.TXT | 2 +-
1 file changed, 1 insertion(+), 1 deletion(-)
diff --git a/text-ui-test/EXPECTED.TXT b/text-ui-test/EXPECTED.TXT
index 400f9d63f8..5001973ebf 100644
--- a/text-ui-test/EXPECTED.TXT
+++ b/text-ui-test/EXPECTED.TXT
@@ -2,7 +2,7 @@ Welcome to EventManagerCLI.
Enter a command: hello world
Enter a command: Here are the possible commands:
-add -e EVENT_NAME -st START_TIME -et END_TIME -v VENUE -d DESCRIPTION: Add an event to the event list.
+add -e EVENT_NAME: Add an event to the event list.
list: List events.
remove -e EVENT_NAME: Remove an event from the event list.
add -p PARTICIPANT_NAME -e EVENT_NAME: Add a participant an event.
From b32fa6017a8e7059a1f3419c66f29db656e0e161 Mon Sep 17 00:00:00 2001
From: fuyixuan
Date: Tue, 8 Oct 2024 15:00:13 +0800
Subject: [PATCH 054/619] modify the attribute of Event class
---
src/main/java/seedu/manager/event/Event.java | 36 ++++++++------------
1 file changed, 14 insertions(+), 22 deletions(-)
diff --git a/src/main/java/seedu/manager/event/Event.java b/src/main/java/seedu/manager/event/Event.java
index 8ff7f5550f..9888d43030 100644
--- a/src/main/java/seedu/manager/event/Event.java
+++ b/src/main/java/seedu/manager/event/Event.java
@@ -2,35 +2,27 @@
public abstract class Event {
private final String eventName;
- private String startTime;
- private String endTime;
- private String venue;
- private String description;
- public Event(String eventName, String startTime, String endTime, String venue) {
+ private String eventTime;
+ private String eventVenue;
+ public Event(String eventName, String eventTime, String eventVenue) {
this.eventName = eventName;
- this.startTime = startTime;
- this.endTime = endTime;
- this.venue = venue;
+ this.eventTime = eventTime;
+ this.eventVenue = eventVenue;
}
public String getEventName() {
return eventName;
}
- public String getStartTime() {
- return startTime;
+ public String getEventTime() {
+ return eventTime;
}
- public String getEndTime() {
- return endTime;
+ public String getEventVenue() {
+ return eventVenue;
}
- public String getVenue() {
- return venue;
+ public void setEventTime(String eventTime) {
+ this.eventTime = eventTime;
}
- public void setStartTime(String startTime) {
- this.startTime = startTime;
- }
- public void setEndTime(String endTime) {
- this.endTime = endTime;
- }
- public void setVenue(String venue) {
- this.venue = venue;
+ public void setEventVenue(String eventVenue) {
+ this.eventVenue = eventVenue;
}
+
}
From 93d89a56f2fa2420d8e80f2f121381872e2d1868 Mon Sep 17 00:00:00 2001
From: fuyixuan
Date: Tue, 8 Oct 2024 15:32:41 +0800
Subject: [PATCH 055/619] modify the subclass of Event class
---
src/main/java/seedu/manager/event/LectureEvent.java | 4 ++--
1 file changed, 2 insertions(+), 2 deletions(-)
diff --git a/src/main/java/seedu/manager/event/LectureEvent.java b/src/main/java/seedu/manager/event/LectureEvent.java
index ab7f6ab6e7..a328211037 100644
--- a/src/main/java/seedu/manager/event/LectureEvent.java
+++ b/src/main/java/seedu/manager/event/LectureEvent.java
@@ -2,7 +2,7 @@
public class LectureEvent extends Event {
- public LectureEvent(String eventName, String startTime, String endTime, String venue) {
- super(eventName, startTime, endTime, venue);
+ public LectureEvent(String eventName, String eventTime, String eventVenue) {
+ super(eventName, eventTime, eventVenue);
}
}
From f0717e7bfbac04f82bb425a0e6a17b5a97458af8 Mon Sep 17 00:00:00 2001
From: fuyixuan
Date: Tue, 8 Oct 2024 17:47:23 +0800
Subject: [PATCH 056/619] delect the subclas of Event. Make Event not abstract.
---
src/main/java/seedu/manager/event/Event.java | 3 +--
src/main/java/seedu/manager/event/LectureEvent.java | 8 --------
2 files changed, 1 insertion(+), 10 deletions(-)
delete mode 100644 src/main/java/seedu/manager/event/LectureEvent.java
diff --git a/src/main/java/seedu/manager/event/Event.java b/src/main/java/seedu/manager/event/Event.java
index 9888d43030..85569c5e08 100644
--- a/src/main/java/seedu/manager/event/Event.java
+++ b/src/main/java/seedu/manager/event/Event.java
@@ -1,6 +1,6 @@
package seedu.manager.event;
-public abstract class Event {
+public class Event {
private final String eventName;
private String eventTime;
private String eventVenue;
@@ -24,5 +24,4 @@ public void setEventTime(String eventTime) {
public void setEventVenue(String eventVenue) {
this.eventVenue = eventVenue;
}
-
}
diff --git a/src/main/java/seedu/manager/event/LectureEvent.java b/src/main/java/seedu/manager/event/LectureEvent.java
deleted file mode 100644
index a328211037..0000000000
--- a/src/main/java/seedu/manager/event/LectureEvent.java
+++ /dev/null
@@ -1,8 +0,0 @@
-package seedu.manager.event;
-
-
-public class LectureEvent extends Event {
- public LectureEvent(String eventName, String eventTime, String eventVenue) {
- super(eventName, eventTime, eventVenue);
- }
-}
From 2038c15190746bd39ec778f6be61cc00237c74ca Mon Sep 17 00:00:00 2001
From: fuyixuan
Date: Tue, 8 Oct 2024 21:01:43 +0800
Subject: [PATCH 057/619] add JavaDoc header comments
---
src/main/java/seedu/manager/event/Event.java | 4 ++++
1 file changed, 4 insertions(+)
diff --git a/src/main/java/seedu/manager/event/Event.java b/src/main/java/seedu/manager/event/Event.java
index 85569c5e08..b1e6033356 100644
--- a/src/main/java/seedu/manager/event/Event.java
+++ b/src/main/java/seedu/manager/event/Event.java
@@ -1,5 +1,9 @@
package seedu.manager.event;
+/**
+ * The Event class represents an event with a name, time, and venue.
+ * It provides methods to access and modify the time and venue of the event.
+ */
public class Event {
private final String eventName;
private String eventTime;
From 15b16b6e7a26bffa1d057aa7e37c3a4218c2aae0 Mon Sep 17 00:00:00 2001
From: fuyixuan
Date: Tue, 8 Oct 2024 21:05:41 +0800
Subject: [PATCH 058/619] add JavaDoc for methods
---
src/main/java/seedu/manager/event/Event.java | 28 ++++++++++++++++++++
1 file changed, 28 insertions(+)
diff --git a/src/main/java/seedu/manager/event/Event.java b/src/main/java/seedu/manager/event/Event.java
index b1e6033356..7d123d6fb9 100644
--- a/src/main/java/seedu/manager/event/Event.java
+++ b/src/main/java/seedu/manager/event/Event.java
@@ -8,23 +8,51 @@ public class Event {
private final String eventName;
private String eventTime;
private String eventVenue;
+
+ /**
+ * Constructs an Event with the specified name, time, and venue.
+ *
+ * @param eventName the name of the event
+ * @param eventTime the time duration of the event
+ * @param eventVenue the venue of the event
+ */
public Event(String eventName, String eventTime, String eventVenue) {
this.eventName = eventName;
this.eventTime = eventTime;
this.eventVenue = eventVenue;
}
+
+ /**
+ * @return the event name
+ */
public String getEventName() {
return eventName;
}
+ /**
+ * @return the event time
+ */
public String getEventTime() {
return eventTime;
}
+ /**
+ * @return the event venue
+ */
public String getEventVenue() {
return eventVenue;
}
+ /**
+ * Sets a new time for the event.
+ *
+ * @param eventTime the new event time
+ */
public void setEventTime(String eventTime) {
this.eventTime = eventTime;
}
+ /**
+ * Sets a new venue for the event.
+ *
+ * @param eventVenue the new event time
+ */
public void setEventVenue(String eventVenue) {
this.eventVenue = eventVenue;
}
From b34d2aedf0f17cf618ea1c353e7784ac75977536 Mon Sep 17 00:00:00 2001
From: fuyixuan
Date: Tue, 8 Oct 2024 23:05:00 +0800
Subject: [PATCH 059/619] Add support for the 'add' command to the parser
---
.../seedu/manager/command/AddCommand.java | 21 +++++++++++++++++++
.../java/seedu/manager/parser/Parser.java | 7 +++----
2 files changed, 24 insertions(+), 4 deletions(-)
create mode 100644 src/main/java/seedu/manager/command/AddCommand.java
diff --git a/src/main/java/seedu/manager/command/AddCommand.java b/src/main/java/seedu/manager/command/AddCommand.java
new file mode 100644
index 0000000000..7804f1eddc
--- /dev/null
+++ b/src/main/java/seedu/manager/command/AddCommand.java
@@ -0,0 +1,21 @@
+package seedu.manager.command;
+
+/**
+ * Represents an executable add command
+ */
+public class AddCommand extends Command {
+ public static final String COMMAND_WORD = "add";
+ private static final String ADD_MESSAGE = "The following event has been added to the event list: %1$s";
+
+ /**
+ * Implement the adding command
+ * Returns a command output with a successful adding message
+ *
+ * @return The command output with a successful adding message
+ */
+ @Override
+ public CommandOutput execute() {
+
+ return new CommandOutput(ADD_MESSAGE, false);
+ }
+}
diff --git a/src/main/java/seedu/manager/parser/Parser.java b/src/main/java/seedu/manager/parser/Parser.java
index 8be9e631fa..aa8ff639c3 100644
--- a/src/main/java/seedu/manager/parser/Parser.java
+++ b/src/main/java/seedu/manager/parser/Parser.java
@@ -1,9 +1,6 @@
package seedu.manager.parser;
-import seedu.manager.command.Command;
-import seedu.manager.command.EchoCommand;
-import seedu.manager.command.ExitCommand;
-import seedu.manager.command.MenuCommand;
+import seedu.manager.command.*;
/**
* Represents the command parser for EventManagerCLI
@@ -20,6 +17,8 @@ public Command parseCommand(String command){
String commandWord = commandParts[0];
switch (commandWord) {
+ case AddCommand.COMMAND_WORD:
+ return new AddCommand();
case ExitCommand.COMMAND_WORD:
return new ExitCommand();
case MenuCommand.COMMAND_WORD:
From 5f0216a5484cdcf923265a8a27b9d9e1fae4f3d2 Mon Sep 17 00:00:00 2001
From: fuyixuan
Date: Tue, 8 Oct 2024 23:12:58 +0800
Subject: [PATCH 060/619] modify the import approach to avoid error.
---
src/main/java/seedu/manager/parser/Parser.java | 6 +++++-
1 file changed, 5 insertions(+), 1 deletion(-)
diff --git a/src/main/java/seedu/manager/parser/Parser.java b/src/main/java/seedu/manager/parser/Parser.java
index aa8ff639c3..0754ac2e9c 100644
--- a/src/main/java/seedu/manager/parser/Parser.java
+++ b/src/main/java/seedu/manager/parser/Parser.java
@@ -1,6 +1,10 @@
package seedu.manager.parser;
-import seedu.manager.command.*;
+import seedu.manager.command.Command;
+import seedu.manager.command.AddCommand;
+import seedu.manager.command.ExitCommand;
+import seedu.manager.command.MenuCommand;
+import seedu.manager.command.EchoCommand;
/**
* Represents the command parser for EventManagerCLI
From b8c3251d2bb29f7d753ca3e4393a2069852375ab Mon Sep 17 00:00:00 2001
From: fuyixuan
Date: Tue, 8 Oct 2024 23:17:57 +0800
Subject: [PATCH 061/619] delete the unexpected indention to aviod error
---
src/main/java/seedu/manager/parser/Parser.java | 2 +-
1 file changed, 1 insertion(+), 1 deletion(-)
diff --git a/src/main/java/seedu/manager/parser/Parser.java b/src/main/java/seedu/manager/parser/Parser.java
index 0754ac2e9c..0da1db621b 100644
--- a/src/main/java/seedu/manager/parser/Parser.java
+++ b/src/main/java/seedu/manager/parser/Parser.java
@@ -22,7 +22,7 @@ public Command parseCommand(String command){
switch (commandWord) {
case AddCommand.COMMAND_WORD:
- return new AddCommand();
+ return new AddCommand();
case ExitCommand.COMMAND_WORD:
return new ExitCommand();
case MenuCommand.COMMAND_WORD:
From 57c2827c7e977bdab0ef3727abfd906b71cedba2 Mon Sep 17 00:00:00 2001
From: fuyixuan
Date: Wed, 9 Oct 2024 12:37:23 +0800
Subject: [PATCH 062/619] Add support for the 'list' command to the parser
---
.../java/seedu/manager/command/ListCommand.java | 15 +++++++++++++++
src/main/java/seedu/manager/parser/Parser.java | 4 ++++
2 files changed, 19 insertions(+)
create mode 100644 src/main/java/seedu/manager/command/ListCommand.java
diff --git a/src/main/java/seedu/manager/command/ListCommand.java b/src/main/java/seedu/manager/command/ListCommand.java
new file mode 100644
index 0000000000..003900001f
--- /dev/null
+++ b/src/main/java/seedu/manager/command/ListCommand.java
@@ -0,0 +1,15 @@
+package seedu.manager.command;
+
+public class ListCommand extends Command {
+ public static final String COMMAND_WORD = "list";
+ private static final String LIST_MESSAGE = "Here are your scheduled events:";
+
+ /**
+ * Returns a command output with a list message
+ *
+ * @return The command output with a list message
+ */
+ public CommandOutput execute() {
+ return new CommandOutput(LIST_MESSAGE, false);
+ }
+}
diff --git a/src/main/java/seedu/manager/parser/Parser.java b/src/main/java/seedu/manager/parser/Parser.java
index 0da1db621b..2d5361c854 100644
--- a/src/main/java/seedu/manager/parser/Parser.java
+++ b/src/main/java/seedu/manager/parser/Parser.java
@@ -5,6 +5,8 @@
import seedu.manager.command.ExitCommand;
import seedu.manager.command.MenuCommand;
import seedu.manager.command.EchoCommand;
+import seedu.manager.command.ListCommand;
+
/**
* Represents the command parser for EventManagerCLI
@@ -23,6 +25,8 @@ public Command parseCommand(String command){
switch (commandWord) {
case AddCommand.COMMAND_WORD:
return new AddCommand();
+ case ListCommand.COMMAND_WORD:
+ return new ListCommand();
case ExitCommand.COMMAND_WORD:
return new ExitCommand();
case MenuCommand.COMMAND_WORD:
From 5cfc6bfcf2174f46ce32023b49700e576e6ee443 Mon Sep 17 00:00:00 2001
From: fuyixuan
Date: Wed, 9 Oct 2024 21:04:23 +0800
Subject: [PATCH 063/619] Rebuild the structure based on the previous one
---
src/main/java/seedu/manager/Main.java | 16 ++++++++++++-
.../seedu/manager/command/AddCommand.java | 1 -
.../java/seedu/manager/command/Command.java | 7 ++++++
.../seedu/manager/command/CommandOutput.java | 8 ++++---
.../seedu/manager/command/MenuCommand.java | 5 ++--
src/main/java/seedu/manager/ui/Ui.java | 24 +++++++++----------
6 files changed, 40 insertions(+), 21 deletions(-)
diff --git a/src/main/java/seedu/manager/Main.java b/src/main/java/seedu/manager/Main.java
index dbf2d6327d..0028402e19 100644
--- a/src/main/java/seedu/manager/Main.java
+++ b/src/main/java/seedu/manager/Main.java
@@ -1,6 +1,9 @@
package seedu.manager;
+import seedu.manager.command.Command;
+import seedu.manager.command.CommandOutput;
import seedu.manager.event.EventList;
+import seedu.manager.parser.Parser;
import seedu.manager.ui.Ui;
public class Main {
@@ -12,6 +15,17 @@ public class Main {
*/
public static void main(String[] args) {
ui.greetUser();
- ui.getCommands();
+ Command command;
+ boolean isGettingCommands = true;
+ while(isGettingCommands){
+ String userCommandText = ui.getCommands();
+ command = new Parser().parseCommand(userCommandText);
+ command.setData(events);
+ CommandOutput output = command.execute();
+ ui.showOutputToUser(output);
+
+ isGettingCommands = !output.getCanExit();
+ }
+ System.exit(0);
}
}
diff --git a/src/main/java/seedu/manager/command/AddCommand.java b/src/main/java/seedu/manager/command/AddCommand.java
index 7804f1eddc..f1c1cc5f56 100644
--- a/src/main/java/seedu/manager/command/AddCommand.java
+++ b/src/main/java/seedu/manager/command/AddCommand.java
@@ -15,7 +15,6 @@ public class AddCommand extends Command {
*/
@Override
public CommandOutput execute() {
-
return new CommandOutput(ADD_MESSAGE, false);
}
}
diff --git a/src/main/java/seedu/manager/command/Command.java b/src/main/java/seedu/manager/command/Command.java
index 528f1564ed..ff043be18c 100644
--- a/src/main/java/seedu/manager/command/Command.java
+++ b/src/main/java/seedu/manager/command/Command.java
@@ -1,9 +1,16 @@
package seedu.manager.command;
+import seedu.manager.event.EventList;
+
/**
* Represents an executable command
*/
public abstract class Command {
+ protected EventList eventList;
+
+ public void setData(EventList events) {
+ this.eventList = events;
+ }
/**
* Returns the output of the executable command
diff --git a/src/main/java/seedu/manager/command/CommandOutput.java b/src/main/java/seedu/manager/command/CommandOutput.java
index 95d7213e6b..b3db269614 100644
--- a/src/main/java/seedu/manager/command/CommandOutput.java
+++ b/src/main/java/seedu/manager/command/CommandOutput.java
@@ -19,10 +19,12 @@ public CommandOutput(String message, boolean canExit) {
}
/**
- * Prints the message of the command output.
+ * Get the message attribute of CommandOutput
+ *
+ * @return the message of command output
*/
- public void printMessage() {
- System.out.println(this.message);
+ public String getMessage() {
+ return message;
}
/**
diff --git a/src/main/java/seedu/manager/command/MenuCommand.java b/src/main/java/seedu/manager/command/MenuCommand.java
index 3010d5851c..0bd21176f8 100644
--- a/src/main/java/seedu/manager/command/MenuCommand.java
+++ b/src/main/java/seedu/manager/command/MenuCommand.java
@@ -7,14 +7,13 @@ public class MenuCommand extends Command {
public static final String COMMAND_WORD = "menu";
private static final String MENU_MESSAGE = """
Here are the possible commands:
-
+ \s
add -e EVENT_NAME: Add an event to the event list.
list: List events.
remove -e EVENT_NAME: Remove an event from the event list.
add -p PARTICIPANT_NAME -e EVENT_NAME: Add a participant an event.
view -e EVENT_NAME: View the list of participants of an event.
- remove -p PARTICIPANT_NAME -e EVENT_NAME: Remove a participant from an event.
- """;
+ remove -p PARTICIPANT_NAME -e EVENT_NAME: Remove a participant from an event.\s""";
/**
* Returns a command output with the menu message
diff --git a/src/main/java/seedu/manager/ui/Ui.java b/src/main/java/seedu/manager/ui/Ui.java
index b50bb91ad9..84134c7b37 100644
--- a/src/main/java/seedu/manager/ui/Ui.java
+++ b/src/main/java/seedu/manager/ui/Ui.java
@@ -14,14 +14,12 @@ public class Ui {
private static final String COMMAND_PROMPT_MESSAGE = "Enter a command: ";
private final Scanner userInput;
- private final Parser parser;
/**
* Constructs a new Ui
*/
public Ui() {
this.userInput = new Scanner(System.in);
- this.parser = new Parser();
}
/**
@@ -34,16 +32,16 @@ public void greetUser() {
/**
* Gets input from the user, and executes commands based on that input
*/
- public void getCommands() {
- boolean isGettingCommands = true;
-
- while (isGettingCommands) {
- System.out.print(COMMAND_PROMPT_MESSAGE);
- String rawInput = this.userInput.nextLine();
- Command command = parser.parseCommand(rawInput);
- CommandOutput output = command.execute();
- output.printMessage();
- isGettingCommands = !output.getCanExit();
- }
+ public String getCommands() {
+ System.out.print(COMMAND_PROMPT_MESSAGE);
+ return this.userInput.nextLine();
+ }
+
+ /**
+ * show the output of command to the users.
+ */
+ public void showOutputToUser(CommandOutput output){
+ System.out.println(output.getMessage());
+ System.out.println();
}
}
From e999b8b0324a75f24e1a9563a8698d43e424e73f Mon Sep 17 00:00:00 2001
From: fuyixuan
Date: Wed, 9 Oct 2024 21:10:41 +0800
Subject: [PATCH 064/619] extract the method and add javaDoc
---
src/main/java/seedu/manager/Main.java | 10 +++++++++-
1 file changed, 9 insertions(+), 1 deletion(-)
diff --git a/src/main/java/seedu/manager/Main.java b/src/main/java/seedu/manager/Main.java
index 0028402e19..b1f82ff65a 100644
--- a/src/main/java/seedu/manager/Main.java
+++ b/src/main/java/seedu/manager/Main.java
@@ -15,6 +15,15 @@ public class Main {
*/
public static void main(String[] args) {
ui.greetUser();
+ runCommandLoop();
+ }
+
+ /**
+ * Run command loop to get command from users
+ * Parse the command and execute it
+ * The loop ends when ExitCommand is triggered
+ */
+ private static void runCommandLoop() {
Command command;
boolean isGettingCommands = true;
while(isGettingCommands){
@@ -26,6 +35,5 @@ public static void main(String[] args) {
isGettingCommands = !output.getCanExit();
}
- System.exit(0);
}
}
From b08c835e9efa210289c139afa5675fa16d566869 Mon Sep 17 00:00:00 2001
From: fuyixuan
Date: Wed, 9 Oct 2024 21:16:32 +0800
Subject: [PATCH 065/619] remove the redundant import to avoid error.
---
src/main/java/seedu/manager/ui/Ui.java | 2 --
1 file changed, 2 deletions(-)
diff --git a/src/main/java/seedu/manager/ui/Ui.java b/src/main/java/seedu/manager/ui/Ui.java
index 84134c7b37..a1172912ec 100644
--- a/src/main/java/seedu/manager/ui/Ui.java
+++ b/src/main/java/seedu/manager/ui/Ui.java
@@ -1,8 +1,6 @@
package seedu.manager.ui;
-import seedu.manager.command.Command;
import seedu.manager.command.CommandOutput;
-import seedu.manager.parser.Parser;
import java.util.Scanner;
From f44586a0e42899a973428bedc37725f723a015c4 Mon Sep 17 00:00:00 2001
From: fuyixuan
Date: Wed, 9 Oct 2024 21:27:41 +0800
Subject: [PATCH 066/619] .
---
src/main/java/seedu/manager/Main.java | 1 +
src/main/java/seedu/manager/command/MenuCommand.java | 5 +++--
2 files changed, 4 insertions(+), 2 deletions(-)
diff --git a/src/main/java/seedu/manager/Main.java b/src/main/java/seedu/manager/Main.java
index b1f82ff65a..fb12d9cdea 100644
--- a/src/main/java/seedu/manager/Main.java
+++ b/src/main/java/seedu/manager/Main.java
@@ -16,6 +16,7 @@ public class Main {
public static void main(String[] args) {
ui.greetUser();
runCommandLoop();
+
}
/**
diff --git a/src/main/java/seedu/manager/command/MenuCommand.java b/src/main/java/seedu/manager/command/MenuCommand.java
index 0bd21176f8..1c510f71c3 100644
--- a/src/main/java/seedu/manager/command/MenuCommand.java
+++ b/src/main/java/seedu/manager/command/MenuCommand.java
@@ -7,13 +7,14 @@ public class MenuCommand extends Command {
public static final String COMMAND_WORD = "menu";
private static final String MENU_MESSAGE = """
Here are the possible commands:
- \s
+
add -e EVENT_NAME: Add an event to the event list.
list: List events.
remove -e EVENT_NAME: Remove an event from the event list.
add -p PARTICIPANT_NAME -e EVENT_NAME: Add a participant an event.
view -e EVENT_NAME: View the list of participants of an event.
- remove -p PARTICIPANT_NAME -e EVENT_NAME: Remove a participant from an event.\s""";
+ remove -p PARTICIPANT_NAME -e EVENT_NAME: Remove a participant from an event.
+ """;
/**
* Returns a command output with the menu message
From 3b588cb0af893b96d55ddd43ec957b90e51d7993 Mon Sep 17 00:00:00 2001
From: fuyixuan
Date: Wed, 9 Oct 2024 21:44:41 +0800
Subject: [PATCH 067/619] delete the empty line
---
src/main/java/seedu/manager/Main.java | 2 +-
src/main/java/seedu/manager/ui/Ui.java | 1 -
text-ui-test/runtest.sh | 1 +
3 files changed, 2 insertions(+), 2 deletions(-)
diff --git a/src/main/java/seedu/manager/Main.java b/src/main/java/seedu/manager/Main.java
index fb12d9cdea..27c1ec511b 100644
--- a/src/main/java/seedu/manager/Main.java
+++ b/src/main/java/seedu/manager/Main.java
@@ -16,7 +16,7 @@ public class Main {
public static void main(String[] args) {
ui.greetUser();
runCommandLoop();
-
+ System.exit(0);
}
/**
diff --git a/src/main/java/seedu/manager/ui/Ui.java b/src/main/java/seedu/manager/ui/Ui.java
index a1172912ec..839b90925a 100644
--- a/src/main/java/seedu/manager/ui/Ui.java
+++ b/src/main/java/seedu/manager/ui/Ui.java
@@ -40,6 +40,5 @@ public String getCommands() {
*/
public void showOutputToUser(CommandOutput output){
System.out.println(output.getMessage());
- System.out.println();
}
}
diff --git a/text-ui-test/runtest.sh b/text-ui-test/runtest.sh
index 1dcbd12021..f8177afc4d 100755
--- a/text-ui-test/runtest.sh
+++ b/text-ui-test/runtest.sh
@@ -13,6 +13,7 @@ java -jar $(find ../build/libs/ -mindepth 1 -print -quit) < input.txt > ACTUAL.
cp EXPECTED.TXT EXPECTED-UNIX.TXT
dos2unix EXPECTED-UNIX.TXT ACTUAL.TXT
diff EXPECTED-UNIX.TXT ACTUAL.TXT
+
if [ $? -eq 0 ]
then
echo "Test passed!"
From bdb2cc4a8c35095edf96ac32f0e8421c031799de Mon Sep 17 00:00:00 2001
From: fuyixuan
Date: Wed, 9 Oct 2024 22:24:28 +0800
Subject: [PATCH 068/619] add an empty line between each command input
---
src/main/java/seedu/manager/command/MenuCommand.java | 3 +--
src/main/java/seedu/manager/ui/Ui.java | 1 +
text-ui-test/EXPECTED.TXT | 2 ++
3 files changed, 4 insertions(+), 2 deletions(-)
diff --git a/src/main/java/seedu/manager/command/MenuCommand.java b/src/main/java/seedu/manager/command/MenuCommand.java
index 1c510f71c3..a7409ce763 100644
--- a/src/main/java/seedu/manager/command/MenuCommand.java
+++ b/src/main/java/seedu/manager/command/MenuCommand.java
@@ -13,8 +13,7 @@ public class MenuCommand extends Command {
remove -e EVENT_NAME: Remove an event from the event list.
add -p PARTICIPANT_NAME -e EVENT_NAME: Add a participant an event.
view -e EVENT_NAME: View the list of participants of an event.
- remove -p PARTICIPANT_NAME -e EVENT_NAME: Remove a participant from an event.
- """;
+ remove -p PARTICIPANT_NAME -e EVENT_NAME: Remove a participant from an event.""";
/**
* Returns a command output with the menu message
diff --git a/src/main/java/seedu/manager/ui/Ui.java b/src/main/java/seedu/manager/ui/Ui.java
index 839b90925a..a1172912ec 100644
--- a/src/main/java/seedu/manager/ui/Ui.java
+++ b/src/main/java/seedu/manager/ui/Ui.java
@@ -40,5 +40,6 @@ public String getCommands() {
*/
public void showOutputToUser(CommandOutput output){
System.out.println(output.getMessage());
+ System.out.println();
}
}
diff --git a/text-ui-test/EXPECTED.TXT b/text-ui-test/EXPECTED.TXT
index 5001973ebf..c02e2f7126 100644
--- a/text-ui-test/EXPECTED.TXT
+++ b/text-ui-test/EXPECTED.TXT
@@ -1,5 +1,6 @@
Welcome to EventManagerCLI.
Enter a command: hello world
+
Enter a command: Here are the possible commands:
add -e EVENT_NAME: Add an event to the event list.
@@ -10,3 +11,4 @@ view -e EVENT_NAME: View the list of participants of an event.
remove -p PARTICIPANT_NAME -e EVENT_NAME: Remove a participant from an event.
Enter a command: Thank you for using EventManagerCLI. Goodbye!
+
From 337a6ab5ccc6ed59e5456d46940fceb8d6c2e96f Mon Sep 17 00:00:00 2001
From: fuyixuan
Date: Thu, 10 Oct 2024 00:10:51 +0800
Subject: [PATCH 069/619] correct the detail errors, add a separator.
---
src/main/java/seedu/manager/Main.java | 4 ++--
src/main/java/seedu/manager/ui/Ui.java | 5 +++--
text-ui-test/EXPECTED.TXT | 6 +++---
3 files changed, 8 insertions(+), 7 deletions(-)
diff --git a/src/main/java/seedu/manager/Main.java b/src/main/java/seedu/manager/Main.java
index 27c1ec511b..1cabfb86fe 100644
--- a/src/main/java/seedu/manager/Main.java
+++ b/src/main/java/seedu/manager/Main.java
@@ -27,8 +27,8 @@ public static void main(String[] args) {
private static void runCommandLoop() {
Command command;
boolean isGettingCommands = true;
- while(isGettingCommands){
- String userCommandText = ui.getCommands();
+ while (isGettingCommands){
+ String userCommandText = ui.getCommand();
command = new Parser().parseCommand(userCommandText);
command.setData(events);
CommandOutput output = command.execute();
diff --git a/src/main/java/seedu/manager/ui/Ui.java b/src/main/java/seedu/manager/ui/Ui.java
index a1172912ec..eee700d76b 100644
--- a/src/main/java/seedu/manager/ui/Ui.java
+++ b/src/main/java/seedu/manager/ui/Ui.java
@@ -10,6 +10,7 @@
public class Ui {
private static final String WELCOME_MESSAGE = "Welcome to EventManagerCLI.";
private static final String COMMAND_PROMPT_MESSAGE = "Enter a command: ";
+ private static final String SEPARATOR = "------------------------";
private final Scanner userInput;
@@ -30,7 +31,7 @@ public void greetUser() {
/**
* Gets input from the user, and executes commands based on that input
*/
- public String getCommands() {
+ public String getCommand() {
System.out.print(COMMAND_PROMPT_MESSAGE);
return this.userInput.nextLine();
}
@@ -40,6 +41,6 @@ public String getCommands() {
*/
public void showOutputToUser(CommandOutput output){
System.out.println(output.getMessage());
- System.out.println();
+ System.out.println(SEPARATOR);
}
}
diff --git a/text-ui-test/EXPECTED.TXT b/text-ui-test/EXPECTED.TXT
index c02e2f7126..eca6507a19 100644
--- a/text-ui-test/EXPECTED.TXT
+++ b/text-ui-test/EXPECTED.TXT
@@ -1,6 +1,6 @@
Welcome to EventManagerCLI.
Enter a command: hello world
-
+------------------------
Enter a command: Here are the possible commands:
add -e EVENT_NAME: Add an event to the event list.
@@ -9,6 +9,6 @@ remove -e EVENT_NAME: Remove an event from the event list.
add -p PARTICIPANT_NAME -e EVENT_NAME: Add a participant an event.
view -e EVENT_NAME: View the list of participants of an event.
remove -p PARTICIPANT_NAME -e EVENT_NAME: Remove a participant from an event.
-
+------------------------
Enter a command: Thank you for using EventManagerCLI. Goodbye!
-
+------------------------
From 5461875955dabb4d2dd5ececd54712b03e09889a Mon Sep 17 00:00:00 2001
From: fuyixuan
Date: Thu, 10 Oct 2024 16:06:50 +0800
Subject: [PATCH 070/619] override the toString()
---
src/main/java/seedu/manager/command/ListCommand.java | 1 +
src/main/java/seedu/manager/event/Event.java | 10 ++++++++++
src/test/java/seedu/manager/parser/ParserTest.java | 8 ++++++++
3 files changed, 19 insertions(+)
diff --git a/src/main/java/seedu/manager/command/ListCommand.java b/src/main/java/seedu/manager/command/ListCommand.java
index 003900001f..0492d10f10 100644
--- a/src/main/java/seedu/manager/command/ListCommand.java
+++ b/src/main/java/seedu/manager/command/ListCommand.java
@@ -10,6 +10,7 @@ public class ListCommand extends Command {
* @return The command output with a list message
*/
public CommandOutput execute() {
+
return new CommandOutput(LIST_MESSAGE, false);
}
}
diff --git a/src/main/java/seedu/manager/event/Event.java b/src/main/java/seedu/manager/event/Event.java
index 7d123d6fb9..d904a7f65a 100644
--- a/src/main/java/seedu/manager/event/Event.java
+++ b/src/main/java/seedu/manager/event/Event.java
@@ -56,4 +56,14 @@ public void setEventTime(String eventTime) {
public void setEventVenue(String eventVenue) {
this.eventVenue = eventVenue;
}
+
+ /**
+ * Returns a string representation of the event, indicating its name, time and venue.
+ *
+ * @return A string that shows the event's name, time and venue.
+ */
+ @Override
+ public String toString(){
+ return "Event name: " + eventName + "/ Event time: " + eventTime + "/ Event venue: " + eventVenue;
+ }
}
diff --git a/src/test/java/seedu/manager/parser/ParserTest.java b/src/test/java/seedu/manager/parser/ParserTest.java
index d8a4f5a7bc..9827b63139 100644
--- a/src/test/java/seedu/manager/parser/ParserTest.java
+++ b/src/test/java/seedu/manager/parser/ParserTest.java
@@ -33,4 +33,12 @@ public void parseCommand_menuWord_menu() {
assertInstanceOf(MenuCommand.class, command);
}
+
+ @Test
+ public void parseCommand_listWord_list() {
+ Parser parser = new Parser();
+ Command command = parser.parseCommand("list");
+
+ assertInstanceOf(MenuCommand.class, command);
+ }
}
From 6708b215f3b08fd4810287fb5fa7df4a296a7269 Mon Sep 17 00:00:00 2001
From: fuyixuan
Date: Thu, 10 Oct 2024 16:48:01 +0800
Subject: [PATCH 071/619] implement ListCommand
---
src/main/java/seedu/manager/command/ListCommand.java | 8 ++++++--
src/main/java/seedu/manager/event/EventList.java | 8 ++++++++
src/test/java/seedu/manager/parser/ParserTest.java | 5 +++--
text-ui-test/EXPECTED.TXT | 3 +++
text-ui-test/input.txt | 1 +
5 files changed, 21 insertions(+), 4 deletions(-)
diff --git a/src/main/java/seedu/manager/command/ListCommand.java b/src/main/java/seedu/manager/command/ListCommand.java
index 0492d10f10..0f05ccf231 100644
--- a/src/main/java/seedu/manager/command/ListCommand.java
+++ b/src/main/java/seedu/manager/command/ListCommand.java
@@ -2,7 +2,7 @@
public class ListCommand extends Command {
public static final String COMMAND_WORD = "list";
- private static final String LIST_MESSAGE = "Here are your scheduled events:";
+ private static final String LIST_MESSAGE = "There are %1$d events in your list! Here are your scheduled events:";
/**
* Returns a command output with a list message
@@ -10,7 +10,11 @@ public class ListCommand extends Command {
* @return The command output with a list message
*/
public CommandOutput execute() {
+ StringBuilder outputMessage = new StringBuilder(String.format(LIST_MESSAGE, eventList.getListSize()) + "\n");
+ for (int i = 0; i < eventList.getListSize(); i++) {
+ outputMessage.append(i + 1).append(". ").append(eventList.getEvent(i).toString()).append("\n");
+ }
- return new CommandOutput(LIST_MESSAGE, false);
+ return new CommandOutput(outputMessage.toString(), false);
}
}
diff --git a/src/main/java/seedu/manager/event/EventList.java b/src/main/java/seedu/manager/event/EventList.java
index 3f265abed6..3f55a97a18 100644
--- a/src/main/java/seedu/manager/event/EventList.java
+++ b/src/main/java/seedu/manager/event/EventList.java
@@ -39,4 +39,12 @@ public ArrayList getList() {
public int getListSize() {
return eventList.size();
}
+
+ /**
+ * @param index The index of event in the list (0 based indexing)
+ * @return The specific event in the event list.
+ */
+ public Event getEvent(int index) {
+ return eventList.get(index);
+ }
}
diff --git a/src/test/java/seedu/manager/parser/ParserTest.java b/src/test/java/seedu/manager/parser/ParserTest.java
index 9827b63139..43ca7f7e57 100644
--- a/src/test/java/seedu/manager/parser/ParserTest.java
+++ b/src/test/java/seedu/manager/parser/ParserTest.java
@@ -1,10 +1,11 @@
package seedu.manager.parser;
+import org.junit.jupiter.api.Test;
import seedu.manager.command.Command;
import seedu.manager.command.EchoCommand;
-import org.junit.jupiter.api.Test;
import seedu.manager.command.ExitCommand;
import seedu.manager.command.MenuCommand;
+import seedu.manager.command.ListCommand;
import static org.junit.jupiter.api.Assertions.assertInstanceOf;
@@ -39,6 +40,6 @@ public void parseCommand_listWord_list() {
Parser parser = new Parser();
Command command = parser.parseCommand("list");
- assertInstanceOf(MenuCommand.class, command);
+ assertInstanceOf(ListCommand.class, command);
}
}
diff --git a/text-ui-test/EXPECTED.TXT b/text-ui-test/EXPECTED.TXT
index eca6507a19..786f0ac5f1 100644
--- a/text-ui-test/EXPECTED.TXT
+++ b/text-ui-test/EXPECTED.TXT
@@ -9,6 +9,9 @@ remove -e EVENT_NAME: Remove an event from the event list.
add -p PARTICIPANT_NAME -e EVENT_NAME: Add a participant an event.
view -e EVENT_NAME: View the list of participants of an event.
remove -p PARTICIPANT_NAME -e EVENT_NAME: Remove a participant from an event.
+------------------------
+Enter a command: There are 0 events in your list! Here are your scheduled events:
+
------------------------
Enter a command: Thank you for using EventManagerCLI. Goodbye!
------------------------
diff --git a/text-ui-test/input.txt b/text-ui-test/input.txt
index f6aab5a964..2ad37a2780 100644
--- a/text-ui-test/input.txt
+++ b/text-ui-test/input.txt
@@ -1,3 +1,4 @@
hello world
menu
+list
exit
From dbe064864a3d0cd5edf7fda82258443ce522e57c Mon Sep 17 00:00:00 2001
From: KuanHsienn
Date: Thu, 10 Oct 2024 23:29:18 +0800
Subject: [PATCH 072/619] Add AddCommand to add events to event list
---
.../seedu/manager/command/AddCommand.java | 19 ++++++++++++++-----
src/main/java/seedu/manager/event/Event.java | 10 +++++-----
.../java/seedu/manager/event/EventList.java | 8 ++++++++
3 files changed, 27 insertions(+), 10 deletions(-)
diff --git a/src/main/java/seedu/manager/command/AddCommand.java b/src/main/java/seedu/manager/command/AddCommand.java
index f1c1cc5f56..0dd8f01053 100644
--- a/src/main/java/seedu/manager/command/AddCommand.java
+++ b/src/main/java/seedu/manager/command/AddCommand.java
@@ -1,20 +1,29 @@
package seedu.manager.command;
+import seedu.manager.event.EventList;
+
/**
* Represents an executable add command
*/
public class AddCommand extends Command {
public static final String COMMAND_WORD = "add";
- private static final String ADD_MESSAGE = "The following event has been added to the event list: %1$s";
+ public static final String ADD_MESSAGE = "Event added successfully";
+ protected String eventName;
+ protected EventList events;
+
+ public AddCommand(String desc, EventList events) {
+ this.eventName = desc;
+ this.events = events;
+ }
/**
- * Implement the adding command
- * Returns a command output with a successful adding message
+ * Returns a command output with an add message
*
- * @return The command output with a successful adding message
+ * @return The command output with an add message
*/
- @Override
public CommandOutput execute() {
+ this.events.addEvent(this.eventName);
+ this.events.getList();
return new CommandOutput(ADD_MESSAGE, false);
}
}
diff --git a/src/main/java/seedu/manager/event/Event.java b/src/main/java/seedu/manager/event/Event.java
index 7d123d6fb9..3a810b7f93 100644
--- a/src/main/java/seedu/manager/event/Event.java
+++ b/src/main/java/seedu/manager/event/Event.java
@@ -13,13 +13,13 @@ public class Event {
* Constructs an Event with the specified name, time, and venue.
*
* @param eventName the name of the event
- * @param eventTime the time duration of the event
- * @param eventVenue the venue of the event
+ * param eventTime the time duration of the event
+ * param eventVenue the venue of the event
*/
- public Event(String eventName, String eventTime, String eventVenue) {
+ public Event(String eventName) {
this.eventName = eventName;
- this.eventTime = eventTime;
- this.eventVenue = eventVenue;
+ //this.eventTime = eventTime;
+ //this.eventVenue = eventVenue;
}
/**
diff --git a/src/main/java/seedu/manager/event/EventList.java b/src/main/java/seedu/manager/event/EventList.java
index 3f265abed6..367c80851f 100644
--- a/src/main/java/seedu/manager/event/EventList.java
+++ b/src/main/java/seedu/manager/event/EventList.java
@@ -30,6 +30,9 @@ public EventList(){
* @return The list of events.
*/
public ArrayList getList() {
+ for (Event event : eventList) {
+ System.out.println(event);
+ }
return eventList;
}
@@ -39,4 +42,9 @@ public ArrayList getList() {
public int getListSize() {
return eventList.size();
}
+
+ public void addEvent(String eventName) {
+ Event newEvent = new Event(eventName);
+ eventList.add(newEvent);
+ }
}
From 8074bfaef94949bf39e291cb840f5ea4e97a433c Mon Sep 17 00:00:00 2001
From: KuanHsienn
Date: Thu, 10 Oct 2024 23:32:02 +0800
Subject: [PATCH 073/619] Update parseCommand to accept event list as a
parameter
---
src/main/java/seedu/manager/Main.java | 6 +++---
1 file changed, 3 insertions(+), 3 deletions(-)
diff --git a/src/main/java/seedu/manager/Main.java b/src/main/java/seedu/manager/Main.java
index 1cabfb86fe..55a8a7eeed 100644
--- a/src/main/java/seedu/manager/Main.java
+++ b/src/main/java/seedu/manager/Main.java
@@ -8,7 +8,7 @@
public class Main {
private static final Ui ui = new Ui();
- private static final EventList events = new EventList();
+ private static EventList events = new EventList();
/**
* Main entry-point for the EventManagerCLI application.
@@ -29,8 +29,8 @@ private static void runCommandLoop() {
boolean isGettingCommands = true;
while (isGettingCommands){
String userCommandText = ui.getCommand();
- command = new Parser().parseCommand(userCommandText);
- command.setData(events);
+ command = new Parser().parseCommand(userCommandText, events);
+ //command.setData(events);
CommandOutput output = command.execute();
ui.showOutputToUser(output);
From 410a98efc34f74386646074655b3fd9e5cc079ae Mon Sep 17 00:00:00 2001
From: KuanHsienn
Date: Thu, 10 Oct 2024 23:37:11 +0800
Subject: [PATCH 074/619] Update parser to handle add command with only event
name as description
---
src/main/java/seedu/manager/command/ListCommand.java | 1 +
src/main/java/seedu/manager/parser/Parser.java | 11 ++++++++---
src/test/java/seedu/manager/parser/ParserTest.java | 8 +++++---
3 files changed, 14 insertions(+), 6 deletions(-)
diff --git a/src/main/java/seedu/manager/command/ListCommand.java b/src/main/java/seedu/manager/command/ListCommand.java
index 003900001f..a8ac67d837 100644
--- a/src/main/java/seedu/manager/command/ListCommand.java
+++ b/src/main/java/seedu/manager/command/ListCommand.java
@@ -1,5 +1,6 @@
package seedu.manager.command;
+
public class ListCommand extends Command {
public static final String COMMAND_WORD = "list";
private static final String LIST_MESSAGE = "Here are your scheduled events:";
diff --git a/src/main/java/seedu/manager/parser/Parser.java b/src/main/java/seedu/manager/parser/Parser.java
index 2d5361c854..78dca6ad90 100644
--- a/src/main/java/seedu/manager/parser/Parser.java
+++ b/src/main/java/seedu/manager/parser/Parser.java
@@ -6,6 +6,9 @@
import seedu.manager.command.MenuCommand;
import seedu.manager.command.EchoCommand;
import seedu.manager.command.ListCommand;
+import seedu.manager.event.EventList;
+
+import java.util.Arrays;
/**
@@ -17,14 +20,16 @@ public class Parser {
* Returns a command based on the given user command string
*
* @param command The given command string from the user
+ * @param events Event list of existing events
*/
- public Command parseCommand(String command){
- String[] commandParts = command.split(" ", 2);
+ public Command parseCommand(String command, EventList events){
+ String[] commandParts = command.split(" ");
String commandWord = commandParts[0];
+ String description = String.join(" ", Arrays.copyOfRange(commandParts, 1, commandParts.length)).trim();
switch (commandWord) {
case AddCommand.COMMAND_WORD:
- return new AddCommand();
+ return new AddCommand(description, events);
case ListCommand.COMMAND_WORD:
return new ListCommand();
case ExitCommand.COMMAND_WORD:
diff --git a/src/test/java/seedu/manager/parser/ParserTest.java b/src/test/java/seedu/manager/parser/ParserTest.java
index d8a4f5a7bc..e0d933aa1b 100644
--- a/src/test/java/seedu/manager/parser/ParserTest.java
+++ b/src/test/java/seedu/manager/parser/ParserTest.java
@@ -5,6 +5,8 @@
import org.junit.jupiter.api.Test;
import seedu.manager.command.ExitCommand;
import seedu.manager.command.MenuCommand;
+import seedu.manager.event.EventList;
+
import static org.junit.jupiter.api.Assertions.assertInstanceOf;
@@ -13,7 +15,7 @@ class ParserTest {
@Test
public void parseCommand_nonEmptyString_echo() {
Parser parser = new Parser();
- Command command = parser.parseCommand("Hello world!");
+ Command command = parser.parseCommand("Hello world!", new EventList());
assertInstanceOf(EchoCommand.class, command);
}
@@ -21,7 +23,7 @@ public void parseCommand_nonEmptyString_echo() {
@Test
public void parseCommand_exitWord_exit() {
Parser parser = new Parser();
- Command command = parser.parseCommand("exit");
+ Command command = parser.parseCommand("exit" , new EventList());
assertInstanceOf(ExitCommand.class, command);
}
@@ -29,7 +31,7 @@ public void parseCommand_exitWord_exit() {
@Test
public void parseCommand_menuWord_menu() {
Parser parser = new Parser();
- Command command = parser.parseCommand("menu");
+ Command command = parser.parseCommand("menu" , new EventList());
assertInstanceOf(MenuCommand.class, command);
}
From b8d19c419c54a3360caaa5f152faa105072b78d4 Mon Sep 17 00:00:00 2001
From: KuanHsienn
Date: Thu, 10 Oct 2024 23:56:52 +0800
Subject: [PATCH 075/619] Add RemoveCommand to remove events from event list
---
.../seedu/manager/command/RemoveCommand.java | 26 +++++++++++++++++++
.../java/seedu/manager/event/EventList.java | 12 ++++++++-
2 files changed, 37 insertions(+), 1 deletion(-)
create mode 100644 src/main/java/seedu/manager/command/RemoveCommand.java
diff --git a/src/main/java/seedu/manager/command/RemoveCommand.java b/src/main/java/seedu/manager/command/RemoveCommand.java
new file mode 100644
index 0000000000..8462885458
--- /dev/null
+++ b/src/main/java/seedu/manager/command/RemoveCommand.java
@@ -0,0 +1,26 @@
+package seedu.manager.command;
+
+import seedu.manager.event.EventList;
+
+public class RemoveCommand extends Command {
+ public static final String COMMAND_WORD = "remove";
+ public static final String REMOVE_SUCCESS = "Event removed successfully";
+ public static final String REMOVE_FAILURE = "Event not found";
+ protected String eventName;
+ protected EventList events;
+
+ public RemoveCommand(String desc, EventList events) {
+ this.eventName = desc;
+ this.events = events;
+ }
+
+ public CommandOutput execute() {
+ boolean isRemoved = events.removeEvent(eventName);
+ this.events.getList();
+ if (isRemoved) {
+ return new CommandOutput(REMOVE_SUCCESS, false);
+ } else {
+ return new CommandOutput(REMOVE_FAILURE, false);
+ }
+ }
+}
diff --git a/src/main/java/seedu/manager/event/EventList.java b/src/main/java/seedu/manager/event/EventList.java
index 367c80851f..41eb910c65 100644
--- a/src/main/java/seedu/manager/event/EventList.java
+++ b/src/main/java/seedu/manager/event/EventList.java
@@ -31,7 +31,7 @@ public EventList(){
*/
public ArrayList getList() {
for (Event event : eventList) {
- System.out.println(event);
+ System.out.println(event.getEventName());
}
return eventList;
}
@@ -47,4 +47,14 @@ public void addEvent(String eventName) {
Event newEvent = new Event(eventName);
eventList.add(newEvent);
}
+
+ public boolean removeEvent(String eventName) {
+ for (Event event : eventList) {
+ if (event.getEventName().equals(eventName)) { // Assuming Event has a getName() method
+ eventList.remove(event);
+ return true; // Event found and removed
+ }
+ }
+ return false; // Event not found
+ }
}
From 3947a3c7b3dc690c8dc2bf6e33f8870d3d04182d Mon Sep 17 00:00:00 2001
From: KuanHsienn
Date: Thu, 10 Oct 2024 23:57:36 +0800
Subject: [PATCH 076/619] Update parser to handle remove command with only
event name as description
---
src/main/java/seedu/manager/parser/Parser.java | 3 +++
1 file changed, 3 insertions(+)
diff --git a/src/main/java/seedu/manager/parser/Parser.java b/src/main/java/seedu/manager/parser/Parser.java
index 78dca6ad90..00e8329ea7 100644
--- a/src/main/java/seedu/manager/parser/Parser.java
+++ b/src/main/java/seedu/manager/parser/Parser.java
@@ -2,6 +2,7 @@
import seedu.manager.command.Command;
import seedu.manager.command.AddCommand;
+import seedu.manager.command.RemoveCommand;
import seedu.manager.command.ExitCommand;
import seedu.manager.command.MenuCommand;
import seedu.manager.command.EchoCommand;
@@ -30,6 +31,8 @@ public Command parseCommand(String command, EventList events){
switch (commandWord) {
case AddCommand.COMMAND_WORD:
return new AddCommand(description, events);
+ case RemoveCommand.COMMAND_WORD:
+ return new RemoveCommand(description, events);
case ListCommand.COMMAND_WORD:
return new ListCommand();
case ExitCommand.COMMAND_WORD:
From 3e45f315858c2ed3b391db68225292289098bc11 Mon Sep 17 00:00:00 2001
From: KuanHsienn
Date: Fri, 11 Oct 2024 00:33:27 +0800
Subject: [PATCH 077/619] Add JavaDoc Comments
---
.../java/seedu/manager/command/AddCommand.java | 13 ++++++++++---
.../seedu/manager/command/RemoveCommand.java | 16 ++++++++++++++++
src/main/java/seedu/manager/event/EventList.java | 13 ++++++++++++-
3 files changed, 38 insertions(+), 4 deletions(-)
diff --git a/src/main/java/seedu/manager/command/AddCommand.java b/src/main/java/seedu/manager/command/AddCommand.java
index 0dd8f01053..0156411aa4 100644
--- a/src/main/java/seedu/manager/command/AddCommand.java
+++ b/src/main/java/seedu/manager/command/AddCommand.java
@@ -3,7 +3,7 @@
import seedu.manager.event.EventList;
/**
- * Represents an executable add command
+ * Represents an executable add command that adds an event to the EventList.
*/
public class AddCommand extends Command {
public static final String COMMAND_WORD = "add";
@@ -11,15 +11,22 @@ public class AddCommand extends Command {
protected String eventName;
protected EventList events;
+ /**
+ * Constructs an AddCommand with the specified event name and EventList.
+ *
+ * @param desc The name of the event to be added.
+ * @param events The EventList to which the event will be added.
+ */
public AddCommand(String desc, EventList events) {
this.eventName = desc;
this.events = events;
}
/**
- * Returns a command output with an add message
+ * Executes the add command to add the specified event to the EventList.
*
- * @return The command output with an add message
+ * @return A CommandOutput object containing the result of the add operation.
+ * The output includes a success message indicating the event was added.
*/
public CommandOutput execute() {
this.events.addEvent(this.eventName);
diff --git a/src/main/java/seedu/manager/command/RemoveCommand.java b/src/main/java/seedu/manager/command/RemoveCommand.java
index 8462885458..831fca5fd3 100644
--- a/src/main/java/seedu/manager/command/RemoveCommand.java
+++ b/src/main/java/seedu/manager/command/RemoveCommand.java
@@ -2,6 +2,9 @@
import seedu.manager.event.EventList;
+/**
+ * Represents a command to remove an event from the EventList.
+ */
public class RemoveCommand extends Command {
public static final String COMMAND_WORD = "remove";
public static final String REMOVE_SUCCESS = "Event removed successfully";
@@ -9,11 +12,24 @@ public class RemoveCommand extends Command {
protected String eventName;
protected EventList events;
+ /**
+ * Constructs a RemoveCommand with the specified event name and EventList.
+ *
+ * @param desc The name of the event to be removed.
+ * @param events The EventList from which the event will be removed.
+ */
public RemoveCommand(String desc, EventList events) {
this.eventName = desc;
this.events = events;
}
+ /**
+ * Executes the removal of the specified event from the EventList.
+ *
+ * @return A CommandOutput object containing the result of the removal operation.
+ * If the event is successfully removed, the output will contain a success message;
+ * otherwise, it will contain a failure message.
+ */
public CommandOutput execute() {
boolean isRemoved = events.removeEvent(eventName);
this.events.getList();
diff --git a/src/main/java/seedu/manager/event/EventList.java b/src/main/java/seedu/manager/event/EventList.java
index 41eb910c65..88f70b72b5 100644
--- a/src/main/java/seedu/manager/event/EventList.java
+++ b/src/main/java/seedu/manager/event/EventList.java
@@ -43,14 +43,25 @@ public int getListSize() {
return eventList.size();
}
+ /**
+ * Adds a new event to the event list.
+ *
+ * @param eventName The name of the event to be added.
+ */
public void addEvent(String eventName) {
Event newEvent = new Event(eventName);
eventList.add(newEvent);
}
+ /**
+ * Removes an event from the event list by its name.
+ *
+ * @param eventName The name of the event to be removed.
+ * @return true if the event was found and removed; false otherwise.
+ */
public boolean removeEvent(String eventName) {
for (Event event : eventList) {
- if (event.getEventName().equals(eventName)) { // Assuming Event has a getName() method
+ if (event.getEventName().equals(eventName)) {
eventList.remove(event);
return true; // Event found and removed
}
From ccb3decfe97a002e40d4c72483ae9d63b124b450 Mon Sep 17 00:00:00 2001
From: KuanHsienn
Date: Fri, 11 Oct 2024 00:42:49 +0800
Subject: [PATCH 078/619] Fix JavaDoc Comments Indentation
---
src/main/java/seedu/manager/event/Event.java | 14 +++++++-------
1 file changed, 7 insertions(+), 7 deletions(-)
diff --git a/src/main/java/seedu/manager/event/Event.java b/src/main/java/seedu/manager/event/Event.java
index 3a810b7f93..49b2170352 100644
--- a/src/main/java/seedu/manager/event/Event.java
+++ b/src/main/java/seedu/manager/event/Event.java
@@ -10,16 +10,12 @@ public class Event {
private String eventVenue;
/**
- * Constructs an Event with the specified name, time, and venue.
+ * Constructs an Event with the specified name.
*
- * @param eventName the name of the event
- * param eventTime the time duration of the event
- * param eventVenue the venue of the event
+ * @param eventName the name of the event
*/
public Event(String eventName) {
this.eventName = eventName;
- //this.eventTime = eventTime;
- //this.eventVenue = eventVenue;
}
/**
@@ -28,18 +24,21 @@ public Event(String eventName) {
public String getEventName() {
return eventName;
}
+
/**
* @return the event time
*/
public String getEventTime() {
return eventTime;
}
+
/**
* @return the event venue
*/
public String getEventVenue() {
return eventVenue;
}
+
/**
* Sets a new time for the event.
*
@@ -48,10 +47,11 @@ public String getEventVenue() {
public void setEventTime(String eventTime) {
this.eventTime = eventTime;
}
+
/**
* Sets a new venue for the event.
*
- * @param eventVenue the new event time
+ * @param eventVenue the new event venue
*/
public void setEventVenue(String eventVenue) {
this.eventVenue = eventVenue;
From 20c235688a0f3f8fe33851b0e5fe7125d6679c55 Mon Sep 17 00:00:00 2001
From: KuanHsienn
Date: Fri, 11 Oct 2024 00:47:00 +0800
Subject: [PATCH 079/619] Fixed JavaDoc Comments Indentation
---
src/main/java/seedu/manager/event/Event.java | 14 +++++++-------
1 file changed, 7 insertions(+), 7 deletions(-)
diff --git a/src/main/java/seedu/manager/event/Event.java b/src/main/java/seedu/manager/event/Event.java
index 3a810b7f93..49b2170352 100644
--- a/src/main/java/seedu/manager/event/Event.java
+++ b/src/main/java/seedu/manager/event/Event.java
@@ -10,16 +10,12 @@ public class Event {
private String eventVenue;
/**
- * Constructs an Event with the specified name, time, and venue.
+ * Constructs an Event with the specified name.
*
- * @param eventName the name of the event
- * param eventTime the time duration of the event
- * param eventVenue the venue of the event
+ * @param eventName the name of the event
*/
public Event(String eventName) {
this.eventName = eventName;
- //this.eventTime = eventTime;
- //this.eventVenue = eventVenue;
}
/**
@@ -28,18 +24,21 @@ public Event(String eventName) {
public String getEventName() {
return eventName;
}
+
/**
* @return the event time
*/
public String getEventTime() {
return eventTime;
}
+
/**
* @return the event venue
*/
public String getEventVenue() {
return eventVenue;
}
+
/**
* Sets a new time for the event.
*
@@ -48,10 +47,11 @@ public String getEventVenue() {
public void setEventTime(String eventTime) {
this.eventTime = eventTime;
}
+
/**
* Sets a new venue for the event.
*
- * @param eventVenue the new event time
+ * @param eventVenue the new event venue
*/
public void setEventVenue(String eventVenue) {
this.eventVenue = eventVenue;
From 5a805b6e237f88900001585353c24f77769aaf82 Mon Sep 17 00:00:00 2001
From: KuanHsienn
Date: Fri, 11 Oct 2024 01:22:19 +0800
Subject: [PATCH 080/619] Fixed JavaDoc Comments Indentation
---
src/main/java/seedu/manager/event/Event.java | 4 ----
1 file changed, 4 deletions(-)
diff --git a/src/main/java/seedu/manager/event/Event.java b/src/main/java/seedu/manager/event/Event.java
index 3a810b7f93..e4ef5b8a85 100644
--- a/src/main/java/seedu/manager/event/Event.java
+++ b/src/main/java/seedu/manager/event/Event.java
@@ -13,13 +13,9 @@ public class Event {
* Constructs an Event with the specified name, time, and venue.
*
* @param eventName the name of the event
- * param eventTime the time duration of the event
- * param eventVenue the venue of the event
*/
public Event(String eventName) {
this.eventName = eventName;
- //this.eventTime = eventTime;
- //this.eventVenue = eventVenue;
}
/**
From dfba7e01fa1ee8141980184c0ee4e9000b67cfdb Mon Sep 17 00:00:00 2001
From: fuyixuan
Date: Fri, 11 Oct 2024 01:41:30 +0800
Subject: [PATCH 081/619] Modify the string format
---
src/main/java/seedu/manager/command/ListCommand.java | 5 +++--
1 file changed, 3 insertions(+), 2 deletions(-)
diff --git a/src/main/java/seedu/manager/command/ListCommand.java b/src/main/java/seedu/manager/command/ListCommand.java
index 0f05ccf231..0eeecc5e61 100644
--- a/src/main/java/seedu/manager/command/ListCommand.java
+++ b/src/main/java/seedu/manager/command/ListCommand.java
@@ -2,7 +2,8 @@
public class ListCommand extends Command {
public static final String COMMAND_WORD = "list";
- private static final String LIST_MESSAGE = "There are %1$d events in your list! Here are your scheduled events:";
+ private static final String LIST_MESSAGE = "There are %1$d events in your list! " +
+ "Here are your scheduled events:";
/**
* Returns a command output with a list message
@@ -12,7 +13,7 @@ public class ListCommand extends Command {
public CommandOutput execute() {
StringBuilder outputMessage = new StringBuilder(String.format(LIST_MESSAGE, eventList.getListSize()) + "\n");
for (int i = 0; i < eventList.getListSize(); i++) {
- outputMessage.append(i + 1).append(". ").append(eventList.getEvent(i).toString()).append("\n");
+ outputMessage.append(String.format("%d. %s\n", i + 1, eventList.getEvent(i).toString()));
}
return new CommandOutput(outputMessage.toString(), false);
From f8e3cab30a2871a5767b8370556e4a57a490934e Mon Sep 17 00:00:00 2001
From: fuyixuan
Date: Fri, 11 Oct 2024 01:56:33 +0800
Subject: [PATCH 082/619] Add JUnit code for ListCommand
---
.../java/seedu/manager/event/EventList.java | 4 ++
.../manager/command/ListCommandTest.java | 37 +++++++++++++++++++
2 files changed, 41 insertions(+)
create mode 100644 src/test/java/seedu/manager/command/ListCommandTest.java
diff --git a/src/main/java/seedu/manager/event/EventList.java b/src/main/java/seedu/manager/event/EventList.java
index 3f55a97a18..032c1f6811 100644
--- a/src/main/java/seedu/manager/event/EventList.java
+++ b/src/main/java/seedu/manager/event/EventList.java
@@ -47,4 +47,8 @@ public int getListSize() {
public Event getEvent(int index) {
return eventList.get(index);
}
+
+ public void addEvent(Event event) {
+ eventList.add(event);
+ }
}
diff --git a/src/test/java/seedu/manager/command/ListCommandTest.java b/src/test/java/seedu/manager/command/ListCommandTest.java
new file mode 100644
index 0000000000..b24cd03d02
--- /dev/null
+++ b/src/test/java/seedu/manager/command/ListCommandTest.java
@@ -0,0 +1,37 @@
+package seedu.manager.command;
+
+import org.junit.jupiter.api.BeforeEach;
+import org.junit.jupiter.api.Test;
+import seedu.manager.event.Event;
+import seedu.manager.event.EventList;
+
+import static org.junit.jupiter.api.Assertions.assertEquals;
+import static org.junit.jupiter.api.Assertions.assertFalse;
+
+public class ListCommandTest {
+
+ private ListCommand listCommand;
+
+ @BeforeEach
+ public void setUp() {
+ EventList eventList = new EventList();
+
+ eventList.addEvent(new Event("Event 1", "2024-10-10 10:00", "Venue A"));
+ eventList.addEvent(new Event("Event 2", "2024-11-11 12:00", "Venue B"));
+
+ listCommand = new ListCommand();
+ listCommand.setData(eventList);
+ }
+
+ @Test
+ public void testExecute() {
+ CommandOutput result = listCommand.execute();
+
+ String expectedMessage = "There are 2 events in your list! Here are your scheduled events:\n"
+ + "1. Event name: Event 1/ Event time: 2024-10-10 10:00/ Event venue: Venue A\n"
+ + "2. Event name: Event 2/ Event time: 2024-11-11 12:00/ Event venue: Venue B\n";
+
+ assertEquals(expectedMessage, result.getMessage());
+ assertFalse(result.getCanExit());
+ }
+}
From ed50a4b098bb6015dd9e70b3b389d44c619ecd27 Mon Sep 17 00:00:00 2001
From: fuyixuan
Date: Fri, 11 Oct 2024 09:53:21 +0800
Subject: [PATCH 083/619] modify the function name
---
src/test/java/seedu/manager/command/ListCommandTest.java | 2 +-
1 file changed, 1 insertion(+), 1 deletion(-)
diff --git a/src/test/java/seedu/manager/command/ListCommandTest.java b/src/test/java/seedu/manager/command/ListCommandTest.java
index b24cd03d02..330b83c898 100644
--- a/src/test/java/seedu/manager/command/ListCommandTest.java
+++ b/src/test/java/seedu/manager/command/ListCommandTest.java
@@ -24,7 +24,7 @@ public void setUp() {
}
@Test
- public void testExecute() {
+ public void execute_twoEvents_success() {
CommandOutput result = listCommand.execute();
String expectedMessage = "There are 2 events in your list! Here are your scheduled events:\n"
From 3d56f0e218e0ef770d880cd22837c5a63c245d85 Mon Sep 17 00:00:00 2001
From: Tze Kang <141611843+LTK-1606@users.noreply.github.com>
Date: Fri, 11 Oct 2024 15:10:37 +0800
Subject: [PATCH 084/619] Remove getEvent method
---
src/main/java/seedu/manager/event/EventList.java | 8 --------
1 file changed, 8 deletions(-)
diff --git a/src/main/java/seedu/manager/event/EventList.java b/src/main/java/seedu/manager/event/EventList.java
index 85473a1747..b52b3eb674 100644
--- a/src/main/java/seedu/manager/event/EventList.java
+++ b/src/main/java/seedu/manager/event/EventList.java
@@ -46,13 +46,5 @@ public int getListSize() {
public void addEvent(String eventName) {
Event newEvent = new Event(eventName);
eventList.add(newEvent);
-
- /**
- * @param index The index of event in the list (0 based indexing)
- * @return The specific event in the event list.
- */
- public Event getEvent(int index) {
- return eventList.get(index);
- }
}
From effe9e1c98db11fad713c3a3ac5ab46f0b141443 Mon Sep 17 00:00:00 2001
From: Tze Kang <141611843+LTK-1606@users.noreply.github.com>
Date: Fri, 11 Oct 2024 15:15:10 +0800
Subject: [PATCH 085/619] Added missing }
---
src/main/java/seedu/manager/event/EventList.java | 8 ++++++++
1 file changed, 8 insertions(+)
diff --git a/src/main/java/seedu/manager/event/EventList.java b/src/main/java/seedu/manager/event/EventList.java
index b52b3eb674..f7569e2d49 100644
--- a/src/main/java/seedu/manager/event/EventList.java
+++ b/src/main/java/seedu/manager/event/EventList.java
@@ -46,5 +46,13 @@ public int getListSize() {
public void addEvent(String eventName) {
Event newEvent = new Event(eventName);
eventList.add(newEvent);
+ }
+ /**
+ * @param index The index of event in the list (0 based indexing)
+ * @return The specific event in the event list.
+ */
+ public Event getEvent(int index) {
+ return eventList.get(index);
+ }
}
From baba9b21628ec425cf452587843fd8081d6fe6cc Mon Sep 17 00:00:00 2001
From: Tze Kang <141611843+LTK-1606@users.noreply.github.com>
Date: Fri, 11 Oct 2024 15:28:37 +0800
Subject: [PATCH 086/619] Add Javadoc comments
---
src/main/java/seedu/manager/event/EventList.java | 9 +++++++++
1 file changed, 9 insertions(+)
diff --git a/src/main/java/seedu/manager/event/EventList.java b/src/main/java/seedu/manager/event/EventList.java
index f7569e2d49..56eea10a0a 100644
--- a/src/main/java/seedu/manager/event/EventList.java
+++ b/src/main/java/seedu/manager/event/EventList.java
@@ -43,10 +43,19 @@ public int getListSize() {
return eventList.size();
}
+ /**
+ * Adds a new event to the event list.
+ *
+ * This method creates a new instance of the {@link Event} class with the specified
+ * event name and adds it to the {@code eventList}.
+ *
+ * @param eventName the name of the event to be added
+ */
public void addEvent(String eventName) {
Event newEvent = new Event(eventName);
eventList.add(newEvent);
}
+
/**
* @param index The index of event in the list (0 based indexing)
* @return The specific event in the event list.
From 4921b4cb4cd2fa64ff3b9865fa4bae592ebf8f6e Mon Sep 17 00:00:00 2001
From: Tze Kang <141611843+LTK-1606@users.noreply.github.com>
Date: Fri, 11 Oct 2024 15:33:06 +0800
Subject: [PATCH 087/619] Deconflict constructors
---
src/main/java/seedu/manager/event/Event.java | 13 +++++++++++++
1 file changed, 13 insertions(+)
diff --git a/src/main/java/seedu/manager/event/Event.java b/src/main/java/seedu/manager/event/Event.java
index cb51782e3f..b44dff3a37 100644
--- a/src/main/java/seedu/manager/event/Event.java
+++ b/src/main/java/seedu/manager/event/Event.java
@@ -18,6 +18,19 @@ public Event(String eventName) {
this.eventName = eventName;
}
+ /**
+ * Constructs an Event with the specified name, time, and venue.
+ *
+ * @param eventName the name of the event
+ * @param eventTime the time duration of the event
+ * @param eventVenue the venue of the event
+ */
+ public Event(String eventName, String eventTime, String eventVenue) {
+ this.eventName = eventName;
+ this.eventTime = eventTime;
+ this.eventVenue = eventVenue;
+ }
+
/**
* @return the event name
*/
From 5d0df0b9b99bd331f2c7cfcc6c61def4c2cb0a91 Mon Sep 17 00:00:00 2001
From: Tze Kang <141611843+LTK-1606@users.noreply.github.com>
Date: Fri, 11 Oct 2024 15:34:13 +0800
Subject: [PATCH 088/619] Update test for 'list' command
---
src/test/java/seedu/manager/parser/ParserTest.java | 2 +-
1 file changed, 1 insertion(+), 1 deletion(-)
diff --git a/src/test/java/seedu/manager/parser/ParserTest.java b/src/test/java/seedu/manager/parser/ParserTest.java
index a050e1d2cc..9a97c83949 100644
--- a/src/test/java/seedu/manager/parser/ParserTest.java
+++ b/src/test/java/seedu/manager/parser/ParserTest.java
@@ -39,7 +39,7 @@ public void parseCommand_menuWord_menu() {
@Test
public void parseCommand_listWord_list() {
Parser parser = new Parser();
- Command command = parser.parseCommand("list");
+ Command command = parser.parseCommand("list", new EventList());
assertInstanceOf(ListCommand.class, command);
}
From 1d03de467c84c56143ff845392758d7ef333a78f Mon Sep 17 00:00:00 2001
From: Tze Kang <141611843+LTK-1606@users.noreply.github.com>
Date: Fri, 11 Oct 2024 15:38:54 +0800
Subject: [PATCH 089/619] Method overload addEvent
---
src/main/java/seedu/manager/event/EventList.java | 4 ++++
1 file changed, 4 insertions(+)
diff --git a/src/main/java/seedu/manager/event/EventList.java b/src/main/java/seedu/manager/event/EventList.java
index 56eea10a0a..e8d91b2279 100644
--- a/src/main/java/seedu/manager/event/EventList.java
+++ b/src/main/java/seedu/manager/event/EventList.java
@@ -55,6 +55,10 @@ public void addEvent(String eventName) {
Event newEvent = new Event(eventName);
eventList.add(newEvent);
}
+
+ public void addEvent(Event event) {
+ eventList.add(event);
+ }
/**
* @param index The index of event in the list (0 based indexing)
From 3ff96d94a90de0555ba9151d9de6e617cd680807 Mon Sep 17 00:00:00 2001
From: Tze Kang <141611843+LTK-1606@users.noreply.github.com>
Date: Fri, 11 Oct 2024 15:43:42 +0800
Subject: [PATCH 090/619] Fix indentation
---
src/main/java/seedu/manager/event/Event.java | 2 +-
1 file changed, 1 insertion(+), 1 deletion(-)
diff --git a/src/main/java/seedu/manager/event/Event.java b/src/main/java/seedu/manager/event/Event.java
index b44dff3a37..8505fbf734 100644
--- a/src/main/java/seedu/manager/event/Event.java
+++ b/src/main/java/seedu/manager/event/Event.java
@@ -18,7 +18,7 @@ public Event(String eventName) {
this.eventName = eventName;
}
- /**
+ /**
* Constructs an Event with the specified name, time, and venue.
*
* @param eventName the name of the event
From 8fd993ec1e318de47a43a9ccd81b3e0341a2e27b Mon Sep 17 00:00:00 2001
From: KuanHsienn
Date: Fri, 11 Oct 2024 16:08:36 +0800
Subject: [PATCH 091/619] Update parseCommand
---
src/main/java/seedu/manager/Main.java | 4 ++--
src/main/java/seedu/manager/command/AddCommand.java | 10 ++++------
src/main/java/seedu/manager/parser/Parser.java | 5 ++---
3 files changed, 8 insertions(+), 11 deletions(-)
diff --git a/src/main/java/seedu/manager/Main.java b/src/main/java/seedu/manager/Main.java
index 55a8a7eeed..08e432df4e 100644
--- a/src/main/java/seedu/manager/Main.java
+++ b/src/main/java/seedu/manager/Main.java
@@ -29,8 +29,8 @@ private static void runCommandLoop() {
boolean isGettingCommands = true;
while (isGettingCommands){
String userCommandText = ui.getCommand();
- command = new Parser().parseCommand(userCommandText, events);
- //command.setData(events);
+ command = new Parser().parseCommand(userCommandText);
+ command.setData(events);
CommandOutput output = command.execute();
ui.showOutputToUser(output);
diff --git a/src/main/java/seedu/manager/command/AddCommand.java b/src/main/java/seedu/manager/command/AddCommand.java
index 0dd8f01053..877fbb4a09 100644
--- a/src/main/java/seedu/manager/command/AddCommand.java
+++ b/src/main/java/seedu/manager/command/AddCommand.java
@@ -7,13 +7,11 @@
*/
public class AddCommand extends Command {
public static final String COMMAND_WORD = "add";
- public static final String ADD_MESSAGE = "Event added successfully";
+ private static final String ADD_MESSAGE = "Event added successfully";
protected String eventName;
- protected EventList events;
- public AddCommand(String desc, EventList events) {
+ public AddCommand(String desc) {
this.eventName = desc;
- this.events = events;
}
/**
@@ -22,8 +20,8 @@ public AddCommand(String desc, EventList events) {
* @return The command output with an add message
*/
public CommandOutput execute() {
- this.events.addEvent(this.eventName);
- this.events.getList();
+ this.eventList.addEvent(this.eventName);
+ //this.eventList.getList();
return new CommandOutput(ADD_MESSAGE, false);
}
}
diff --git a/src/main/java/seedu/manager/parser/Parser.java b/src/main/java/seedu/manager/parser/Parser.java
index 78dca6ad90..1270fe63d8 100644
--- a/src/main/java/seedu/manager/parser/Parser.java
+++ b/src/main/java/seedu/manager/parser/Parser.java
@@ -20,16 +20,15 @@ public class Parser {
* Returns a command based on the given user command string
*
* @param command The given command string from the user
- * @param events Event list of existing events
*/
- public Command parseCommand(String command, EventList events){
+ public Command parseCommand(String command){
String[] commandParts = command.split(" ");
String commandWord = commandParts[0];
String description = String.join(" ", Arrays.copyOfRange(commandParts, 1, commandParts.length)).trim();
switch (commandWord) {
case AddCommand.COMMAND_WORD:
- return new AddCommand(description, events);
+ return new AddCommand(description);
case ListCommand.COMMAND_WORD:
return new ListCommand();
case ExitCommand.COMMAND_WORD:
From 41a0a2dcb0c080a17027eacd4d26af92c2ef7241 Mon Sep 17 00:00:00 2001
From: KuanHsienn
Date: Fri, 11 Oct 2024 16:10:10 +0800
Subject: [PATCH 092/619] Add JUnit for AddCommand
---
.../java/seedu/manager/parser/ParserTest.java | 16 ++++++++++++----
1 file changed, 12 insertions(+), 4 deletions(-)
diff --git a/src/test/java/seedu/manager/parser/ParserTest.java b/src/test/java/seedu/manager/parser/ParserTest.java
index 9a97c83949..205e746b3d 100644
--- a/src/test/java/seedu/manager/parser/ParserTest.java
+++ b/src/test/java/seedu/manager/parser/ParserTest.java
@@ -15,7 +15,7 @@ class ParserTest {
@Test
public void parseCommand_nonEmptyString_echo() {
Parser parser = new Parser();
- Command command = parser.parseCommand("Hello world!", new EventList());
+ Command command = parser.parseCommand("Hello world!");
assertInstanceOf(EchoCommand.class, command);
}
@@ -23,7 +23,7 @@ public void parseCommand_nonEmptyString_echo() {
@Test
public void parseCommand_exitWord_exit() {
Parser parser = new Parser();
- Command command = parser.parseCommand("exit" , new EventList());
+ Command command = parser.parseCommand("exit");
assertInstanceOf(ExitCommand.class, command);
}
@@ -31,7 +31,7 @@ public void parseCommand_exitWord_exit() {
@Test
public void parseCommand_menuWord_menu() {
Parser parser = new Parser();
- Command command = parser.parseCommand("menu" , new EventList());
+ Command command = parser.parseCommand("menu");
assertInstanceOf(MenuCommand.class, command);
}
@@ -39,7 +39,15 @@ public void parseCommand_menuWord_menu() {
@Test
public void parseCommand_listWord_list() {
Parser parser = new Parser();
- Command command = parser.parseCommand("list", new EventList());
+ Command command = parser.parseCommand("list");
+
+ assertInstanceOf(ListCommand.class, command);
+ }
+
+ @Test
+ public void parseCommand_addWord_add() {
+ Parser parser = new Parser();
+ Command command = parser.parseCommand("add");
assertInstanceOf(ListCommand.class, command);
}
From 7b96adea73f5908f4b5073313d2a13b1601f1833 Mon Sep 17 00:00:00 2001
From: KuanHsienn
Date: Fri, 11 Oct 2024 16:12:46 +0800
Subject: [PATCH 093/619] Remove import statments
---
src/main/java/seedu/manager/command/AddCommand.java | 2 --
src/main/java/seedu/manager/parser/Parser.java | 1 -
src/test/java/seedu/manager/parser/ParserTest.java | 1 -
3 files changed, 4 deletions(-)
diff --git a/src/main/java/seedu/manager/command/AddCommand.java b/src/main/java/seedu/manager/command/AddCommand.java
index 877fbb4a09..08d1e28863 100644
--- a/src/main/java/seedu/manager/command/AddCommand.java
+++ b/src/main/java/seedu/manager/command/AddCommand.java
@@ -1,7 +1,5 @@
package seedu.manager.command;
-import seedu.manager.event.EventList;
-
/**
* Represents an executable add command
*/
diff --git a/src/main/java/seedu/manager/parser/Parser.java b/src/main/java/seedu/manager/parser/Parser.java
index 1270fe63d8..3c5eba48de 100644
--- a/src/main/java/seedu/manager/parser/Parser.java
+++ b/src/main/java/seedu/manager/parser/Parser.java
@@ -6,7 +6,6 @@
import seedu.manager.command.MenuCommand;
import seedu.manager.command.EchoCommand;
import seedu.manager.command.ListCommand;
-import seedu.manager.event.EventList;
import java.util.Arrays;
diff --git a/src/test/java/seedu/manager/parser/ParserTest.java b/src/test/java/seedu/manager/parser/ParserTest.java
index 205e746b3d..5a232db217 100644
--- a/src/test/java/seedu/manager/parser/ParserTest.java
+++ b/src/test/java/seedu/manager/parser/ParserTest.java
@@ -5,7 +5,6 @@
import seedu.manager.command.EchoCommand;
import seedu.manager.command.ExitCommand;
import seedu.manager.command.MenuCommand;
-import seedu.manager.event.EventList;
import seedu.manager.command.ListCommand;
import static org.junit.jupiter.api.Assertions.assertInstanceOf;
From 1402cdea93720c81c93e38653d453fac9d7e6e9a Mon Sep 17 00:00:00 2001
From: KuanHsienn
Date: Fri, 11 Oct 2024 16:15:11 +0800
Subject: [PATCH 094/619] Modify test for AddCommand
---
src/test/java/seedu/manager/parser/ParserTest.java | 3 ++-
1 file changed, 2 insertions(+), 1 deletion(-)
diff --git a/src/test/java/seedu/manager/parser/ParserTest.java b/src/test/java/seedu/manager/parser/ParserTest.java
index 5a232db217..eb86b1b072 100644
--- a/src/test/java/seedu/manager/parser/ParserTest.java
+++ b/src/test/java/seedu/manager/parser/ParserTest.java
@@ -6,6 +6,7 @@
import seedu.manager.command.ExitCommand;
import seedu.manager.command.MenuCommand;
import seedu.manager.command.ListCommand;
+import seedu.manager.command.AddCommand;
import static org.junit.jupiter.api.Assertions.assertInstanceOf;
@@ -48,6 +49,6 @@ public void parseCommand_addWord_add() {
Parser parser = new Parser();
Command command = parser.parseCommand("add");
- assertInstanceOf(ListCommand.class, command);
+ assertInstanceOf(AddCommand.class, command);
}
}
From 28664ba062b83bf8d6c2083e6513928d09bafade Mon Sep 17 00:00:00 2001
From: KuanHsienn
Date: Fri, 11 Oct 2024 17:17:34 +0800
Subject: [PATCH 095/619] Improve parsing for AddCommand
---
.../seedu/manager/command/AddCommand.java | 10 +++--
.../java/seedu/manager/event/EventList.java | 4 +-
.../java/seedu/manager/parser/Parser.java | 37 +++++++++++++++++--
3 files changed, 43 insertions(+), 8 deletions(-)
diff --git a/src/main/java/seedu/manager/command/AddCommand.java b/src/main/java/seedu/manager/command/AddCommand.java
index 08d1e28863..ab87a9b364 100644
--- a/src/main/java/seedu/manager/command/AddCommand.java
+++ b/src/main/java/seedu/manager/command/AddCommand.java
@@ -7,9 +7,13 @@ public class AddCommand extends Command {
public static final String COMMAND_WORD = "add";
private static final String ADD_MESSAGE = "Event added successfully";
protected String eventName;
+ protected String time;
+ protected String venue;
- public AddCommand(String desc) {
- this.eventName = desc;
+ public AddCommand(String eventName, String time, String venue) {
+ this.eventName = eventName;
+ this.time = time;
+ this.venue = venue;
}
/**
@@ -18,7 +22,7 @@ public AddCommand(String desc) {
* @return The command output with an add message
*/
public CommandOutput execute() {
- this.eventList.addEvent(this.eventName);
+ this.eventList.addEvent(this.eventName, this.time, this.venue);
//this.eventList.getList();
return new CommandOutput(ADD_MESSAGE, false);
}
diff --git a/src/main/java/seedu/manager/event/EventList.java b/src/main/java/seedu/manager/event/EventList.java
index 2b4a745e38..e9cfd62a44 100644
--- a/src/main/java/seedu/manager/event/EventList.java
+++ b/src/main/java/seedu/manager/event/EventList.java
@@ -41,8 +41,8 @@ public int getListSize() {
*
* @param eventName the name of the event to be added
*/
- public void addEvent(String eventName) {
- Event newEvent = new Event(eventName);
+ public void addEvent(String eventName, String time, String venue) {
+ Event newEvent = new Event(eventName, time, venue);
eventList.add(newEvent);
}
diff --git a/src/main/java/seedu/manager/parser/Parser.java b/src/main/java/seedu/manager/parser/Parser.java
index 3c5eba48de..8fe25df62f 100644
--- a/src/main/java/seedu/manager/parser/Parser.java
+++ b/src/main/java/seedu/manager/parser/Parser.java
@@ -8,7 +8,8 @@
import seedu.manager.command.ListCommand;
import java.util.Arrays;
-
+import java.util.HashMap;
+import java.util.Map;
/**
* Represents the command parser for EventManagerCLI
@@ -23,11 +24,10 @@ public class Parser {
public Command parseCommand(String command){
String[] commandParts = command.split(" ");
String commandWord = commandParts[0];
- String description = String.join(" ", Arrays.copyOfRange(commandParts, 1, commandParts.length)).trim();
switch (commandWord) {
case AddCommand.COMMAND_WORD:
- return new AddCommand(description);
+ return parseAddCommand(commandParts);
case ListCommand.COMMAND_WORD:
return new ListCommand();
case ExitCommand.COMMAND_WORD:
@@ -39,4 +39,35 @@ public Command parseCommand(String command){
return new EchoCommand(command);
}
}
+
+ /**
+ * Parses the 'add' command and its arguments.
+ *
+ * @param commandParts The split command input from the user.
+ * @return The AddCommand object with parsed event details.
+ */
+ public Command parseAddCommand(String[] commandParts) {
+ // Map to store the option-value pairs
+ Map parameters = new HashMap<>();
+ String currentOption = null;
+
+ // Parse the options and their values
+ for (int i = 1; i < commandParts.length; i++) {
+ String part = commandParts[i];
+ if (part.startsWith("-")) {
+ currentOption = part; // Current part is an option (e.g., -e, -time, -venue)
+ } else if (currentOption != null) {
+ parameters.put(currentOption, part); // Store the value for the current option
+ currentOption = null; // Reset after assigning value
+ }
+ }
+
+ // Extract event details from the parsed parameters
+ String eventName = parameters.get("-e");
+ String time = parameters.get("-time");
+ String venue = parameters.get("-venue");
+
+ // Create and return the AddCommand with parsed parameters
+ return new AddCommand(eventName, time, venue);
+ }
}
From 174975396669aa185522820c64918d56411df580 Mon Sep 17 00:00:00 2001
From: KuanHsienn
Date: Fri, 11 Oct 2024 17:18:56 +0800
Subject: [PATCH 096/619] Add JUnit test for RemoveCommand
---
src/test/java/seedu/manager/parser/ParserTest.java | 9 +++++++++
1 file changed, 9 insertions(+)
diff --git a/src/test/java/seedu/manager/parser/ParserTest.java b/src/test/java/seedu/manager/parser/ParserTest.java
index eb86b1b072..257e186e53 100644
--- a/src/test/java/seedu/manager/parser/ParserTest.java
+++ b/src/test/java/seedu/manager/parser/ParserTest.java
@@ -7,6 +7,7 @@
import seedu.manager.command.MenuCommand;
import seedu.manager.command.ListCommand;
import seedu.manager.command.AddCommand;
+import seedu.manager.command.RemoveCommand;
import static org.junit.jupiter.api.Assertions.assertInstanceOf;
@@ -51,4 +52,12 @@ public void parseCommand_addWord_add() {
assertInstanceOf(AddCommand.class, command);
}
+
+ @Test
+ public void parseCommand_removeWord_add() {
+ Parser parser = new Parser();
+ Command command = parser.parseCommand("remove");
+
+ assertInstanceOf(RemoveCommand.class, command);
+ }
}
From d9e2f36dbaf7abf6ce2f4be6f0f15cb04b27356a Mon Sep 17 00:00:00 2001
From: KuanHsienn
Date: Fri, 11 Oct 2024 17:28:24 +0800
Subject: [PATCH 097/619] Improve parsing for RemoveCommand
---
.../seedu/manager/command/RemoveCommand.java | 10 +++----
.../java/seedu/manager/parser/Parser.java | 29 +++++++++++++++++++
2 files changed, 33 insertions(+), 6 deletions(-)
diff --git a/src/main/java/seedu/manager/command/RemoveCommand.java b/src/main/java/seedu/manager/command/RemoveCommand.java
index 8462885458..d1b25de306 100644
--- a/src/main/java/seedu/manager/command/RemoveCommand.java
+++ b/src/main/java/seedu/manager/command/RemoveCommand.java
@@ -7,16 +7,14 @@ public class RemoveCommand extends Command {
public static final String REMOVE_SUCCESS = "Event removed successfully";
public static final String REMOVE_FAILURE = "Event not found";
protected String eventName;
- protected EventList events;
- public RemoveCommand(String desc, EventList events) {
- this.eventName = desc;
- this.events = events;
+
+ public RemoveCommand(String eventName) {
+ this.eventName = eventName;
}
public CommandOutput execute() {
- boolean isRemoved = events.removeEvent(eventName);
- this.events.getList();
+ boolean isRemoved = this.eventList.removeEvent(eventName);
if (isRemoved) {
return new CommandOutput(REMOVE_SUCCESS, false);
} else {
diff --git a/src/main/java/seedu/manager/parser/Parser.java b/src/main/java/seedu/manager/parser/Parser.java
index 8fe25df62f..3b3f4d5701 100644
--- a/src/main/java/seedu/manager/parser/Parser.java
+++ b/src/main/java/seedu/manager/parser/Parser.java
@@ -2,6 +2,7 @@
import seedu.manager.command.Command;
import seedu.manager.command.AddCommand;
+import seedu.manager.command.RemoveCommand;
import seedu.manager.command.ExitCommand;
import seedu.manager.command.MenuCommand;
import seedu.manager.command.EchoCommand;
@@ -28,6 +29,8 @@ public Command parseCommand(String command){
switch (commandWord) {
case AddCommand.COMMAND_WORD:
return parseAddCommand(commandParts);
+ case RemoveCommand.COMMAND_WORD:
+ return parseRemoveCommand(commandParts);
case ListCommand.COMMAND_WORD:
return new ListCommand();
case ExitCommand.COMMAND_WORD:
@@ -70,4 +73,30 @@ public Command parseAddCommand(String[] commandParts) {
// Create and return the AddCommand with parsed parameters
return new AddCommand(eventName, time, venue);
}
+
+ /**
+ * Parses the 'remove' command and its arguments.
+ *
+ * @param commandParts The split command input from the user.
+ * @return The RemoveCommand object with parsed event details.
+ */
+ private Command parseRemoveCommand(String[] commandParts) {
+ Map parameters = new HashMap<>();
+ String currentOption = null;
+
+ for (int i = 1; i < commandParts.length; i++) {
+ String part = commandParts[i];
+ if (part.startsWith("-")) {
+ currentOption = part;
+ } else if (currentOption != null) {
+ parameters.put(currentOption, part);
+ currentOption = null;
+ }
+ }
+
+ // Extract event details from the parsed parameters
+ String eventName = parameters.get("-e"); // Must be present
+
+ return new RemoveCommand(eventName);
+ }
}
From 0d748805393022177dc7cd344f765321219117e4 Mon Sep 17 00:00:00 2001
From: KuanHsienn
Date: Fri, 11 Oct 2024 17:29:18 +0800
Subject: [PATCH 098/619] Modify ListCommand JUnit test
---
src/test/java/seedu/manager/command/ListCommandTest.java | 4 ++--
1 file changed, 2 insertions(+), 2 deletions(-)
diff --git a/src/test/java/seedu/manager/command/ListCommandTest.java b/src/test/java/seedu/manager/command/ListCommandTest.java
index 330b83c898..34223d9cf6 100644
--- a/src/test/java/seedu/manager/command/ListCommandTest.java
+++ b/src/test/java/seedu/manager/command/ListCommandTest.java
@@ -16,8 +16,8 @@ public class ListCommandTest {
public void setUp() {
EventList eventList = new EventList();
- eventList.addEvent(new Event("Event 1", "2024-10-10 10:00", "Venue A"));
- eventList.addEvent(new Event("Event 2", "2024-11-11 12:00", "Venue B"));
+ eventList.addEvent("Event 1", "2024-10-10 10:00", "Venue A");
+ eventList.addEvent("Event 2", "2024-11-11 12:00", "Venue B");
listCommand = new ListCommand();
listCommand.setData(eventList);
From 6b69de7182f55f8ca011cab437fea73af51909d0 Mon Sep 17 00:00:00 2001
From: KuanHsienn
Date: Fri, 11 Oct 2024 17:32:19 +0800
Subject: [PATCH 099/619] Remove import statements
---
src/main/java/seedu/manager/command/RemoveCommand.java | 2 --
src/main/java/seedu/manager/parser/Parser.java | 1 -
src/test/java/seedu/manager/command/ListCommandTest.java | 1 -
3 files changed, 4 deletions(-)
diff --git a/src/main/java/seedu/manager/command/RemoveCommand.java b/src/main/java/seedu/manager/command/RemoveCommand.java
index d1b25de306..66e8cf8c7f 100644
--- a/src/main/java/seedu/manager/command/RemoveCommand.java
+++ b/src/main/java/seedu/manager/command/RemoveCommand.java
@@ -1,7 +1,5 @@
package seedu.manager.command;
-import seedu.manager.event.EventList;
-
public class RemoveCommand extends Command {
public static final String COMMAND_WORD = "remove";
public static final String REMOVE_SUCCESS = "Event removed successfully";
diff --git a/src/main/java/seedu/manager/parser/Parser.java b/src/main/java/seedu/manager/parser/Parser.java
index 3b3f4d5701..3dde268d47 100644
--- a/src/main/java/seedu/manager/parser/Parser.java
+++ b/src/main/java/seedu/manager/parser/Parser.java
@@ -8,7 +8,6 @@
import seedu.manager.command.EchoCommand;
import seedu.manager.command.ListCommand;
-import java.util.Arrays;
import java.util.HashMap;
import java.util.Map;
diff --git a/src/test/java/seedu/manager/command/ListCommandTest.java b/src/test/java/seedu/manager/command/ListCommandTest.java
index 34223d9cf6..96617e25b0 100644
--- a/src/test/java/seedu/manager/command/ListCommandTest.java
+++ b/src/test/java/seedu/manager/command/ListCommandTest.java
@@ -2,7 +2,6 @@
import org.junit.jupiter.api.BeforeEach;
import org.junit.jupiter.api.Test;
-import seedu.manager.event.Event;
import seedu.manager.event.EventList;
import static org.junit.jupiter.api.Assertions.assertEquals;
From 64a54818aa7ecd8e4af73bb15e92268bf0c0e571 Mon Sep 17 00:00:00 2001
From: KuanHsienn <141622026+KuanHsienn@users.noreply.github.com>
Date: Fri, 11 Oct 2024 18:13:06 +0800
Subject: [PATCH 100/619] Update gradle.yml
---
.github/workflows/gradle.yml | 7 +++++--
1 file changed, 5 insertions(+), 2 deletions(-)
diff --git a/.github/workflows/gradle.yml b/.github/workflows/gradle.yml
index 1ea972e389..ec0de2d992 100644
--- a/.github/workflows/gradle.yml
+++ b/.github/workflows/gradle.yml
@@ -29,7 +29,10 @@ jobs:
with:
java-version: '17'
java-package: jdk+fx
-
+
+ - name: Install dos2unix
+ run: sudo apt-get install -y dos2unix
+
- name: Build and check with Gradle
run: ./gradlew check
@@ -47,4 +50,4 @@ jobs:
if: always() && runner.os == 'Windows'
working-directory: ${{ github.workspace }}/text-ui-test
shell: cmd
- run: runtest.bat
\ No newline at end of file
+ run: runtest.bat
From bcfcdcad5bdd177e885498da4fac3a2800f00e48 Mon Sep 17 00:00:00 2001
From: KuanHsienn <141622026+KuanHsienn@users.noreply.github.com>
Date: Fri, 11 Oct 2024 18:17:12 +0800
Subject: [PATCH 101/619] Update gradle.yml
---
.github/workflows/gradle.yml | 13 +++++++++++--
1 file changed, 11 insertions(+), 2 deletions(-)
diff --git a/.github/workflows/gradle.yml b/.github/workflows/gradle.yml
index ec0de2d992..500ef051bd 100644
--- a/.github/workflows/gradle.yml
+++ b/.github/workflows/gradle.yml
@@ -29,9 +29,18 @@ jobs:
with:
java-version: '17'
java-package: jdk+fx
-
- - name: Install dos2unix
+
+ - name: Install dos2unix (Ubuntu)
+ if: runner.os == 'Linux'
run: sudo apt-get install -y dos2unix
+
+ - name: Install dos2unix (MacOS)
+ if: runner.os == 'macOS'
+ run: brew install dos2unix
+
+ - name: Install dos2unix (Windows)
+ if: runner.os == 'Windows'
+ run: choco install dos2unix
- name: Build and check with Gradle
run: ./gradlew check
From c337a700541d4b04f3fa0b54649502b0342a0954 Mon Sep 17 00:00:00 2001
From: KuanHsienn
Date: Sat, 12 Oct 2024 10:59:34 +0800
Subject: [PATCH 102/619] Add JavaDoc Comments
---
.../seedu/manager/command/AddCommand.java | 17 ++++++++++----
.../seedu/manager/command/RemoveCommand.java | 22 ++++++++++++++++---
.../java/seedu/manager/parser/Parser.java | 1 -
3 files changed, 32 insertions(+), 8 deletions(-)
diff --git a/src/main/java/seedu/manager/command/AddCommand.java b/src/main/java/seedu/manager/command/AddCommand.java
index ab87a9b364..ce5e330a45 100644
--- a/src/main/java/seedu/manager/command/AddCommand.java
+++ b/src/main/java/seedu/manager/command/AddCommand.java
@@ -1,7 +1,8 @@
package seedu.manager.command;
/**
- * Represents an executable add command
+ * Represents a command to add an event to the event list.
+ * The add command will store the event's name, time, and venue.
*/
public class AddCommand extends Command {
public static final String COMMAND_WORD = "add";
@@ -10,6 +11,13 @@ public class AddCommand extends Command {
protected String time;
protected String venue;
+ /**
+ * Constructs an AddCommand object with the specified event details.
+ *
+ * @param eventName The name of the event to be added.
+ * @param time The time of the event to be added.
+ * @param venue The venue of the event to be added.
+ */
public AddCommand(String eventName, String time, String venue) {
this.eventName = eventName;
this.time = time;
@@ -17,13 +25,14 @@ public AddCommand(String eventName, String time, String venue) {
}
/**
- * Returns a command output with an add message
+ * Executes the command to add an event to the event list.
+ * The event is added with the provided name, time, and venue.
*
- * @return The command output with an add message
+ * @return The command output indicating that the event was added successfully.
*/
+ @Override
public CommandOutput execute() {
this.eventList.addEvent(this.eventName, this.time, this.venue);
- //this.eventList.getList();
return new CommandOutput(ADD_MESSAGE, false);
}
}
diff --git a/src/main/java/seedu/manager/command/RemoveCommand.java b/src/main/java/seedu/manager/command/RemoveCommand.java
index 66e8cf8c7f..c153a85312 100644
--- a/src/main/java/seedu/manager/command/RemoveCommand.java
+++ b/src/main/java/seedu/manager/command/RemoveCommand.java
@@ -1,16 +1,32 @@
package seedu.manager.command;
+/**
+ * Represents a command to remove an event from the event list.
+ * The remove command will search for an event by its name and remove it if found.
+ */
public class RemoveCommand extends Command {
public static final String COMMAND_WORD = "remove";
- public static final String REMOVE_SUCCESS = "Event removed successfully";
- public static final String REMOVE_FAILURE = "Event not found";
+ private static final String REMOVE_SUCCESS = "Event removed successfully";
+ private static final String REMOVE_FAILURE = "Event not found";
protected String eventName;
-
+ /**
+ * Constructs a RemoveCommand object with the specified event name.
+ *
+ * @param eventName The name of the event to be removed.
+ */
public RemoveCommand(String eventName) {
this.eventName = eventName;
}
+ /**
+ * Executes the command to remove the event from the event list.
+ * If the event is successfully removed, a success message is returned.
+ * Otherwise, a failure message is returned.
+ *
+ * @return The command output with a remove message.
+ */
+ @Override
public CommandOutput execute() {
boolean isRemoved = this.eventList.removeEvent(eventName);
if (isRemoved) {
diff --git a/src/main/java/seedu/manager/parser/Parser.java b/src/main/java/seedu/manager/parser/Parser.java
index 3dde268d47..0ed581782c 100644
--- a/src/main/java/seedu/manager/parser/Parser.java
+++ b/src/main/java/seedu/manager/parser/Parser.java
@@ -69,7 +69,6 @@ public Command parseAddCommand(String[] commandParts) {
String time = parameters.get("-time");
String venue = parameters.get("-venue");
- // Create and return the AddCommand with parsed parameters
return new AddCommand(eventName, time, venue);
}
From e00a17e9a2338b98d159e071a0d95a3d11e5ed7b Mon Sep 17 00:00:00 2001
From: LTK-1606
Date: Sat, 12 Oct 2024 19:48:22 +0800
Subject: [PATCH 103/619] Added functionality to add participants to events.
---
.../seedu/manager/command/AddCommand.java | 39 ++++++++++++++++---
src/main/java/seedu/manager/event/Event.java | 14 +++++++
.../java/seedu/manager/event/EventList.java | 22 +++++++++++
3 files changed, 69 insertions(+), 6 deletions(-)
diff --git a/src/main/java/seedu/manager/command/AddCommand.java b/src/main/java/seedu/manager/command/AddCommand.java
index ce5e330a45..8e2cf0eb4d 100644
--- a/src/main/java/seedu/manager/command/AddCommand.java
+++ b/src/main/java/seedu/manager/command/AddCommand.java
@@ -6,10 +6,12 @@
*/
public class AddCommand extends Command {
public static final String COMMAND_WORD = "add";
- private static final String ADD_MESSAGE = "Event added successfully";
+ private static final String ADD_E_MESSAGE = "Event added successfully";
+ private static final String ADD_P_MESSAGE = "Participant added successfully";
protected String eventName;
protected String time;
protected String venue;
+ protected String participantName;
/**
* Constructs an AddCommand object with the specified event details.
@@ -25,14 +27,39 @@ public AddCommand(String eventName, String time, String venue) {
}
/**
- * Executes the command to add an event to the event list.
- * The event is added with the provided name, time, and venue.
+ * Constructs an {@code AddCommand} with the specified participant name and event name.
*
- * @return The command output indicating that the event was added successfully.
+ * @param participantName the name of the participant to be added to the event.
+ * If null, a new event will be created instead.
+ * @param eventName the name of the event to which the participant will be added
+ * or the event to be created if no participant name is provided.
+ */
+ public AddCommand(String participantName, String eventName) {
+ this.participantName = participantName;
+ this.eventName = eventName;
+ }
+
+ /**
+ * Executes the command to add an event or a participant to an event.
+ *
+ * If no participant name is provided, this method will add a new event
+ * to the event list with the specified event name, time, and venue.
+ * If a participant name is provided, it will add the participant to the
+ * specified event in the event list.
+ *
+ *
+ * @return a {@link CommandOutput} object containing a message about
+ * the result of the execution. The message indicates whether an event
+ * or participant was successfully added.
*/
@Override
public CommandOutput execute() {
- this.eventList.addEvent(this.eventName, this.time, this.venue);
- return new CommandOutput(ADD_MESSAGE, false);
+ if (participantName == null) {
+ this.eventList.addEvent(this.eventName, this.time, this.venue);
+ return new CommandOutput(ADD_E_MESSAGE, false);
+ } else {
+ this.eventList.addParticipantToEvent(this.participantName, this.eventName);
+ return new CommandOutput(ADD_P_MESSAGE, false);
+ }
}
}
diff --git a/src/main/java/seedu/manager/event/Event.java b/src/main/java/seedu/manager/event/Event.java
index 8505fbf734..b431f96e8a 100644
--- a/src/main/java/seedu/manager/event/Event.java
+++ b/src/main/java/seedu/manager/event/Event.java
@@ -1,5 +1,7 @@
package seedu.manager.event;
+import java.util.ArrayList;
+
/**
* The Event class represents an event with a name, time, and venue.
* It provides methods to access and modify the time and venue of the event.
@@ -8,6 +10,7 @@ public class Event {
private final String eventName;
private String eventTime;
private String eventVenue;
+ protected ArrayList participantList;
/**
* Constructs an Event with the specified name.
@@ -16,6 +19,7 @@ public class Event {
*/
public Event(String eventName) {
this.eventName = eventName;
+ this.participantList = new ArrayList<>();
}
/**
@@ -29,6 +33,16 @@ public Event(String eventName, String eventTime, String eventVenue) {
this.eventName = eventName;
this.eventTime = eventTime;
this.eventVenue = eventVenue;
+ this.participantList = new ArrayList<>();
+ }
+
+ /**
+ * Adds a participant to the participant list for the event.
+ *
+ * @param participantName the name of the participant to be added to the list.
+ */
+ public void addParticipant(String participantName) {
+ this.participantList.add(participantName);
}
/**
diff --git a/src/main/java/seedu/manager/event/EventList.java b/src/main/java/seedu/manager/event/EventList.java
index e9cfd62a44..c53f7372f7 100644
--- a/src/main/java/seedu/manager/event/EventList.java
+++ b/src/main/java/seedu/manager/event/EventList.java
@@ -54,6 +54,13 @@ public Event getEvent(int index) {
return eventList.get(index);
}
+ /**
+ * Removes an event from the event list by its name.
+ *
+ * @param eventName the name of the event to be removed.
+ * @return {@code true} if the event was successfully removed;
+ * {@code false} if no event with the specified name was found.
+ */
public boolean removeEvent(String eventName) {
for (Event event : eventList) {
if (event.getEventName().equals(eventName)) { // Assuming Event has a getName() method
@@ -63,4 +70,19 @@ public boolean removeEvent(String eventName) {
}
return false; // Event not found
}
+
+ /**
+ * Adds a participant to an existing event.
+ *
+ * @param participantName the name of the participant to be added.
+ * @param eventName the name of the event to which the participant will be added.
+ */
+ public void addParticipantToEvent(String participantName, String eventName) {
+ for (Event event : eventList) {
+ if (event.getEventName().equals(eventName)) {
+ event.addParticipant(participantName);
+ break;
+ }
+ }
+ }
}
From 660abab06d2c430bdd0ba6fdd80e56aa21c25a2b Mon Sep 17 00:00:00 2001
From: LTK-1606
Date: Sat, 12 Oct 2024 20:33:34 +0800
Subject: [PATCH 104/619] Add parser support and JUnit tests for adding
participants
---
src/main/java/seedu/manager/event/Event.java | 9 ++++
.../java/seedu/manager/event/EventList.java | 4 +-
.../java/seedu/manager/parser/Parser.java | 47 ++++++++++---------
.../seedu/manager/command/AddCommandTest.java | 33 +++++++++++++
4 files changed, 68 insertions(+), 25 deletions(-)
create mode 100644 src/test/java/seedu/manager/command/AddCommandTest.java
diff --git a/src/main/java/seedu/manager/event/Event.java b/src/main/java/seedu/manager/event/Event.java
index b431f96e8a..b4c91fb12e 100644
--- a/src/main/java/seedu/manager/event/Event.java
+++ b/src/main/java/seedu/manager/event/Event.java
@@ -45,6 +45,15 @@ public void addParticipant(String participantName) {
this.participantList.add(participantName);
}
+ /**
+ * Retrieves the number of participants in the participant list.
+ *
+ * @return the count of participants currently in the list.
+ */
+ public int getParticipantCount() {
+ return this.participantList.size();
+ }
+
/**
* @return the event name
*/
diff --git a/src/main/java/seedu/manager/event/EventList.java b/src/main/java/seedu/manager/event/EventList.java
index c53f7372f7..9e3cbf3be5 100644
--- a/src/main/java/seedu/manager/event/EventList.java
+++ b/src/main/java/seedu/manager/event/EventList.java
@@ -47,11 +47,11 @@ public void addEvent(String eventName, String time, String venue) {
}
/**
- * @param index The index of event in the list (0 based indexing)
+ * @param index The index of event in the list
* @return The specific event in the event list.
*/
public Event getEvent(int index) {
- return eventList.get(index);
+ return eventList.get(index - 1);
}
/**
diff --git a/src/main/java/seedu/manager/parser/Parser.java b/src/main/java/seedu/manager/parser/Parser.java
index 0ed581782c..177885751e 100644
--- a/src/main/java/seedu/manager/parser/Parser.java
+++ b/src/main/java/seedu/manager/parser/Parser.java
@@ -24,10 +24,11 @@ public class Parser {
public Command parseCommand(String command){
String[] commandParts = command.split(" ");
String commandWord = commandParts[0];
+ String commandFlag = commandParts[1];
switch (commandWord) {
case AddCommand.COMMAND_WORD:
- return parseAddCommand(commandParts);
+ return parseAddCommand(command, commandFlag);
case RemoveCommand.COMMAND_WORD:
return parseRemoveCommand(commandParts);
case ListCommand.COMMAND_WORD:
@@ -43,33 +44,33 @@ public Command parseCommand(String command){
}
/**
- * Parses the 'add' command and its arguments.
+ * Parses the input string to create an {@link Command} based on the provided command flag.
*
- * @param commandParts The split command input from the user.
- * @return The AddCommand object with parsed event details.
+ *
+ * If the command flag is {@code "-e"}, it splits the input string into parts
+ * to create an {@link AddCommand} for adding an event. If the command flag is
+ * {@code "-p"}, it creates an {@link AddCommand} for adding a participant to
+ * an event. If neither flag is matched, it returns an {@link EchoCommand}
+ * with the original input.
+ *
+ *
+ * @param input the input string containing the command details.
+ * @param commandFlag the flag indicating the type of command to parse
+ * (e.g., {@code "-e"} for event, {@code "-p"} for participant).
+ * @return a {@link Command} object representing the parsed command.
*/
- public Command parseAddCommand(String[] commandParts) {
- // Map to store the option-value pairs
- Map parameters = new HashMap<>();
- String currentOption = null;
+ public Command parseAddCommand(String input, String commandFlag) {
+ String[] commandParts;
- // Parse the options and their values
- for (int i = 1; i < commandParts.length; i++) {
- String part = commandParts[i];
- if (part.startsWith("-")) {
- currentOption = part; // Current part is an option (e.g., -e, -time, -venue)
- } else if (currentOption != null) {
- parameters.put(currentOption, part); // Store the value for the current option
- currentOption = null; // Reset after assigning value
- }
+ if (commandFlag.equals("-e")) {
+ commandParts = input.split("(-e|-t|-v)");
+ return new AddCommand(commandParts[1], commandParts[2], commandParts[3]);
+ } else if (commandFlag.equals("-p")) {
+ commandParts = input.split("(-p|-e)");
+ return new AddCommand(commandParts[1], commandParts[2]);
}
- // Extract event details from the parsed parameters
- String eventName = parameters.get("-e");
- String time = parameters.get("-time");
- String venue = parameters.get("-venue");
-
- return new AddCommand(eventName, time, venue);
+ return new EchoCommand(input);
}
/**
diff --git a/src/test/java/seedu/manager/command/AddCommandTest.java b/src/test/java/seedu/manager/command/AddCommandTest.java
new file mode 100644
index 0000000000..e345fc1513
--- /dev/null
+++ b/src/test/java/seedu/manager/command/AddCommandTest.java
@@ -0,0 +1,33 @@
+package seedu.manager.command;
+
+import org.junit.jupiter.api.Test;
+import seedu.manager.event.EventList;
+
+import static org.junit.jupiter.api.Assertions.assertEquals;
+
+public class AddCommandTest {
+ private Command addCommand;
+
+ @Test
+ public void add_twoParticipant_success() {
+ EventList eventList = new EventList();
+
+ eventList.addEvent("Event 1", "2024-10-10 10:00", "Venue A");
+ eventList.addParticipantToEvent("Tom", "Event 1");
+ eventList.addParticipantToEvent("Harry", "Event 1");
+
+ assertEquals(2, eventList.getEvent(1).getParticipantCount());
+ }
+
+ @Test
+ public void add_oneParticipantWrongly_success() {
+ EventList eventList = new EventList();
+
+ eventList.addEvent("Event 1", "2024-10-10 10:00", "Venue A");
+ eventList.addParticipantToEvent("Tom", "Event 1");
+ eventList.addParticipantToEvent("Harry", "Event 2");
+
+ assertEquals(1, eventList.getEvent(1).getParticipantCount());
+ }
+}
+
From 4fa02eb99a9908b73d4e2bd1f01590af8b48f536 Mon Sep 17 00:00:00 2001
From: Tze Kang <141611843+LTK-1606@users.noreply.github.com>
Date: Sat, 12 Oct 2024 20:49:31 +0800
Subject: [PATCH 105/619] Revert to old indexing
---
src/main/java/seedu/manager/event/EventList.java | 4 ++--
1 file changed, 2 insertions(+), 2 deletions(-)
diff --git a/src/main/java/seedu/manager/event/EventList.java b/src/main/java/seedu/manager/event/EventList.java
index 68efd83f81..93d0493e20 100644
--- a/src/main/java/seedu/manager/event/EventList.java
+++ b/src/main/java/seedu/manager/event/EventList.java
@@ -44,11 +44,11 @@ public void addEvent(String eventName) {
}
/**
- * @param index The index of event in the list
+ * @param index The index of event in the list (0 based indexing)
* @return The specific event in the event list.
*/
public Event getEvent(int index) {
- return eventList.get(index - 1);
+ return eventList.get(index);
}
/**
From 13811eab2413c3006e31ac15fcd0dc31a52d2017 Mon Sep 17 00:00:00 2001
From: Tze Kang <141611843+LTK-1606@users.noreply.github.com>
Date: Sat, 12 Oct 2024 20:50:15 +0800
Subject: [PATCH 106/619] Update indexing
---
src/test/java/seedu/manager/command/AddCommandTest.java | 4 ++--
1 file changed, 2 insertions(+), 2 deletions(-)
diff --git a/src/test/java/seedu/manager/command/AddCommandTest.java b/src/test/java/seedu/manager/command/AddCommandTest.java
index e345fc1513..7c09cd6918 100644
--- a/src/test/java/seedu/manager/command/AddCommandTest.java
+++ b/src/test/java/seedu/manager/command/AddCommandTest.java
@@ -16,7 +16,7 @@ public void add_twoParticipant_success() {
eventList.addParticipantToEvent("Tom", "Event 1");
eventList.addParticipantToEvent("Harry", "Event 1");
- assertEquals(2, eventList.getEvent(1).getParticipantCount());
+ assertEquals(2, eventList.getEvent(0).getParticipantCount());
}
@Test
@@ -27,7 +27,7 @@ public void add_oneParticipantWrongly_success() {
eventList.addParticipantToEvent("Tom", "Event 1");
eventList.addParticipantToEvent("Harry", "Event 2");
- assertEquals(1, eventList.getEvent(1).getParticipantCount());
+ assertEquals(1, eventList.getEvent(0).getParticipantCount());
}
}
From beeb3bf72fee67feaa3c46a1a7bde86ffc3cfbdc Mon Sep 17 00:00:00 2001
From: LTK-1606
Date: Sat, 12 Oct 2024 21:06:44 +0800
Subject: [PATCH 107/619] Resolve issue with AddCommand parameters
---
.../java/seedu/manager/event/EventList.java | 19 +++++++++++
.../java/seedu/manager/parser/Parser.java | 34 +++++++++----------
.../java/seedu/manager/parser/ParserTest.java | 8 -----
3 files changed, 36 insertions(+), 25 deletions(-)
diff --git a/src/main/java/seedu/manager/event/EventList.java b/src/main/java/seedu/manager/event/EventList.java
index 93d0493e20..39d30a2a61 100644
--- a/src/main/java/seedu/manager/event/EventList.java
+++ b/src/main/java/seedu/manager/event/EventList.java
@@ -43,6 +43,8 @@ public void addEvent(String eventName) {
eventList.add(newEvent);
}
+
+
/**
* @param index The index of event in the list (0 based indexing)
* @return The specific event in the event list.
@@ -51,6 +53,23 @@ public Event getEvent(int index) {
return eventList.get(index);
}
+ /**
+ * Adds a new event to the event list.
+ *
+ *
+ * This method creates a new {@link Event} object with the specified event name,
+ * time, and venue, and adds it to the event list.
+ *
+ *
+ * @param eventName the name of the event to be added.
+ * @param time the time of the event.
+ * @param venue the venue where the event will take place.
+ */
+ public void addEvent(String eventName, String time, String venue) {
+ Event newEvent = new Event(eventName, time, venue);
+ eventList.add(newEvent);
+ }
+
/**
* Removes an event from the event list by its name.
*
diff --git a/src/main/java/seedu/manager/parser/Parser.java b/src/main/java/seedu/manager/parser/Parser.java
index 177885751e..b7b09f927d 100644
--- a/src/main/java/seedu/manager/parser/Parser.java
+++ b/src/main/java/seedu/manager/parser/Parser.java
@@ -24,11 +24,10 @@ public class Parser {
public Command parseCommand(String command){
String[] commandParts = command.split(" ");
String commandWord = commandParts[0];
- String commandFlag = commandParts[1];
switch (commandWord) {
case AddCommand.COMMAND_WORD:
- return parseAddCommand(command, commandFlag);
+ return parseAddCommand(command, commandParts);
case RemoveCommand.COMMAND_WORD:
return parseRemoveCommand(commandParts);
case ListCommand.COMMAND_WORD:
@@ -44,30 +43,31 @@ public Command parseCommand(String command){
}
/**
- * Parses the input string to create an {@link Command} based on the provided command flag.
+ * Parses the input string to create an {@link Command} based on the provided command parts.
*
*
- * If the command flag is {@code "-e"}, it splits the input string into parts
- * to create an {@link AddCommand} for adding an event. If the command flag is
- * {@code "-p"}, it creates an {@link AddCommand} for adding a participant to
- * an event. If neither flag is matched, it returns an {@link EchoCommand}
- * with the original input.
+ * This method checks the command flag extracted from the command parts. If the command
+ * flag is {@code "-e"}, it splits the input string into parts to create an
+ * {@link AddCommand} for adding an event. If the command flag is {@code "-p"},
+ * it creates an {@link AddCommand} for adding a participant to an event. If neither
+ * flag is matched, it returns an {@link EchoCommand} with the original input.
*
*
- * @param input the input string containing the command details.
- * @param commandFlag the flag indicating the type of command to parse
- * (e.g., {@code "-e"} for event, {@code "-p"} for participant).
+ * @param input the input string containing the command details.
+ * @param commandParts an array of strings representing the parsed command parts,
+ * where the second element is the command flag.
* @return a {@link Command} object representing the parsed command.
*/
- public Command parseAddCommand(String input, String commandFlag) {
- String[] commandParts;
+ public Command parseAddCommand(String input, String[] commandParts) {
+ String commandFlag = commandParts[1];
+ String[] inputParts;
if (commandFlag.equals("-e")) {
- commandParts = input.split("(-e|-t|-v)");
- return new AddCommand(commandParts[1], commandParts[2], commandParts[3]);
+ inputParts = input.split("(-e|-t|-v)");
+ return new AddCommand(inputParts[1], inputParts[2], inputParts[3]);
} else if (commandFlag.equals("-p")) {
- commandParts = input.split("(-p|-e)");
- return new AddCommand(commandParts[1], commandParts[2]);
+ inputParts = input.split("(-p|-e)");
+ return new AddCommand(inputParts[1], inputParts[2]);
}
return new EchoCommand(input);
diff --git a/src/test/java/seedu/manager/parser/ParserTest.java b/src/test/java/seedu/manager/parser/ParserTest.java
index 257e186e53..9f28417d91 100644
--- a/src/test/java/seedu/manager/parser/ParserTest.java
+++ b/src/test/java/seedu/manager/parser/ParserTest.java
@@ -45,14 +45,6 @@ public void parseCommand_listWord_list() {
assertInstanceOf(ListCommand.class, command);
}
- @Test
- public void parseCommand_addWord_add() {
- Parser parser = new Parser();
- Command command = parser.parseCommand("add");
-
- assertInstanceOf(AddCommand.class, command);
- }
-
@Test
public void parseCommand_removeWord_add() {
Parser parser = new Parser();
From 0a67546d19ee88f0cf871c6db306ee21e49f48b2 Mon Sep 17 00:00:00 2001
From: LTK-1606
Date: Sat, 12 Oct 2024 21:17:13 +0800
Subject: [PATCH 108/619] Update to meet Gradle style checks
---
.../java/seedu/manager/command/AddCommand.java | 5 ++---
src/main/java/seedu/manager/event/Event.java | 2 +-
.../java/seedu/manager/event/EventList.java | 18 ++++++++----------
.../java/seedu/manager/parser/ParserTest.java | 1 -
4 files changed, 11 insertions(+), 15 deletions(-)
diff --git a/src/main/java/seedu/manager/command/AddCommand.java b/src/main/java/seedu/manager/command/AddCommand.java
index 8e2cf0eb4d..6b3ed78e42 100644
--- a/src/main/java/seedu/manager/command/AddCommand.java
+++ b/src/main/java/seedu/manager/command/AddCommand.java
@@ -48,9 +48,8 @@ public AddCommand(String participantName, String eventName) {
* specified event in the event list.
*
*
- * @return a {@link CommandOutput} object containing a message about
- * the result of the execution. The message indicates whether an event
- * or participant was successfully added.
+ * @return a {@link CommandOutput} object containing a message about the result of the execution.
+ * The message indicates whether an event or participant was successfully added.
*/
@Override
public CommandOutput execute() {
diff --git a/src/main/java/seedu/manager/event/Event.java b/src/main/java/seedu/manager/event/Event.java
index b4c91fb12e..aa06ef7fd5 100644
--- a/src/main/java/seedu/manager/event/Event.java
+++ b/src/main/java/seedu/manager/event/Event.java
@@ -7,10 +7,10 @@
* It provides methods to access and modify the time and venue of the event.
*/
public class Event {
+ protected ArrayList participantList;
private final String eventName;
private String eventTime;
private String eventVenue;
- protected ArrayList participantList;
/**
* Constructs an Event with the specified name.
diff --git a/src/main/java/seedu/manager/event/EventList.java b/src/main/java/seedu/manager/event/EventList.java
index 39d30a2a61..35a0f03acb 100644
--- a/src/main/java/seedu/manager/event/EventList.java
+++ b/src/main/java/seedu/manager/event/EventList.java
@@ -43,16 +43,6 @@ public void addEvent(String eventName) {
eventList.add(newEvent);
}
-
-
- /**
- * @param index The index of event in the list (0 based indexing)
- * @return The specific event in the event list.
- */
- public Event getEvent(int index) {
- return eventList.get(index);
- }
-
/**
* Adds a new event to the event list.
*
@@ -70,6 +60,14 @@ public void addEvent(String eventName, String time, String venue) {
eventList.add(newEvent);
}
+ /**
+ * @param index The index of event in the list (0 based indexing)
+ * @return The specific event in the event list.
+ */
+ public Event getEvent(int index) {
+ return eventList.get(index);
+ }
+
/**
* Removes an event from the event list by its name.
*
diff --git a/src/test/java/seedu/manager/parser/ParserTest.java b/src/test/java/seedu/manager/parser/ParserTest.java
index 9f28417d91..aa67aead73 100644
--- a/src/test/java/seedu/manager/parser/ParserTest.java
+++ b/src/test/java/seedu/manager/parser/ParserTest.java
@@ -6,7 +6,6 @@
import seedu.manager.command.ExitCommand;
import seedu.manager.command.MenuCommand;
import seedu.manager.command.ListCommand;
-import seedu.manager.command.AddCommand;
import seedu.manager.command.RemoveCommand;
import static org.junit.jupiter.api.Assertions.assertInstanceOf;
From cba76a731734824be29755fd8a28fb465c92d579 Mon Sep 17 00:00:00 2001
From: LTK-1606
Date: Sat, 12 Oct 2024 21:38:04 +0800
Subject: [PATCH 109/619] Add functionality to remove participants from events
---
.../seedu/manager/command/RemoveCommand.java | 28 ++++++++++++----
src/main/java/seedu/manager/event/Event.java | 18 ++++++++++
.../java/seedu/manager/event/EventList.java | 25 ++++++++++++++
.../seedu/manager/command/AddCommandTest.java | 1 -
.../manager/command/RemoveCommandTest.java | 33 +++++++++++++++++++
5 files changed, 97 insertions(+), 8 deletions(-)
create mode 100644 src/test/java/seedu/manager/command/RemoveCommandTest.java
diff --git a/src/main/java/seedu/manager/command/RemoveCommand.java b/src/main/java/seedu/manager/command/RemoveCommand.java
index c153a85312..112cfec05c 100644
--- a/src/main/java/seedu/manager/command/RemoveCommand.java
+++ b/src/main/java/seedu/manager/command/RemoveCommand.java
@@ -6,9 +6,10 @@
*/
public class RemoveCommand extends Command {
public static final String COMMAND_WORD = "remove";
- private static final String REMOVE_SUCCESS = "Event removed successfully";
- private static final String REMOVE_FAILURE = "Event not found";
+ private static final String REMOVE_SUCCESS = "Removed successfully";
+ private static final String REMOVE_FAILURE = "Not found";
protected String eventName;
+ protected String participantName;
/**
* Constructs a RemoveCommand object with the specified event name.
@@ -20,15 +21,28 @@ public RemoveCommand(String eventName) {
}
/**
- * Executes the command to remove the event from the event list.
- * If the event is successfully removed, a success message is returned.
- * Otherwise, a failure message is returned.
+ * Executes the command to remove an event or a participant from an event.
*
- * @return The command output with a remove message.
+ *
+ * If no participant name is provided, this method attempts to remove the event
+ * specified by the event name. If a participant name is provided, it tries to
+ * remove that participant from the specified event. The result of the operation
+ * is indicated by the return value.
+ *
+ *
+ * @return a {@link CommandOutput} object containing a message indicating
+ * whether the removal was successful or failed.
*/
@Override
public CommandOutput execute() {
- boolean isRemoved = this.eventList.removeEvent(eventName);
+ boolean isRemoved;
+
+ if (participantName == null) {
+ isRemoved = this.eventList.removeEvent(this.eventName);
+ } else {
+ isRemoved = this.eventList.removeParticipantFromEvent(this.participantName, this.eventName);
+ }
+
if (isRemoved) {
return new CommandOutput(REMOVE_SUCCESS, false);
} else {
diff --git a/src/main/java/seedu/manager/event/Event.java b/src/main/java/seedu/manager/event/Event.java
index aa06ef7fd5..b6a838b5a1 100644
--- a/src/main/java/seedu/manager/event/Event.java
+++ b/src/main/java/seedu/manager/event/Event.java
@@ -45,6 +45,24 @@ public void addParticipant(String participantName) {
this.participantList.add(participantName);
}
+ /**
+ * Removes a participant from the participant list.
+ *
+ *
+ * This method attempts to remove the specified participant from the list of
+ * participants associated with the event. It returns {@code true} if the
+ * participant was successfully removed, and {@code false} if the participant
+ * was not found in the list.
+ *
+ *
+ * @param participantName the name of the participant to be removed from the list.
+ * @return {@code true} if the participant was successfully removed;
+ * {@code false} if the participant was not found in the list.
+ */
+ public boolean removeParticipant(String participantName) {
+ return this.participantList.remove(participantName);
+ }
+
/**
* Retrieves the number of participants in the participant list.
*
diff --git a/src/main/java/seedu/manager/event/EventList.java b/src/main/java/seedu/manager/event/EventList.java
index 35a0f03acb..c590edc0ca 100644
--- a/src/main/java/seedu/manager/event/EventList.java
+++ b/src/main/java/seedu/manager/event/EventList.java
@@ -99,4 +99,29 @@ public void addParticipantToEvent(String participantName, String eventName) {
}
}
}
+
+ /**
+ * Removes a participant from a specified event.
+ *
+ *
+ * This method searches for the event with the given name in the event list and
+ * attempts to remove the specified participant from that event. If the event is
+ * found and the participant is successfully removed, it returns {@code true}.
+ * If the event does not exist or the participant is not found, it returns
+ * {@code false}.
+ *
+ *
+ * @param participantName the name of the participant to be removed from the event.
+ * @param eventName the name of the event from which the participant will be removed.
+ * @return {@code true} if the participant was successfully removed;
+ * {@code false} if the event does not exist or the participant was not found.
+ */
+ public boolean removeParticipantFromEvent(String participantName, String eventName) {
+ for (Event event : eventList) {
+ if (event.getEventName().equals(eventName)) {
+ return event.removeParticipant(participantName);
+ }
+ }
+ return false;
+ }
}
diff --git a/src/test/java/seedu/manager/command/AddCommandTest.java b/src/test/java/seedu/manager/command/AddCommandTest.java
index 7c09cd6918..b7da30b8cd 100644
--- a/src/test/java/seedu/manager/command/AddCommandTest.java
+++ b/src/test/java/seedu/manager/command/AddCommandTest.java
@@ -6,7 +6,6 @@
import static org.junit.jupiter.api.Assertions.assertEquals;
public class AddCommandTest {
- private Command addCommand;
@Test
public void add_twoParticipant_success() {
diff --git a/src/test/java/seedu/manager/command/RemoveCommandTest.java b/src/test/java/seedu/manager/command/RemoveCommandTest.java
new file mode 100644
index 0000000000..06769084df
--- /dev/null
+++ b/src/test/java/seedu/manager/command/RemoveCommandTest.java
@@ -0,0 +1,33 @@
+package seedu.manager.command;
+
+import org.junit.jupiter.api.Test;
+import seedu.manager.event.EventList;
+
+import static org.junit.jupiter.api.Assertions.assertEquals;
+
+public class RemoveCommandTest {
+
+ @Test
+ public void remove_oneParticipant_success() {
+ EventList eventList = new EventList();
+
+ eventList.addEvent("Event 1", "2024-10-10 10:00", "Venue A");
+ eventList.addParticipantToEvent("Tom", "Event 1");
+ eventList.addParticipantToEvent("Harry", "Event 1");
+ eventList.removeParticipantFromEvent("Tom", "Event 1");
+
+ assertEquals(1, eventList.getEvent(0).getParticipantCount());
+ }
+
+ @Test
+ public void remove_oneParticipantWrongly_success() {
+ EventList eventList = new EventList();
+
+ eventList.addEvent("Event 1", "2024-10-10 10:00", "Venue A");
+ eventList.addParticipantToEvent("Tom", "Event 1");
+ eventList.addParticipantToEvent("Harry", "Event 1");
+ eventList.removeParticipantFromEvent("Tom", "Event 2");
+
+ assertEquals(2, eventList.getEvent(0).getParticipantCount());
+ }
+}
From 017c4cce9157a98f8d2298454ab8c0ac86a2344a Mon Sep 17 00:00:00 2001
From: LTK-1606
Date: Sat, 12 Oct 2024 21:45:16 +0800
Subject: [PATCH 110/619] Add parser support and JUnit tests for removing
participants
---
.../seedu/manager/command/RemoveCommand.java | 13 +++++-
.../java/seedu/manager/parser/Parser.java | 46 ++++++++++---------
.../java/seedu/manager/parser/ParserTest.java | 9 ----
3 files changed, 36 insertions(+), 32 deletions(-)
diff --git a/src/main/java/seedu/manager/command/RemoveCommand.java b/src/main/java/seedu/manager/command/RemoveCommand.java
index 112cfec05c..814244fedc 100644
--- a/src/main/java/seedu/manager/command/RemoveCommand.java
+++ b/src/main/java/seedu/manager/command/RemoveCommand.java
@@ -20,6 +20,17 @@ public RemoveCommand(String eventName) {
this.eventName = eventName;
}
+ /**
+ * Constructs a RemoveCommand object with the specified event name.
+ *
+ * @param eventName The name of the event the participant is to be removed from.
+ * @param participantName The name of the participant to be removed.
+ */
+ public RemoveCommand(String eventName, String participantName) {
+ this.eventName = eventName;
+ this.participantName = participantName;
+ }
+
/**
* Executes the command to remove an event or a participant from an event.
*
@@ -31,7 +42,7 @@ public RemoveCommand(String eventName) {
*
*
* @return a {@link CommandOutput} object containing a message indicating
- * whether the removal was successful or failed.
+ * whether the removal was successful or failed.
*/
@Override
public CommandOutput execute() {
diff --git a/src/main/java/seedu/manager/parser/Parser.java b/src/main/java/seedu/manager/parser/Parser.java
index b7b09f927d..4509e3be72 100644
--- a/src/main/java/seedu/manager/parser/Parser.java
+++ b/src/main/java/seedu/manager/parser/Parser.java
@@ -8,9 +8,6 @@
import seedu.manager.command.EchoCommand;
import seedu.manager.command.ListCommand;
-import java.util.HashMap;
-import java.util.Map;
-
/**
* Represents the command parser for EventManagerCLI
*/
@@ -29,7 +26,7 @@ public Command parseCommand(String command){
case AddCommand.COMMAND_WORD:
return parseAddCommand(command, commandParts);
case RemoveCommand.COMMAND_WORD:
- return parseRemoveCommand(commandParts);
+ return parseRemoveCommand(command, commandParts);
case ListCommand.COMMAND_WORD:
return new ListCommand();
case ExitCommand.COMMAND_WORD:
@@ -74,28 +71,33 @@ public Command parseAddCommand(String input, String[] commandParts) {
}
/**
- * Parses the 'remove' command and its arguments.
+ * Parses the input string to create a {@link Command} based on the provided command parts.
+ *
+ *
+ * This method checks the command flag extracted from the command parts. If the command
+ * flag is {@code "-e"}, it splits the input string to create a {@link RemoveCommand}
+ * for removing an event. If the command flag is {@code "-p"}, it creates a
+ * {@link RemoveCommand} for removing a participant from an event. If neither flag
+ * is matched, it returns an {@link EchoCommand} with the original input.
+ *
*
- * @param commandParts The split command input from the user.
- * @return The RemoveCommand object with parsed event details.
+ * @param input the input string containing the command details.
+ * @param commandParts an array of strings representing the parsed command parts,
+ * where the second element is the command flag.
+ * @return a {@link Command} object representing the parsed command.
*/
- private Command parseRemoveCommand(String[] commandParts) {
- Map parameters = new HashMap<>();
- String currentOption = null;
+ private Command parseRemoveCommand(String input, String[] commandParts) {
+ String commandFlag = commandParts[1];
+ String[] inputParts;
- for (int i = 1; i < commandParts.length; i++) {
- String part = commandParts[i];
- if (part.startsWith("-")) {
- currentOption = part;
- } else if (currentOption != null) {
- parameters.put(currentOption, part);
- currentOption = null;
- }
+ if (commandFlag.equals("-e")) {
+ inputParts = input.split("-e");
+ return new RemoveCommand(inputParts[1]);
+ } else if (commandFlag.equals("-p")) {
+ inputParts = input.split("(-p|-e)");
+ return new RemoveCommand(inputParts[1], inputParts[2]);
}
- // Extract event details from the parsed parameters
- String eventName = parameters.get("-e"); // Must be present
-
- return new RemoveCommand(eventName);
+ return new EchoCommand(input);
}
}
diff --git a/src/test/java/seedu/manager/parser/ParserTest.java b/src/test/java/seedu/manager/parser/ParserTest.java
index aa67aead73..43ca7f7e57 100644
--- a/src/test/java/seedu/manager/parser/ParserTest.java
+++ b/src/test/java/seedu/manager/parser/ParserTest.java
@@ -6,7 +6,6 @@
import seedu.manager.command.ExitCommand;
import seedu.manager.command.MenuCommand;
import seedu.manager.command.ListCommand;
-import seedu.manager.command.RemoveCommand;
import static org.junit.jupiter.api.Assertions.assertInstanceOf;
@@ -43,12 +42,4 @@ public void parseCommand_listWord_list() {
assertInstanceOf(ListCommand.class, command);
}
-
- @Test
- public void parseCommand_removeWord_add() {
- Parser parser = new Parser();
- Command command = parser.parseCommand("remove");
-
- assertInstanceOf(RemoveCommand.class, command);
- }
}
From fd62d6952d2a22f3aceb0f67cabc5f4dd4108c75 Mon Sep 17 00:00:00 2001
From: LTK-1606
Date: Sat, 12 Oct 2024 22:17:55 +0800
Subject: [PATCH 111/619] Update constant names to be clearer
---
src/main/java/seedu/manager/command/AddCommand.java | 8 ++++----
src/main/java/seedu/manager/event/EventList.java | 2 +-
2 files changed, 5 insertions(+), 5 deletions(-)
diff --git a/src/main/java/seedu/manager/command/AddCommand.java b/src/main/java/seedu/manager/command/AddCommand.java
index 6b3ed78e42..95f74dd320 100644
--- a/src/main/java/seedu/manager/command/AddCommand.java
+++ b/src/main/java/seedu/manager/command/AddCommand.java
@@ -6,8 +6,8 @@
*/
public class AddCommand extends Command {
public static final String COMMAND_WORD = "add";
- private static final String ADD_E_MESSAGE = "Event added successfully";
- private static final String ADD_P_MESSAGE = "Participant added successfully";
+ private static final String ADD_EVENT_MESSAGE = "Event added successfully";
+ private static final String ADD_PARTICIPANT_MESSAGE = "Participant added successfully";
protected String eventName;
protected String time;
protected String venue;
@@ -55,10 +55,10 @@ public AddCommand(String participantName, String eventName) {
public CommandOutput execute() {
if (participantName == null) {
this.eventList.addEvent(this.eventName, this.time, this.venue);
- return new CommandOutput(ADD_E_MESSAGE, false);
+ return new CommandOutput(ADD_EVENT_MESSAGE, false);
} else {
this.eventList.addParticipantToEvent(this.participantName, this.eventName);
- return new CommandOutput(ADD_P_MESSAGE, false);
+ return new CommandOutput(ADD_PARTICIPANT_MESSAGE, false);
}
}
}
diff --git a/src/main/java/seedu/manager/event/EventList.java b/src/main/java/seedu/manager/event/EventList.java
index 35a0f03acb..6bf5c2f813 100644
--- a/src/main/java/seedu/manager/event/EventList.java
+++ b/src/main/java/seedu/manager/event/EventList.java
@@ -95,7 +95,7 @@ public void addParticipantToEvent(String participantName, String eventName) {
for (Event event : eventList) {
if (event.getEventName().equals(eventName)) {
event.addParticipant(participantName);
- break;
+ return;
}
}
}
From 96accb9a520f7a2ad43c2c2ed505af21ed271464 Mon Sep 17 00:00:00 2001
From: jemehgoh
Date: Sat, 12 Oct 2024 22:31:25 +0800
Subject: [PATCH 112/619] Add an InvalidCommand class to handle invalid
commands
---
.../seedu/manager/command/InvalidCommand.java | 27 +++++++++++++++++++
1 file changed, 27 insertions(+)
create mode 100644 src/main/java/seedu/manager/command/InvalidCommand.java
diff --git a/src/main/java/seedu/manager/command/InvalidCommand.java b/src/main/java/seedu/manager/command/InvalidCommand.java
new file mode 100644
index 0000000000..760ba9ad40
--- /dev/null
+++ b/src/main/java/seedu/manager/command/InvalidCommand.java
@@ -0,0 +1,27 @@
+package seedu.manager.command;
+
+/**
+ * Represents an invalid command that cannot be executed
+ */
+public class InvalidCommand extends Command {
+ private String errorMessage;
+
+ /**
+ * Constructs a new invalid command with a given error message
+ *
+ * @param errorMessage The specified error message
+ */
+ public InvalidCommand(String errorMessage) {
+ this.errorMessage = errorMessage;
+ }
+
+ /**
+ * Returns a new command output with the error message
+ *
+ * @return A command output with the error message
+ */
+ @Override
+ public CommandOutput execute() {
+ return new CommandOutput(this.errorMessage, false);
+ }
+}
From b6c5983e5aeb5ae3a5f107542d39eaee97a1df22 Mon Sep 17 00:00:00 2001
From: jemehgoh
Date: Sat, 12 Oct 2024 22:52:57 +0800
Subject: [PATCH 113/619] Remove unused addEvent method
---
src/main/java/seedu/manager/event/EventList.java | 10 ----------
1 file changed, 10 deletions(-)
diff --git a/src/main/java/seedu/manager/event/EventList.java b/src/main/java/seedu/manager/event/EventList.java
index 0eea984628..70ff7d91e6 100644
--- a/src/main/java/seedu/manager/event/EventList.java
+++ b/src/main/java/seedu/manager/event/EventList.java
@@ -33,16 +33,6 @@ public int getListSize() {
return eventList.size();
}
- /**
- * Adds a new event to the event list.
- *
- * @param eventName The name of the event to be added.
- */
- public void addEvent(String eventName) {
- Event newEvent = new Event(eventName);
- eventList.add(newEvent);
- }
-
/**
* Adds a new event to the event list.
*
From 1eae1e07ded45ef242e23bfad713d242aaccda6f Mon Sep 17 00:00:00 2001
From: jemehgoh
Date: Sat, 12 Oct 2024 22:53:32 +0800
Subject: [PATCH 114/619] Replace instances of EchoCommand with InvalidCommand
---
.../seedu/manager/command/EchoCommand.java | 25 ------------------
.../seedu/manager/command/InvalidCommand.java | 2 +-
.../java/seedu/manager/parser/Parser.java | 26 ++++++++++++++-----
.../java/seedu/manager/parser/ParserTest.java | 6 ++---
4 files changed, 23 insertions(+), 36 deletions(-)
delete mode 100644 src/main/java/seedu/manager/command/EchoCommand.java
diff --git a/src/main/java/seedu/manager/command/EchoCommand.java b/src/main/java/seedu/manager/command/EchoCommand.java
deleted file mode 100644
index d2f3498544..0000000000
--- a/src/main/java/seedu/manager/command/EchoCommand.java
+++ /dev/null
@@ -1,25 +0,0 @@
-package seedu.manager.command;
-
-/**
- * Represents an executable echo command
- */
-public class EchoCommand extends Command {
- private final String userInput;
-
- /**
- * Constructs a new EchoCommand with the given user input
- *
- * @param userInput The user input
- */
- public EchoCommand(String userInput) {
- this.userInput = userInput;
- }
-
- /**
- * Returns the command output, with the user input as the output message
- */
- @Override
- public CommandOutput execute() {
- return new CommandOutput(this.userInput, false);
- }
-}
diff --git a/src/main/java/seedu/manager/command/InvalidCommand.java b/src/main/java/seedu/manager/command/InvalidCommand.java
index 760ba9ad40..bbaf2abf00 100644
--- a/src/main/java/seedu/manager/command/InvalidCommand.java
+++ b/src/main/java/seedu/manager/command/InvalidCommand.java
@@ -4,7 +4,7 @@
* Represents an invalid command that cannot be executed
*/
public class InvalidCommand extends Command {
- private String errorMessage;
+ private final String errorMessage;
/**
* Constructs a new invalid command with a given error message
diff --git a/src/main/java/seedu/manager/parser/Parser.java b/src/main/java/seedu/manager/parser/Parser.java
index 4509e3be72..77ba9a4da5 100644
--- a/src/main/java/seedu/manager/parser/Parser.java
+++ b/src/main/java/seedu/manager/parser/Parser.java
@@ -2,16 +2,29 @@
import seedu.manager.command.Command;
import seedu.manager.command.AddCommand;
+import seedu.manager.command.InvalidCommand;
import seedu.manager.command.RemoveCommand;
import seedu.manager.command.ExitCommand;
import seedu.manager.command.MenuCommand;
-import seedu.manager.command.EchoCommand;
import seedu.manager.command.ListCommand;
/**
* Represents the command parser for EventManagerCLI
*/
public class Parser {
+ private static final String INVALID_COMMAND_MESSAGE = "Invalid command!";
+ private static final String INVALID_ADD_MESSAGE = """
+ Invalid command!
+ Please enter your commands in the following format:
+ add -e EVENT_NAME
+ add -p PARTICIPANT_NAME -e EVENT_NAME
+ """;
+ private static final String INVALID_REMOVE_MESSAGE = """
+ Invalid command!
+ Please enter your commands in the following format:
+ remove -e EVENT_NAME
+ remove -p PARTICIPANT_NAME -e EVENT_NAME
+ """;
/**
* Returns a command based on the given user command string
@@ -33,9 +46,8 @@ public Command parseCommand(String command){
return new ExitCommand();
case MenuCommand.COMMAND_WORD:
return new MenuCommand();
-
default:
- return new EchoCommand(command);
+ return new InvalidCommand(INVALID_COMMAND_MESSAGE);
}
}
@@ -47,7 +59,7 @@ public Command parseCommand(String command){
* flag is {@code "-e"}, it splits the input string into parts to create an
* {@link AddCommand} for adding an event. If the command flag is {@code "-p"},
* it creates an {@link AddCommand} for adding a participant to an event. If neither
- * flag is matched, it returns an {@link EchoCommand} with the original input.
+ * flag is matched, it returns an {@link InvalidCommand} with an error message.
*
*
* @param input the input string containing the command details.
@@ -67,7 +79,7 @@ public Command parseAddCommand(String input, String[] commandParts) {
return new AddCommand(inputParts[1], inputParts[2]);
}
- return new EchoCommand(input);
+ return new InvalidCommand(INVALID_ADD_MESSAGE);
}
/**
@@ -78,7 +90,7 @@ public Command parseAddCommand(String input, String[] commandParts) {
* flag is {@code "-e"}, it splits the input string to create a {@link RemoveCommand}
* for removing an event. If the command flag is {@code "-p"}, it creates a
* {@link RemoveCommand} for removing a participant from an event. If neither flag
- * is matched, it returns an {@link EchoCommand} with the original input.
+ * is matched, it returns an {@link InvalidCommand} with an error message.
*
*
* @param input the input string containing the command details.
@@ -98,6 +110,6 @@ private Command parseRemoveCommand(String input, String[] commandParts) {
return new RemoveCommand(inputParts[1], inputParts[2]);
}
- return new EchoCommand(input);
+ return new InvalidCommand(INVALID_REMOVE_MESSAGE);
}
}
diff --git a/src/test/java/seedu/manager/parser/ParserTest.java b/src/test/java/seedu/manager/parser/ParserTest.java
index 43ca7f7e57..4fe1b0437b 100644
--- a/src/test/java/seedu/manager/parser/ParserTest.java
+++ b/src/test/java/seedu/manager/parser/ParserTest.java
@@ -2,8 +2,8 @@
import org.junit.jupiter.api.Test;
import seedu.manager.command.Command;
-import seedu.manager.command.EchoCommand;
import seedu.manager.command.ExitCommand;
+import seedu.manager.command.InvalidCommand;
import seedu.manager.command.MenuCommand;
import seedu.manager.command.ListCommand;
@@ -12,11 +12,11 @@
class ParserTest {
@Test
- public void parseCommand_nonEmptyString_echo() {
+ public void parseCommand_invalidString_invalid() {
Parser parser = new Parser();
Command command = parser.parseCommand("Hello world!");
- assertInstanceOf(EchoCommand.class, command);
+ assertInstanceOf(InvalidCommand.class, command);
}
@Test
From e998991d287ad3e5045c5d110191d77fc67f9912 Mon Sep 17 00:00:00 2001
From: jemehgoh
Date: Sat, 12 Oct 2024 23:37:07 +0800
Subject: [PATCH 115/619] Add exception handling for parseAddCommand and
parseRemoveCommand
---
.../java/seedu/manager/parser/Parser.java | 48 +++++++++++--------
1 file changed, 28 insertions(+), 20 deletions(-)
diff --git a/src/main/java/seedu/manager/parser/Parser.java b/src/main/java/seedu/manager/parser/Parser.java
index 77ba9a4da5..3fead07de5 100644
--- a/src/main/java/seedu/manager/parser/Parser.java
+++ b/src/main/java/seedu/manager/parser/Parser.java
@@ -68,18 +68,22 @@ public Command parseCommand(String command){
* @return a {@link Command} object representing the parsed command.
*/
public Command parseAddCommand(String input, String[] commandParts) {
- String commandFlag = commandParts[1];
- String[] inputParts;
+ try {
+ String commandFlag = commandParts[1];
+ String[] inputParts;
- if (commandFlag.equals("-e")) {
- inputParts = input.split("(-e|-t|-v)");
- return new AddCommand(inputParts[1], inputParts[2], inputParts[3]);
- } else if (commandFlag.equals("-p")) {
- inputParts = input.split("(-p|-e)");
- return new AddCommand(inputParts[1], inputParts[2]);
- }
+ if (commandFlag.equals("-e")) {
+ inputParts = input.split("(-e|-t|-v)");
+ return new AddCommand(inputParts[1], inputParts[2], inputParts[3]);
+ } else if (commandFlag.equals("-p")) {
+ inputParts = input.split("(-p|-e)");
+ return new AddCommand(inputParts[1], inputParts[2]);
+ }
- return new InvalidCommand(INVALID_ADD_MESSAGE);
+ return new InvalidCommand(INVALID_ADD_MESSAGE);
+ } catch (IndexOutOfBoundsException exception) {
+ return new InvalidCommand(INVALID_ADD_MESSAGE);
+ }
}
/**
@@ -99,17 +103,21 @@ public Command parseAddCommand(String input, String[] commandParts) {
* @return a {@link Command} object representing the parsed command.
*/
private Command parseRemoveCommand(String input, String[] commandParts) {
- String commandFlag = commandParts[1];
- String[] inputParts;
+ try {
+ String commandFlag = commandParts[1];
+ String[] inputParts;
- if (commandFlag.equals("-e")) {
- inputParts = input.split("-e");
- return new RemoveCommand(inputParts[1]);
- } else if (commandFlag.equals("-p")) {
- inputParts = input.split("(-p|-e)");
- return new RemoveCommand(inputParts[1], inputParts[2]);
- }
+ if (commandFlag.equals("-e")) {
+ inputParts = input.split("-e");
+ return new RemoveCommand(inputParts[1]);
+ } else if (commandFlag.equals("-p")) {
+ inputParts = input.split("(-p|-e)");
+ return new RemoveCommand(inputParts[1], inputParts[2]);
+ }
- return new InvalidCommand(INVALID_REMOVE_MESSAGE);
+ return new InvalidCommand(INVALID_REMOVE_MESSAGE);
+ } catch (IndexOutOfBoundsException exception) {
+ return new InvalidCommand(INVALID_REMOVE_MESSAGE);
+ }
}
}
From 4380a812e2cda1e002449f26e83c9d6afb9747ff Mon Sep 17 00:00:00 2001
From: jemehgoh
Date: Sun, 13 Oct 2024 00:43:21 +0800
Subject: [PATCH 116/619] Remove placeholder unit test
---
src/test/java/seedu/manager/DukeTest.java | 12 ------------
1 file changed, 12 deletions(-)
delete mode 100644 src/test/java/seedu/manager/DukeTest.java
diff --git a/src/test/java/seedu/manager/DukeTest.java b/src/test/java/seedu/manager/DukeTest.java
deleted file mode 100644
index 7b9f930b03..0000000000
--- a/src/test/java/seedu/manager/DukeTest.java
+++ /dev/null
@@ -1,12 +0,0 @@
-package seedu.manager;
-
-import static org.junit.jupiter.api.Assertions.assertTrue;
-
-import org.junit.jupiter.api.Test;
-
-class DukeTest {
- @Test
- public void sampleTest() {
- assertTrue(true);
- }
-}
From 60cac2b537567334d56a1801d4cc8ad980e41015 Mon Sep 17 00:00:00 2001
From: jemehgoh
Date: Sun, 13 Oct 2024 00:43:45 +0800
Subject: [PATCH 117/619] Update JUnit and text redirection tests
---
.../java/seedu/manager/parser/ParserTest.java | 34 +++++++++++++++++++
text-ui-test/EXPECTED.TXT | 2 +-
2 files changed, 35 insertions(+), 1 deletion(-)
diff --git a/src/test/java/seedu/manager/parser/ParserTest.java b/src/test/java/seedu/manager/parser/ParserTest.java
index 4fe1b0437b..b8fc075990 100644
--- a/src/test/java/seedu/manager/parser/ParserTest.java
+++ b/src/test/java/seedu/manager/parser/ParserTest.java
@@ -1,11 +1,13 @@
package seedu.manager.parser;
import org.junit.jupiter.api.Test;
+import seedu.manager.command.AddCommand;
import seedu.manager.command.Command;
import seedu.manager.command.ExitCommand;
import seedu.manager.command.InvalidCommand;
import seedu.manager.command.MenuCommand;
import seedu.manager.command.ListCommand;
+import seedu.manager.command.RemoveCommand;
import static org.junit.jupiter.api.Assertions.assertInstanceOf;
@@ -42,4 +44,36 @@ public void parseCommand_listWord_list() {
assertInstanceOf(ListCommand.class, command);
}
+
+ @Test
+ public void addCommand_addEvent_add() {
+ Parser parser = new Parser();
+ Command command = parser.parseCommand("add -e event -t 2024-09-10 -v Venue A");
+
+ assertInstanceOf(AddCommand.class, command);
+ }
+
+ @Test
+ public void addCommand_addNoParameter_invalid() {
+ Parser parser = new Parser();
+ Command command = parser.parseCommand("add");
+
+ assertInstanceOf(InvalidCommand.class, command);
+ }
+
+ @Test
+ public void removeCommand_removeEvent_add() {
+ Parser parser = new Parser();
+ Command command = parser.parseCommand("remove -e event");
+
+ assertInstanceOf(RemoveCommand.class, command);
+ }
+
+ @Test
+ public void removeCommand_removeNoParameter_invalid() {
+ Parser parser = new Parser();
+ Command command = parser.parseCommand("remove");
+
+ assertInstanceOf(InvalidCommand.class, command);
+ }
}
diff --git a/text-ui-test/EXPECTED.TXT b/text-ui-test/EXPECTED.TXT
index 786f0ac5f1..857e237f10 100644
--- a/text-ui-test/EXPECTED.TXT
+++ b/text-ui-test/EXPECTED.TXT
@@ -1,5 +1,5 @@
Welcome to EventManagerCLI.
-Enter a command: hello world
+Enter a command: Invalid command!
------------------------
Enter a command: Here are the possible commands:
From c5bd985362d4e963b0b7c7ef6e5ffdcae22b5d1c Mon Sep 17 00:00:00 2001
From: jemehgoh
Date: Sun, 13 Oct 2024 00:46:46 +0800
Subject: [PATCH 118/619] Update menu and error messages to follow correct
format for add
---
src/main/java/seedu/manager/command/MenuCommand.java | 4 ++--
src/main/java/seedu/manager/parser/Parser.java | 2 +-
2 files changed, 3 insertions(+), 3 deletions(-)
diff --git a/src/main/java/seedu/manager/command/MenuCommand.java b/src/main/java/seedu/manager/command/MenuCommand.java
index a7409ce763..8488296abd 100644
--- a/src/main/java/seedu/manager/command/MenuCommand.java
+++ b/src/main/java/seedu/manager/command/MenuCommand.java
@@ -8,10 +8,10 @@ public class MenuCommand extends Command {
private static final String MENU_MESSAGE = """
Here are the possible commands:
- add -e EVENT_NAME: Add an event to the event list.
+ add -e EVENT_NAME -d DATE -v VENUE: Add an event to the event list.
list: List events.
remove -e EVENT_NAME: Remove an event from the event list.
- add -p PARTICIPANT_NAME -e EVENT_NAME: Add a participant an event.
+ add -p PARTICIPANT_NAME -e EVENT_NAME: Add a participant to an event.
view -e EVENT_NAME: View the list of participants of an event.
remove -p PARTICIPANT_NAME -e EVENT_NAME: Remove a participant from an event.""";
diff --git a/src/main/java/seedu/manager/parser/Parser.java b/src/main/java/seedu/manager/parser/Parser.java
index 3fead07de5..eab1a9b4ff 100644
--- a/src/main/java/seedu/manager/parser/Parser.java
+++ b/src/main/java/seedu/manager/parser/Parser.java
@@ -16,7 +16,7 @@ public class Parser {
private static final String INVALID_ADD_MESSAGE = """
Invalid command!
Please enter your commands in the following format:
- add -e EVENT_NAME
+ add -e EVENT_NAME -d DATE -v VENUE
add -p PARTICIPANT_NAME -e EVENT_NAME
""";
private static final String INVALID_REMOVE_MESSAGE = """
From 885f01cd99574df0b232a200cc497cf626c81650 Mon Sep 17 00:00:00 2001
From: jemehgoh
Date: Sun, 13 Oct 2024 01:05:46 +0800
Subject: [PATCH 119/619] Update redirection tests and add command format in
messages
---
.../java/seedu/manager/command/MenuCommand.java | 2 +-
src/main/java/seedu/manager/parser/Parser.java | 8 +++-----
text-ui-test/EXPECTED.TXT | 15 +++++++++++++--
text-ui-test/input.txt | 3 +++
4 files changed, 20 insertions(+), 8 deletions(-)
diff --git a/src/main/java/seedu/manager/command/MenuCommand.java b/src/main/java/seedu/manager/command/MenuCommand.java
index 8488296abd..537b30cca6 100644
--- a/src/main/java/seedu/manager/command/MenuCommand.java
+++ b/src/main/java/seedu/manager/command/MenuCommand.java
@@ -8,7 +8,7 @@ public class MenuCommand extends Command {
private static final String MENU_MESSAGE = """
Here are the possible commands:
- add -e EVENT_NAME -d DATE -v VENUE: Add an event to the event list.
+ add -e EVENT_NAME -t TIME -v VENUE: Add an event to the event list.
list: List events.
remove -e EVENT_NAME: Remove an event from the event list.
add -p PARTICIPANT_NAME -e EVENT_NAME: Add a participant to an event.
diff --git a/src/main/java/seedu/manager/parser/Parser.java b/src/main/java/seedu/manager/parser/Parser.java
index eab1a9b4ff..d749adb254 100644
--- a/src/main/java/seedu/manager/parser/Parser.java
+++ b/src/main/java/seedu/manager/parser/Parser.java
@@ -16,15 +16,13 @@ public class Parser {
private static final String INVALID_ADD_MESSAGE = """
Invalid command!
Please enter your commands in the following format:
- add -e EVENT_NAME -d DATE -v VENUE
- add -p PARTICIPANT_NAME -e EVENT_NAME
- """;
+ add -e EVENT_NAME -t TIME -v VENUE
+ add -p PARTICIPANT_NAME -e EVENT_NAME""";
private static final String INVALID_REMOVE_MESSAGE = """
Invalid command!
Please enter your commands in the following format:
remove -e EVENT_NAME
- remove -p PARTICIPANT_NAME -e EVENT_NAME
- """;
+ remove -p PARTICIPANT_NAME -e EVENT_NAME""";
/**
* Returns a command based on the given user command string
diff --git a/text-ui-test/EXPECTED.TXT b/text-ui-test/EXPECTED.TXT
index 857e237f10..071047b826 100644
--- a/text-ui-test/EXPECTED.TXT
+++ b/text-ui-test/EXPECTED.TXT
@@ -3,15 +3,26 @@ Enter a command: Invalid command!
------------------------
Enter a command: Here are the possible commands:
-add -e EVENT_NAME: Add an event to the event list.
+add -e EVENT_NAME -t TIME -v VENUE: Add an event to the event list.
list: List events.
remove -e EVENT_NAME: Remove an event from the event list.
-add -p PARTICIPANT_NAME -e EVENT_NAME: Add a participant an event.
+add -p PARTICIPANT_NAME -e EVENT_NAME: Add a participant to an event.
view -e EVENT_NAME: View the list of participants of an event.
remove -p PARTICIPANT_NAME -e EVENT_NAME: Remove a participant from an event.
------------------------
Enter a command: There are 0 events in your list! Here are your scheduled events:
+------------------------
+Enter a command: Invalid command!
+Please enter your commands in the following format:
+add -e EVENT_NAME -t TIME -v VENUE
+add -p PARTICIPANT_NAME -e EVENT_NAME
+------------------------
+Enter a command: Event added successfully
+------------------------
+Enter a command: There are 1 events in your list! Here are your scheduled events:
+1. Event name: dinner party / Event time: 2024-10-10 / Event venue: Alice's House
+
------------------------
Enter a command: Thank you for using EventManagerCLI. Goodbye!
------------------------
diff --git a/text-ui-test/input.txt b/text-ui-test/input.txt
index 2ad37a2780..88bcfb3424 100644
--- a/text-ui-test/input.txt
+++ b/text-ui-test/input.txt
@@ -1,4 +1,7 @@
hello world
menu
list
+add
+add -e dinner party -t 2024-10-10 -v Alice's House
+list
exit
From e680a6f1642cade907a2341a6f312cb875c8054f Mon Sep 17 00:00:00 2001
From: glenn-chew
Date: Mon, 14 Oct 2024 13:20:47 +0800
Subject: [PATCH 120/619] Add ViewCommand class to display participant list of
an event
---
.../seedu/manager/command/ViewCommand.java | 45 +++++++++++++++++++
1 file changed, 45 insertions(+)
create mode 100644 src/main/java/seedu/manager/command/ViewCommand.java
diff --git a/src/main/java/seedu/manager/command/ViewCommand.java b/src/main/java/seedu/manager/command/ViewCommand.java
new file mode 100644
index 0000000000..895bee4d99
--- /dev/null
+++ b/src/main/java/seedu/manager/command/ViewCommand.java
@@ -0,0 +1,45 @@
+package seedu.manager.command;
+
+import seedu.manager.event.Event;
+
+public class ViewCommand extends Command{
+ public static final String COMMAND_WORD = "view";
+ private static final String VIEW_MESSAGE = "There are %d participants in %s! " +
+ "Here are your participants:";
+ protected String eventName;
+
+ /**
+ * Constructs an ViewCommand object with the for the specified event.
+ *
+ * @param eventName The name of the event to be viewed.
+ */
+ public ViewCommand(String eventName) {
+ this.eventName = eventName;
+ }
+
+ /**
+ * Returns a command output with a list message
+ *
+ * @return The command output with a list message
+ */
+ public CommandOutput execute() {
+ Event event = null;
+ for (int i = 0; i < eventList.getListSize(); i++) {
+ if (eventList.getEvent(i).getEventName().equals(eventName)) {
+ event = eventList.getEvent(i);
+ }
+ }
+
+ //to handle errors in the future
+
+ StringBuilder outputMessage = new StringBuilder(
+ String.format(VIEW_MESSAGE, event.getParticipantCount(), eventName) + "\n");
+ int count = 1;
+ for (String participant : event.getParticipantList()) {
+ outputMessage.append(String.format("%d. %s\n", count , participant));
+ count++;
+ }
+
+ return new CommandOutput(outputMessage.toString(), false);
+ }
+}
From f5a91c063c30252ceb3888f75d18aa53e53c5e99 Mon Sep 17 00:00:00 2001
From: glenn-chew
Date: Mon, 14 Oct 2024 13:26:11 +0800
Subject: [PATCH 121/619] Add getter to get participant list of an event
---
src/main/java/seedu/manager/event/Event.java | 4 ++++
1 file changed, 4 insertions(+)
diff --git a/src/main/java/seedu/manager/event/Event.java b/src/main/java/seedu/manager/event/Event.java
index b6a838b5a1..7fe389995c 100644
--- a/src/main/java/seedu/manager/event/Event.java
+++ b/src/main/java/seedu/manager/event/Event.java
@@ -93,6 +93,10 @@ public String getEventVenue() {
return eventVenue;
}
+ public ArrayList getParticipantList() {
+ return participantList;
+ }
+
/**
* Sets a new time for the event.
*
From 42c1719afc638de6e7fe5e7498b9d7f0280d31c4 Mon Sep 17 00:00:00 2001
From: glenn-chew
Date: Mon, 14 Oct 2024 13:27:06 +0800
Subject: [PATCH 122/619] Delete unused addEvent method
---
src/main/java/seedu/manager/event/EventList.java | 9 ---------
1 file changed, 9 deletions(-)
diff --git a/src/main/java/seedu/manager/event/EventList.java b/src/main/java/seedu/manager/event/EventList.java
index 0eea984628..8db75a1e46 100644
--- a/src/main/java/seedu/manager/event/EventList.java
+++ b/src/main/java/seedu/manager/event/EventList.java
@@ -33,15 +33,6 @@ public int getListSize() {
return eventList.size();
}
- /**
- * Adds a new event to the event list.
- *
- * @param eventName The name of the event to be added.
- */
- public void addEvent(String eventName) {
- Event newEvent = new Event(eventName);
- eventList.add(newEvent);
- }
/**
* Adds a new event to the event list.
From 15c3408c20f836f15c1801db80c53b4d5d91d719 Mon Sep 17 00:00:00 2001
From: glenn-chew
Date: Mon, 14 Oct 2024 13:55:12 +0800
Subject: [PATCH 123/619] Swap eventName and partcipationName parameters in
removeParticipantFromEvent
---
src/main/java/seedu/manager/command/RemoveCommand.java | 2 +-
1 file changed, 1 insertion(+), 1 deletion(-)
diff --git a/src/main/java/seedu/manager/command/RemoveCommand.java b/src/main/java/seedu/manager/command/RemoveCommand.java
index 814244fedc..05dedb8bbd 100644
--- a/src/main/java/seedu/manager/command/RemoveCommand.java
+++ b/src/main/java/seedu/manager/command/RemoveCommand.java
@@ -26,7 +26,7 @@ public RemoveCommand(String eventName) {
* @param eventName The name of the event the participant is to be removed from.
* @param participantName The name of the participant to be removed.
*/
- public RemoveCommand(String eventName, String participantName) {
+ public RemoveCommand(String participantName, String eventName) {
this.eventName = eventName;
this.participantName = participantName;
}
From 8e6908fba7dac28e1f5edb134e1d089d40759c52 Mon Sep 17 00:00:00 2001
From: glenn-chew
Date: Mon, 14 Oct 2024 13:55:39 +0800
Subject: [PATCH 124/619] Update Parser to handle view command
---
.../java/seedu/manager/parser/Parser.java | 33 +++++++++++++++++--
1 file changed, 31 insertions(+), 2 deletions(-)
diff --git a/src/main/java/seedu/manager/parser/Parser.java b/src/main/java/seedu/manager/parser/Parser.java
index 4509e3be72..45cdcd510e 100644
--- a/src/main/java/seedu/manager/parser/Parser.java
+++ b/src/main/java/seedu/manager/parser/Parser.java
@@ -7,6 +7,7 @@
import seedu.manager.command.MenuCommand;
import seedu.manager.command.EchoCommand;
import seedu.manager.command.ListCommand;
+import seedu.manager.command.ViewCommand;
/**
* Represents the command parser for EventManagerCLI
@@ -29,10 +30,12 @@ public Command parseCommand(String command){
return parseRemoveCommand(command, commandParts);
case ListCommand.COMMAND_WORD:
return new ListCommand();
- case ExitCommand.COMMAND_WORD:
- return new ExitCommand();
+ case ViewCommand.COMMAND_WORD:
+ return parseViewCommand(command, commandParts);
case MenuCommand.COMMAND_WORD:
return new MenuCommand();
+ case ExitCommand.COMMAND_WORD:
+ return new ExitCommand();
default:
return new EchoCommand(command);
@@ -100,4 +103,30 @@ private Command parseRemoveCommand(String input, String[] commandParts) {
return new EchoCommand(input);
}
+
+ /**
+ * Parses the input string to create a {@link Command} based on the provided command parts.
+ *
+ *
+ * This method checks the command flag extracted from the command parts. If the command
+ * flag is {@code "-e"}, it splits the input string to create a {@link ViewCommand}
+ * for viewing the participants in the event.
+ * Otherwise, it returns an {@link EchoCommand} with the original input.
+ *
+ *
+ * @param input the input string containing the command details.
+ * @param commandParts an array of strings representing the parsed command parts,
+ * where the second element is the command flag.
+ * @return a {@link Command} object representing the parsed command.
+ */
+ private Command parseViewCommand(String input, String[] commandParts) {
+ String commandFlag = commandParts[1];
+
+ if (commandFlag.equals("-e")) {
+ String [] inputParts = input.split("-e");
+ return new ViewCommand(inputParts[1].trim());
+ }
+
+ return new EchoCommand(input);
+ }
}
From 61536c43513d770148218dd0d6cbabf6a69d0bb0 Mon Sep 17 00:00:00 2001
From: glenn-chew
Date: Mon, 14 Oct 2024 13:56:08 +0800
Subject: [PATCH 125/619] Add JUnit test for ViewCommand
---
.../manager/command/ViewCommandTest.java | 21 +++++++++++++++++++
1 file changed, 21 insertions(+)
create mode 100644 src/test/java/seedu/manager/command/ViewCommandTest.java
diff --git a/src/test/java/seedu/manager/command/ViewCommandTest.java b/src/test/java/seedu/manager/command/ViewCommandTest.java
new file mode 100644
index 0000000000..f6356f4076
--- /dev/null
+++ b/src/test/java/seedu/manager/command/ViewCommandTest.java
@@ -0,0 +1,21 @@
+package seedu.manager.command;
+
+import org.junit.jupiter.api.Test;
+import seedu.manager.event.Event;
+import seedu.manager.event.EventList;
+
+import static org.junit.jupiter.api.Assertions.assertEquals;
+
+public class ViewCommandTest {
+ @Test
+ public void viewParticipant_success() {
+ EventList eventList = new EventList();
+
+ eventList.addEvent("Event 1", "2024-10-10 10:00", "Venue A");
+ eventList.addParticipantToEvent("Tom", "Event 1");
+
+ Event event = eventList.getEvent(0);
+ assertEquals("Tom", event.getParticipantList().get(0));
+ assertEquals(1, event.getParticipantCount());
+ }
+}
From a83758a94e81e6f742ca74ae3c167b850638064b Mon Sep 17 00:00:00 2001
From: glenn-chew
Date: Mon, 14 Oct 2024 15:38:01 +0800
Subject: [PATCH 126/619] Trim input parameters for AddCommand and
RemoveCommand in Parser
---
src/main/java/seedu/manager/parser/Parser.java | 10 +++++-----
1 file changed, 5 insertions(+), 5 deletions(-)
diff --git a/src/main/java/seedu/manager/parser/Parser.java b/src/main/java/seedu/manager/parser/Parser.java
index 45cdcd510e..529087ca22 100644
--- a/src/main/java/seedu/manager/parser/Parser.java
+++ b/src/main/java/seedu/manager/parser/Parser.java
@@ -64,10 +64,10 @@ public Command parseAddCommand(String input, String[] commandParts) {
if (commandFlag.equals("-e")) {
inputParts = input.split("(-e|-t|-v)");
- return new AddCommand(inputParts[1], inputParts[2], inputParts[3]);
+ return new AddCommand(inputParts[1].trim(), inputParts[2].trim(), inputParts[3].trim());
} else if (commandFlag.equals("-p")) {
inputParts = input.split("(-p|-e)");
- return new AddCommand(inputParts[1], inputParts[2]);
+ return new AddCommand(inputParts[1].trim(), inputParts[2].trim());
}
return new EchoCommand(input);
@@ -95,10 +95,10 @@ private Command parseRemoveCommand(String input, String[] commandParts) {
if (commandFlag.equals("-e")) {
inputParts = input.split("-e");
- return new RemoveCommand(inputParts[1]);
+ return new RemoveCommand(inputParts[1].trim());
} else if (commandFlag.equals("-p")) {
inputParts = input.split("(-p|-e)");
- return new RemoveCommand(inputParts[1], inputParts[2]);
+ return new RemoveCommand(inputParts[1].trim(), inputParts[2].trim());
}
return new EchoCommand(input);
@@ -124,7 +124,7 @@ private Command parseViewCommand(String input, String[] commandParts) {
if (commandFlag.equals("-e")) {
String [] inputParts = input.split("-e");
- return new ViewCommand(inputParts[1].trim());
+ return new ViewCommand(inputParts[1].trim());
}
return new EchoCommand(input);
From 2b4de4eea3101b972e5c96b3aa2ea91f9ab2ff80 Mon Sep 17 00:00:00 2001
From: glenn-chew
Date: Mon, 14 Oct 2024 16:07:53 +0800
Subject: [PATCH 127/619] Update JUnit test for view command
---
.../manager/command/ViewCommandTest.java | 37 +++++++++++++++----
1 file changed, 29 insertions(+), 8 deletions(-)
diff --git a/src/test/java/seedu/manager/command/ViewCommandTest.java b/src/test/java/seedu/manager/command/ViewCommandTest.java
index f6356f4076..0083a35be7 100644
--- a/src/test/java/seedu/manager/command/ViewCommandTest.java
+++ b/src/test/java/seedu/manager/command/ViewCommandTest.java
@@ -1,21 +1,42 @@
package seedu.manager.command;
+import org.junit.jupiter.api.BeforeEach;
import org.junit.jupiter.api.Test;
-import seedu.manager.event.Event;
import seedu.manager.event.EventList;
+import seedu.manager.parser.Parser;
import static org.junit.jupiter.api.Assertions.assertEquals;
+import static org.junit.jupiter.api.Assertions.assertFalse;
public class ViewCommandTest {
+
+ private Command viewCommand;
+ private static EventList eventList = new EventList();
+
+ @BeforeEach
+ public void setUp() {
+ Command command;
+
+ command = new Parser().parseCommand("add -e Event 1 -t 2024-10-10 10:00 -v Venue A");
+ command.setData(eventList);
+ command.execute();
+
+ command = new Parser().parseCommand("add -p Tom -e Event 1");
+ command.setData(eventList);
+ command.execute();
+
+ viewCommand = new Parser().parseCommand("view -e Event 1");
+ viewCommand.setData(eventList);
+ }
+
@Test
- public void viewParticipant_success() {
- EventList eventList = new EventList();
+ public void execute_twoEvents_success() {
+ CommandOutput result = viewCommand.execute();
- eventList.addEvent("Event 1", "2024-10-10 10:00", "Venue A");
- eventList.addParticipantToEvent("Tom", "Event 1");
+ String expectedMessage = "There are 1 participants in Event 1! Here are your participants:\n"
+ + "1. Tom\n";
- Event event = eventList.getEvent(0);
- assertEquals("Tom", event.getParticipantList().get(0));
- assertEquals(1, event.getParticipantCount());
+ assertEquals(expectedMessage, result.getMessage());
+ assertFalse(result.getCanExit());
}
}
From ba6d2462ef98a6ba0e337f483015f9dd4d4161ce Mon Sep 17 00:00:00 2001
From: glenn-chew
Date: Mon, 14 Oct 2024 16:28:25 +0800
Subject: [PATCH 128/619] Add JavaDoc header for ViewCommand class
---
src/main/java/seedu/manager/command/ViewCommand.java | 4 ++++
1 file changed, 4 insertions(+)
diff --git a/src/main/java/seedu/manager/command/ViewCommand.java b/src/main/java/seedu/manager/command/ViewCommand.java
index 895bee4d99..3a16dd1e59 100644
--- a/src/main/java/seedu/manager/command/ViewCommand.java
+++ b/src/main/java/seedu/manager/command/ViewCommand.java
@@ -2,6 +2,10 @@
import seedu.manager.event.Event;
+/**
+ * Represents a command to view the list of participants in an event.
+ * The view command will search for an event by its name and display all its participants if found.
+ */
public class ViewCommand extends Command{
public static final String COMMAND_WORD = "view";
private static final String VIEW_MESSAGE = "There are %d participants in %s! " +
From eb6211f45ba0bba2701c105460c61a2b7169409c Mon Sep 17 00:00:00 2001
From: glenn-chew
Date: Mon, 14 Oct 2024 17:15:44 +0800
Subject: [PATCH 129/619] Fix JavaDoc comment indentation
---
src/main/java/seedu/manager/parser/Parser.java | 4 ++--
1 file changed, 2 insertions(+), 2 deletions(-)
diff --git a/src/main/java/seedu/manager/parser/Parser.java b/src/main/java/seedu/manager/parser/Parser.java
index babf300b04..3b5ec6b042 100644
--- a/src/main/java/seedu/manager/parser/Parser.java
+++ b/src/main/java/seedu/manager/parser/Parser.java
@@ -123,8 +123,8 @@ private Command parseRemoveCommand(String input, String[] commandParts) {
}
}
- /**
- * Parses the input string to create a {@link Command} based on the provided command parts.
+ /**
+ * Parses the input string to create a {@link Command} based on the provided command parts.
*
*
* This method checks the command flag extracted from the command parts. If the command
From 4151a3230f950a426ffe0a9d18bcd62d81b640ea Mon Sep 17 00:00:00 2001
From: glenn-chew
Date: Mon, 14 Oct 2024 17:16:27 +0800
Subject: [PATCH 130/619] Swap order of declaration of static and non-static
variable
---
src/test/java/seedu/manager/command/ViewCommandTest.java | 2 +-
1 file changed, 1 insertion(+), 1 deletion(-)
diff --git a/src/test/java/seedu/manager/command/ViewCommandTest.java b/src/test/java/seedu/manager/command/ViewCommandTest.java
index 0083a35be7..7fef43e4af 100644
--- a/src/test/java/seedu/manager/command/ViewCommandTest.java
+++ b/src/test/java/seedu/manager/command/ViewCommandTest.java
@@ -10,8 +10,8 @@
public class ViewCommandTest {
- private Command viewCommand;
private static EventList eventList = new EventList();
+ private Command viewCommand;
@BeforeEach
public void setUp() {
From 7b3a4ec8c7150f91378df8700578b38a3c53ecee Mon Sep 17 00:00:00 2001
From: glenn-chew
Date: Mon, 14 Oct 2024 17:23:49 +0800
Subject: [PATCH 131/619] Edit Event toString message format
---
src/main/java/seedu/manager/event/Event.java | 2 +-
1 file changed, 1 insertion(+), 1 deletion(-)
diff --git a/src/main/java/seedu/manager/event/Event.java b/src/main/java/seedu/manager/event/Event.java
index 7fe389995c..5e4a72cbea 100644
--- a/src/main/java/seedu/manager/event/Event.java
+++ b/src/main/java/seedu/manager/event/Event.java
@@ -122,6 +122,6 @@ public void setEventVenue(String eventVenue) {
*/
@Override
public String toString(){
- return "Event name: " + eventName + "/ Event time: " + eventTime + "/ Event venue: " + eventVenue;
+ return "Event name: " + eventName + " / Event time: " + eventTime + " / Event venue: " + eventVenue;
}
}
From a16f47182d1ca28c98ec6d1a7913d2f4b7dfb035 Mon Sep 17 00:00:00 2001
From: glenn-chew
Date: Mon, 14 Oct 2024 17:24:33 +0800
Subject: [PATCH 132/619] Update JUnit tests for ListCommand with new toString
message
---
src/test/java/seedu/manager/command/ListCommandTest.java | 4 ++--
1 file changed, 2 insertions(+), 2 deletions(-)
diff --git a/src/test/java/seedu/manager/command/ListCommandTest.java b/src/test/java/seedu/manager/command/ListCommandTest.java
index 96617e25b0..256b26eb3d 100644
--- a/src/test/java/seedu/manager/command/ListCommandTest.java
+++ b/src/test/java/seedu/manager/command/ListCommandTest.java
@@ -27,8 +27,8 @@ public void execute_twoEvents_success() {
CommandOutput result = listCommand.execute();
String expectedMessage = "There are 2 events in your list! Here are your scheduled events:\n"
- + "1. Event name: Event 1/ Event time: 2024-10-10 10:00/ Event venue: Venue A\n"
- + "2. Event name: Event 2/ Event time: 2024-11-11 12:00/ Event venue: Venue B\n";
+ + "1. Event name: Event 1 / Event time: 2024-10-10 10:00 / Event venue: Venue A\n"
+ + "2. Event name: Event 2 / Event time: 2024-11-11 12:00 / Event venue: Venue B\n";
assertEquals(expectedMessage, result.getMessage());
assertFalse(result.getCanExit());
From 6ee2135289468bc987d74542e858583f9d27af26 Mon Sep 17 00:00:00 2001
From: glenn-chew
Date: Mon, 14 Oct 2024 17:25:11 +0800
Subject: [PATCH 133/619] Update expected test output for new Event toString
message
---
text-ui-test/EXPECTED.TXT | 2 +-
1 file changed, 1 insertion(+), 1 deletion(-)
diff --git a/text-ui-test/EXPECTED.TXT b/text-ui-test/EXPECTED.TXT
index 071047b826..a40a397bd8 100644
--- a/text-ui-test/EXPECTED.TXT
+++ b/text-ui-test/EXPECTED.TXT
@@ -21,7 +21,7 @@ add -p PARTICIPANT_NAME -e EVENT_NAME
Enter a command: Event added successfully
------------------------
Enter a command: There are 1 events in your list! Here are your scheduled events:
-1. Event name: dinner party / Event time: 2024-10-10 / Event venue: Alice's House
+1. Event name: dinner party / Event time: 2024-10-10 / Event venue: Alice's House
------------------------
Enter a command: Thank you for using EventManagerCLI. Goodbye!
From 538436750653e0c9fd70769d786aae9a11083e30 Mon Sep 17 00:00:00 2001
From: jemehgoh
Date: Mon, 14 Oct 2024 21:52:24 +0800
Subject: [PATCH 134/619] Change parseViewCommand to have its own error message
---
src/main/java/seedu/manager/parser/Parser.java | 8 ++++++--
1 file changed, 6 insertions(+), 2 deletions(-)
diff --git a/src/main/java/seedu/manager/parser/Parser.java b/src/main/java/seedu/manager/parser/Parser.java
index 3b5ec6b042..d39b8acb5a 100644
--- a/src/main/java/seedu/manager/parser/Parser.java
+++ b/src/main/java/seedu/manager/parser/Parser.java
@@ -24,6 +24,10 @@ public class Parser {
Please enter your commands in the following format:
remove -e EVENT_NAME
remove -p PARTICIPANT_NAME -e EVENT_NAME""";
+ private static final String INVALID_VIEW_MESSAGE = """
+ Invalid command!
+ Please enter your commands in the following format:
+ view -e EVENT_NAME""";
/**
* Returns a command based on the given user command string
@@ -147,9 +151,9 @@ private Command parseViewCommand(String input, String[] commandParts) {
return new ViewCommand(inputParts[1].trim());
}
- return new InvalidCommand(INVALID_REMOVE_MESSAGE);
+ return new InvalidCommand(INVALID_VIEW_MESSAGE);
} catch (IndexOutOfBoundsException exception) {
- return new InvalidCommand(INVALID_REMOVE_MESSAGE);
+ return new InvalidCommand(INVALID_VIEW_MESSAGE);
}
}
}
From d79068ab45e6782c4cbb51b36311f7700bba53d3 Mon Sep 17 00:00:00 2001
From: jemehgoh
Date: Mon, 14 Oct 2024 21:58:15 +0800
Subject: [PATCH 135/619] Add error handling for view command
---
.../seedu/manager/command/ViewCommand.java | 37 ++++++++++---------
.../java/seedu/manager/event/EventList.java | 22 ++++++++++-
2 files changed, 39 insertions(+), 20 deletions(-)
diff --git a/src/main/java/seedu/manager/command/ViewCommand.java b/src/main/java/seedu/manager/command/ViewCommand.java
index 3a16dd1e59..4d56e1973c 100644
--- a/src/main/java/seedu/manager/command/ViewCommand.java
+++ b/src/main/java/seedu/manager/command/ViewCommand.java
@@ -2,14 +2,18 @@
import seedu.manager.event.Event;
+import java.util.Optional;
+
/**
* Represents a command to view the list of participants in an event.
* The view command will search for an event by its name and display all its participants if found.
*/
-public class ViewCommand extends Command{
+public class ViewCommand extends Command {
public static final String COMMAND_WORD = "view";
private static final String VIEW_MESSAGE = "There are %d participants in %s! " +
"Here are your participants:";
+ private static final String INVALID_EVENT_MESSAGE = "Event not found!";
+
protected String eventName;
/**
@@ -22,28 +26,25 @@ public ViewCommand(String eventName) {
}
/**
- * Returns a command output with a list message
+ * Returns a command output with a view message
*
- * @return The command output with a list message
+ * @return The command output with a view message
*/
public CommandOutput execute() {
- Event event = null;
- for (int i = 0; i < eventList.getListSize(); i++) {
- if (eventList.getEvent(i).getEventName().equals(eventName)) {
- event = eventList.getEvent(i);
- }
- }
+ Optional eventToView = eventList.getEventByName(this.eventName);
- //to handle errors in the future
+ if (eventToView.isPresent()) {
+ StringBuilder outputMessage = new StringBuilder(
+ String.format(VIEW_MESSAGE, eventToView.get().getParticipantCount(), eventName) + "\n");
+ int count = 1;
+ for (String participant : eventToView.get().getParticipantList()) {
+ outputMessage.append(String.format("%d. %s\n", count, participant));
+ count++;
+ }
- StringBuilder outputMessage = new StringBuilder(
- String.format(VIEW_MESSAGE, event.getParticipantCount(), eventName) + "\n");
- int count = 1;
- for (String participant : event.getParticipantList()) {
- outputMessage.append(String.format("%d. %s\n", count , participant));
- count++;
+ return new CommandOutput(outputMessage.toString(), false);
+ } else {
+ return new CommandOutput(INVALID_EVENT_MESSAGE, false);
}
-
- return new CommandOutput(outputMessage.toString(), false);
}
}
diff --git a/src/main/java/seedu/manager/event/EventList.java b/src/main/java/seedu/manager/event/EventList.java
index 70ff7d91e6..71a02ca1e9 100644
--- a/src/main/java/seedu/manager/event/EventList.java
+++ b/src/main/java/seedu/manager/event/EventList.java
@@ -1,6 +1,7 @@
package seedu.manager.event;
import java.util.ArrayList;
+import java.util.Optional;
/**
@@ -58,6 +59,23 @@ public Event getEvent(int index) {
return eventList.get(index);
}
+ /**
+ * Returns an event in the event list with a specified name.
+ * Returns null if the event is not found.
+ *
+ * @param eventName The specified name
+ * @return the event with a specified name, or null if the event is not found
+ */
+ public Optional getEventByName(String eventName) {
+ for (Event event : eventList) {
+ if (event.getEventName().equals(eventName)) {
+ return Optional.of(event);
+ }
+ }
+
+ return Optional.empty();
+ }
+
/**
* Removes an event from the event list by its name.
*
@@ -69,10 +87,10 @@ public boolean removeEvent(String eventName) {
for (Event event : eventList) {
if (event.getEventName().equals(eventName)) {
eventList.remove(event);
- return true; // Event found and removed
+ return true;
}
}
- return false; // Event not found
+ return false;
}
/**
From a9d8c164c6e634341623eb14e5821c9bfcd9cf20 Mon Sep 17 00:00:00 2001
From: jemehgoh
Date: Tue, 15 Oct 2024 19:11:12 +0800
Subject: [PATCH 136/619] Update user guide
---
docs/UserGuide.md | 70 +++++++++++++++++++++++++++++++++++++++--------
1 file changed, 59 insertions(+), 11 deletions(-)
diff --git a/docs/UserGuide.md b/docs/UserGuide.md
index a9b21e76d6..27d01020fc 100644
--- a/docs/UserGuide.md
+++ b/docs/UserGuide.md
@@ -8,7 +8,7 @@ the participants and logistics of such events.
## Quick Start
1. Ensure that you have Java 17 or above installed.
-2. Down the latest version of `EventManagerCLI` from [here](http://link.to/duke).
+2. Down the latest version of `EventManagerCLI` from [here](https://github.com/AY2425S1-CS2113-W13-3/tp/releases).
3. Open a new terminal in the folder that you put the JAR file in, and run the program with the
command ```java -jar EventManagerCLI.jar```.
The following message would be printed:
@@ -19,21 +19,69 @@ Enter a command:
## Features
-{Give detailed description of each feature}
+### Viewing the command list: `menu`
+Shows a list of all valid user commands in the program.
-### Exiting the program: `exit`
-Exits the program.
+```
+Here are the possible commands:
-Format: `exit`
+add -e EVENT_NAME -t TIME -v VENUE: Add an event to the event list.
+list: List events.
+remove -e EVENT_NAME: Remove an event from the event list.
+add -p PARTICIPANT_NAME -e EVENT_NAME: Add a participant to an event.
+view -e EVENT_NAME: View the list of participants of an event.
+remove -p PARTICIPANT_NAME -e EVENT_NAME: Remove a participant from an event.
+```
-## FAQ
+Format: `menu`
-**Q**: How do I transfer my data to another computer?
+### List all events: `list`
+Shows a list of all events currently stored in the program.
-**A**: {your answer here}
+Format: `list`
-## Command Summary
+### Add an event or participant: `add`
+Adds an event to the event list, or a participant to an event.
+
+Format:
+* `add -e EVENT_NAME -t TIME -v VENUE` for adding an event to the events list.
+* `add -p PARTICIPANT_NAME -e EVENT_NAME` for adding a participant to an event.
+
+Examples:
+* `add -e Origami workshop -t Mon 1600-1800 -v Building A` adds an event with name `Origami workshop`,
+time `Mon 1600-1800` and venue `Building A` to the events list.
+* `add -p John Tan -e Origami workshop` adds a participant `John Tan` to the event `Origami workshop`.
+
+### Remove an event or participant: `remove`
+Removes an event from the event list, or a participant from an event.
+
+Format:
+* `remove -e EVENT_NAME` for removing an event from the event list.
+* `remove -p PARTICIPANT_NAME -e EVENT_NAME` for removing a participant from an event.
-{Give a 'cheat sheet' of commands here}
+Examples:
+* `remove -e Origami workshop` removes the event `Origami workshop` from the event list.
+* `remove -p John Tan -e Origami workshop` removes the participant `John Tan` from the event `Origami workshop`.
+
+### View all participants for an event: `view`
+Shows a list of all participants for an event.
+
+Format: `view -e EVENT_NAME`
+
+Examples:
+* `view -e Origami workshop` shows a list of all participants for the event `Origami workshop`.
+
+### Exiting the program: `exit`
+Exits the program.
+
+Format: `exit`
+
+## Command Summary
-* Exit program `exit`
+* View all commands: `view`
+* List all events: `list`
+* Add event: `add -e EVENT_NAME -t TIME -v VENUE`
+* Add participant to an event: `add -p PARTICIPANT_NAME -e EVENT_NAME`
+* Remove event: `remove -e EVENT_NAME`
+* Remove participant from an event: `remove -p PARTICIPANT_NAME -e EVENT_NAME`
+* View all participants for an event: `view -e EVENT_NAME`
From c500306bfe6e694f599231d0c9752b03ecc80fa2 Mon Sep 17 00:00:00 2001
From: jemehgoh
Date: Thu, 17 Oct 2024 08:01:17 +0800
Subject: [PATCH 137/619] Ignore manifest file
---
.gitignore | 1 +
1 file changed, 1 insertion(+)
diff --git a/.gitignore b/.gitignore
index 2873e189e1..621af74393 100644
--- a/.gitignore
+++ b/.gitignore
@@ -15,3 +15,4 @@ bin/
/text-ui-test/ACTUAL.TXT
text-ui-test/EXPECTED-UNIX.TXT
+src/main/java/META-INF/MANIFEST.MF
From 8c7b263cd6a7ef77e32dfe75d92591746ba1ae3b Mon Sep 17 00:00:00 2001
From: jemehgoh
Date: Thu, 17 Oct 2024 08:39:22 +0800
Subject: [PATCH 138/619] Update Command to include functionality of
CommandOutput
---
.../java/seedu/manager/command/Command.java | 38 ++++++++++++++++++-
1 file changed, 36 insertions(+), 2 deletions(-)
diff --git a/src/main/java/seedu/manager/command/Command.java b/src/main/java/seedu/manager/command/Command.java
index ff043be18c..836d5b1c76 100644
--- a/src/main/java/seedu/manager/command/Command.java
+++ b/src/main/java/seedu/manager/command/Command.java
@@ -7,13 +7,47 @@
*/
public abstract class Command {
protected EventList eventList;
+ protected String message;
+ protected boolean canExit;
+ /**
+ * Constructs a new Command with whether the program can be exited from
+ *
+ * @param canExit whether the program can be exited from
+ */
+ protected Command(boolean canExit) {
+ this.canExit = canExit;
+ }
+
+ /**
+ * Sets the command's event list to a specified event list
+ *
+ * @param events the specified event list
+ */
public void setData(EventList events) {
this.eventList = events;
}
/**
- * Returns the output of the executable command
+ * Executes the command
+ */
+ public abstract void execute();
+
+ /**
+ * Returns the command's message
+ *
+ * @return the command's message
+ */
+ public String getMessage() {
+ return this.message;
+ }
+
+ /**
+ * Returns true if the program can be exited from, returns false otherwise
+ *
+ * @return true if the program can be exited from, false otherwise
*/
- public abstract CommandOutput execute();
+ public boolean getCanExit() {
+ return canExit;
+ }
}
From e638e7eb23183737710272b9cf0ac97d93d877ee Mon Sep 17 00:00:00 2001
From: jemehgoh
Date: Thu, 17 Oct 2024 08:39:53 +0800
Subject: [PATCH 139/619] Update child classes of Command with new
functionality
---
.../java/seedu/manager/command/AddCommand.java | 11 +++++------
.../java/seedu/manager/command/ExitCommand.java | 15 ++++++++++-----
.../seedu/manager/command/InvalidCommand.java | 9 ++++-----
.../java/seedu/manager/command/ListCommand.java | 15 ++++++++++-----
.../java/seedu/manager/command/MenuCommand.java | 15 ++++++++++-----
.../java/seedu/manager/command/RemoveCommand.java | 15 +++++++--------
.../java/seedu/manager/command/ViewCommand.java | 11 +++++------
7 files changed, 51 insertions(+), 40 deletions(-)
diff --git a/src/main/java/seedu/manager/command/AddCommand.java b/src/main/java/seedu/manager/command/AddCommand.java
index 95f74dd320..ec379908d3 100644
--- a/src/main/java/seedu/manager/command/AddCommand.java
+++ b/src/main/java/seedu/manager/command/AddCommand.java
@@ -21,6 +21,7 @@ public class AddCommand extends Command {
* @param venue The venue of the event to be added.
*/
public AddCommand(String eventName, String time, String venue) {
+ super(false);
this.eventName = eventName;
this.time = time;
this.venue = venue;
@@ -35,6 +36,7 @@ public AddCommand(String eventName, String time, String venue) {
* or the event to be created if no participant name is provided.
*/
public AddCommand(String participantName, String eventName) {
+ super(false);
this.participantName = participantName;
this.eventName = eventName;
}
@@ -47,18 +49,15 @@ public AddCommand(String participantName, String eventName) {
* If a participant name is provided, it will add the participant to the
* specified event in the event list.
*
- *
- * @return a {@link CommandOutput} object containing a message about the result of the execution.
- * The message indicates whether an event or participant was successfully added.
*/
@Override
- public CommandOutput execute() {
+ public void execute() {
if (participantName == null) {
this.eventList.addEvent(this.eventName, this.time, this.venue);
- return new CommandOutput(ADD_EVENT_MESSAGE, false);
+ this.message = ADD_EVENT_MESSAGE;
} else {
this.eventList.addParticipantToEvent(this.participantName, this.eventName);
- return new CommandOutput(ADD_PARTICIPANT_MESSAGE, false);
+ this.message = ADD_PARTICIPANT_MESSAGE;
}
}
}
diff --git a/src/main/java/seedu/manager/command/ExitCommand.java b/src/main/java/seedu/manager/command/ExitCommand.java
index 3b0c384d14..1db9224fc6 100644
--- a/src/main/java/seedu/manager/command/ExitCommand.java
+++ b/src/main/java/seedu/manager/command/ExitCommand.java
@@ -8,11 +8,16 @@ public class ExitCommand extends Command {
private static final String EXIT_MESSAGE = "Thank you for using EventManagerCLI. Goodbye!";
/**
- * Returns a command output with an exit message
- *
- * @return The command output with an exit message
+ * Constructs a new ExitCommand
*/
- public CommandOutput execute() {
- return new CommandOutput(EXIT_MESSAGE, true);
+ public ExitCommand() {
+ super(true);
+ }
+
+ /**
+ * Executes the exit command
+ */
+ public void execute() {
+ this.message = EXIT_MESSAGE;
}
}
diff --git a/src/main/java/seedu/manager/command/InvalidCommand.java b/src/main/java/seedu/manager/command/InvalidCommand.java
index bbaf2abf00..b3a97be87f 100644
--- a/src/main/java/seedu/manager/command/InvalidCommand.java
+++ b/src/main/java/seedu/manager/command/InvalidCommand.java
@@ -12,16 +12,15 @@ public class InvalidCommand extends Command {
* @param errorMessage The specified error message
*/
public InvalidCommand(String errorMessage) {
+ super(false);
this.errorMessage = errorMessage;
}
/**
- * Returns a new command output with the error message
- *
- * @return A command output with the error message
+ * Executes the invalid command
*/
@Override
- public CommandOutput execute() {
- return new CommandOutput(this.errorMessage, false);
+ public void execute() {
+ this.message = this.errorMessage;
}
}
diff --git a/src/main/java/seedu/manager/command/ListCommand.java b/src/main/java/seedu/manager/command/ListCommand.java
index fb1cc6c4e9..dffb4c6a7e 100644
--- a/src/main/java/seedu/manager/command/ListCommand.java
+++ b/src/main/java/seedu/manager/command/ListCommand.java
@@ -7,16 +7,21 @@ public class ListCommand extends Command {
"Here are your scheduled events:";
/**
- * Returns a command output with a list message
- *
- * @return The command output with a list message
+ * Constructs a new ListCommand
*/
- public CommandOutput execute() {
+ public ListCommand() {
+ super(false);
+ }
+
+ /**
+ * Executes the ListCommand by getting a list of all events
+ */
+ public void execute() {
StringBuilder outputMessage = new StringBuilder(String.format(LIST_MESSAGE, eventList.getListSize()) + "\n");
for (int i = 0; i < eventList.getListSize(); i++) {
outputMessage.append(String.format("%d. %s\n", i + 1, eventList.getEvent(i).toString()));
}
- return new CommandOutput(outputMessage.toString(), false);
+ this.message = outputMessage.toString();
}
}
diff --git a/src/main/java/seedu/manager/command/MenuCommand.java b/src/main/java/seedu/manager/command/MenuCommand.java
index 537b30cca6..969313c18c 100644
--- a/src/main/java/seedu/manager/command/MenuCommand.java
+++ b/src/main/java/seedu/manager/command/MenuCommand.java
@@ -16,12 +16,17 @@ public class MenuCommand extends Command {
remove -p PARTICIPANT_NAME -e EVENT_NAME: Remove a participant from an event.""";
/**
- * Returns a command output with the menu message
- *
- * @return The command output with the menu message
+ * Constructs a new MenuCommand
+ */
+ public MenuCommand() {
+ super(false);
+ }
+
+ /**
+ * Executes the menu command
*/
@Override
- public CommandOutput execute() {
- return new CommandOutput(MENU_MESSAGE, false);
+ public void execute() {
+ this.message = MENU_MESSAGE;
}
}
diff --git a/src/main/java/seedu/manager/command/RemoveCommand.java b/src/main/java/seedu/manager/command/RemoveCommand.java
index 05dedb8bbd..c66f9cc292 100644
--- a/src/main/java/seedu/manager/command/RemoveCommand.java
+++ b/src/main/java/seedu/manager/command/RemoveCommand.java
@@ -17,6 +17,7 @@ public class RemoveCommand extends Command {
* @param eventName The name of the event to be removed.
*/
public RemoveCommand(String eventName) {
+ super(false);
this.eventName = eventName;
}
@@ -27,6 +28,7 @@ public RemoveCommand(String eventName) {
* @param participantName The name of the participant to be removed.
*/
public RemoveCommand(String participantName, String eventName) {
+ super(false);
this.eventName = eventName;
this.participantName = participantName;
}
@@ -37,15 +39,12 @@ public RemoveCommand(String participantName, String eventName) {
*
* If no participant name is provided, this method attempts to remove the event
* specified by the event name. If a participant name is provided, it tries to
- * remove that participant from the specified event. The result of the operation
- * is indicated by the return value.
+ * remove that participant from the specified event. The command's message is then
+ * set depending on whether the removal was successful or failed.
*
- *
- * @return a {@link CommandOutput} object containing a message indicating
- * whether the removal was successful or failed.
*/
@Override
- public CommandOutput execute() {
+ public void execute() {
boolean isRemoved;
if (participantName == null) {
@@ -55,9 +54,9 @@ public CommandOutput execute() {
}
if (isRemoved) {
- return new CommandOutput(REMOVE_SUCCESS, false);
+ this.message = REMOVE_SUCCESS;
} else {
- return new CommandOutput(REMOVE_FAILURE, false);
+ this.message = REMOVE_FAILURE;
}
}
}
diff --git a/src/main/java/seedu/manager/command/ViewCommand.java b/src/main/java/seedu/manager/command/ViewCommand.java
index 4d56e1973c..1a264658b2 100644
--- a/src/main/java/seedu/manager/command/ViewCommand.java
+++ b/src/main/java/seedu/manager/command/ViewCommand.java
@@ -22,15 +22,14 @@ public class ViewCommand extends Command {
* @param eventName The name of the event to be viewed.
*/
public ViewCommand(String eventName) {
+ super(false);
this.eventName = eventName;
}
/**
- * Returns a command output with a view message
- *
- * @return The command output with a view message
+ * Executes the command to view the participants for an event.
*/
- public CommandOutput execute() {
+ public void execute() {
Optional eventToView = eventList.getEventByName(this.eventName);
if (eventToView.isPresent()) {
@@ -42,9 +41,9 @@ public CommandOutput execute() {
count++;
}
- return new CommandOutput(outputMessage.toString(), false);
+ this.message = outputMessage.toString();
} else {
- return new CommandOutput(INVALID_EVENT_MESSAGE, false);
+ this.message = INVALID_EVENT_MESSAGE;
}
}
}
From 36b22e5113dc305943062095109b08ea1dd3e0b0 Mon Sep 17 00:00:00 2001
From: jemehgoh
Date: Thu, 17 Oct 2024 08:40:14 +0800
Subject: [PATCH 140/619] Update Main and Ui to have new functionality
---
src/main/java/seedu/manager/Main.java | 6 +++---
src/main/java/seedu/manager/ui/Ui.java | 7 ++++---
2 files changed, 7 insertions(+), 6 deletions(-)
diff --git a/src/main/java/seedu/manager/Main.java b/src/main/java/seedu/manager/Main.java
index 08e432df4e..ab8d247b38 100644
--- a/src/main/java/seedu/manager/Main.java
+++ b/src/main/java/seedu/manager/Main.java
@@ -31,10 +31,10 @@ private static void runCommandLoop() {
String userCommandText = ui.getCommand();
command = new Parser().parseCommand(userCommandText);
command.setData(events);
- CommandOutput output = command.execute();
- ui.showOutputToUser(output);
+ command.execute();
+ ui.showOutputToUser(command);
- isGettingCommands = !output.getCanExit();
+ isGettingCommands = !command.getCanExit();
}
}
}
diff --git a/src/main/java/seedu/manager/ui/Ui.java b/src/main/java/seedu/manager/ui/Ui.java
index eee700d76b..10ecd91231 100644
--- a/src/main/java/seedu/manager/ui/Ui.java
+++ b/src/main/java/seedu/manager/ui/Ui.java
@@ -1,5 +1,6 @@
package seedu.manager.ui;
+import seedu.manager.command.Command;
import seedu.manager.command.CommandOutput;
import java.util.Scanner;
@@ -37,10 +38,10 @@ public String getCommand() {
}
/**
- * show the output of command to the users.
+ * show the output message a of command to the users.
*/
- public void showOutputToUser(CommandOutput output){
- System.out.println(output.getMessage());
+ public void showOutputToUser(Command command){
+ System.out.println(command.getMessage());
System.out.println(SEPARATOR);
}
}
From 4b7c8cc2582526c6b35e3a68cbf0a89b3573943d Mon Sep 17 00:00:00 2001
From: jemehgoh
Date: Thu, 17 Oct 2024 15:29:30 +0800
Subject: [PATCH 141/619] Add assert statement to parseAddCommand
---
src/main/java/seedu/manager/parser/Parser.java | 1 +
1 file changed, 1 insertion(+)
diff --git a/src/main/java/seedu/manager/parser/Parser.java b/src/main/java/seedu/manager/parser/Parser.java
index d39b8acb5a..a92f3eeaf5 100644
--- a/src/main/java/seedu/manager/parser/Parser.java
+++ b/src/main/java/seedu/manager/parser/Parser.java
@@ -74,6 +74,7 @@ public Command parseCommand(String command){
* @return a {@link Command} object representing the parsed command.
*/
public Command parseAddCommand(String input, String[] commandParts) {
+ assert commandParts[0].equalsIgnoreCase(AddCommand.COMMAND_WORD);
try {
String commandFlag = commandParts[1];
String[] inputParts;
From bf1bf9ec40c32d6a29656f5572ed232e2f833a1d Mon Sep 17 00:00:00 2001
From: jemehgoh
Date: Thu, 17 Oct 2024 18:39:56 +0800
Subject: [PATCH 142/619] Add logging for Parser
---
src/main/java/seedu/manager/Main.java | 1 -
src/main/java/seedu/manager/parser/Parser.java | 13 +++++++++++++
src/main/java/seedu/manager/ui/Ui.java | 1 -
3 files changed, 13 insertions(+), 2 deletions(-)
diff --git a/src/main/java/seedu/manager/Main.java b/src/main/java/seedu/manager/Main.java
index ab8d247b38..9c202a0e36 100644
--- a/src/main/java/seedu/manager/Main.java
+++ b/src/main/java/seedu/manager/Main.java
@@ -1,7 +1,6 @@
package seedu.manager;
import seedu.manager.command.Command;
-import seedu.manager.command.CommandOutput;
import seedu.manager.event.EventList;
import seedu.manager.parser.Parser;
import seedu.manager.ui.Ui;
diff --git a/src/main/java/seedu/manager/parser/Parser.java b/src/main/java/seedu/manager/parser/Parser.java
index a92f3eeaf5..229ea4b0ce 100644
--- a/src/main/java/seedu/manager/parser/Parser.java
+++ b/src/main/java/seedu/manager/parser/Parser.java
@@ -1,5 +1,6 @@
package seedu.manager.parser;
+import seedu.manager.Main;
import seedu.manager.command.Command;
import seedu.manager.command.AddCommand;
import seedu.manager.command.InvalidCommand;
@@ -9,10 +10,16 @@
import seedu.manager.command.ListCommand;
import seedu.manager.command.ViewCommand;
+import java.util.logging.Logger;
+
+import static java.util.logging.Level.INFO;
+import static java.util.logging.Level.WARNING;
+
/**
* Represents the command parser for EventManagerCLI
*/
public class Parser {
+ private static final Logger logger = Logger.getLogger(Parser.class.getName());
private static final String INVALID_COMMAND_MESSAGE = "Invalid command!";
private static final String INVALID_ADD_MESSAGE = """
Invalid command!
@@ -87,8 +94,10 @@ public Command parseAddCommand(String input, String[] commandParts) {
return new AddCommand(inputParts[1].trim(), inputParts[2].trim());
}
+ logger.log(WARNING,"Invalid command format");
return new InvalidCommand(INVALID_ADD_MESSAGE);
} catch (IndexOutOfBoundsException exception) {
+ logger.log(WARNING,"Invalid command format");
return new InvalidCommand(INVALID_ADD_MESSAGE);
}
}
@@ -122,8 +131,10 @@ private Command parseRemoveCommand(String input, String[] commandParts) {
return new RemoveCommand(inputParts[1].trim(), inputParts[2].trim());
}
+ logger.log(WARNING,"Invalid command format");
return new InvalidCommand(INVALID_REMOVE_MESSAGE);
} catch (IndexOutOfBoundsException exception) {
+ logger.log(WARNING,"Invalid command format");
return new InvalidCommand(INVALID_REMOVE_MESSAGE);
}
}
@@ -152,8 +163,10 @@ private Command parseViewCommand(String input, String[] commandParts) {
return new ViewCommand(inputParts[1].trim());
}
+ logger.log(WARNING,"Invalid command format");
return new InvalidCommand(INVALID_VIEW_MESSAGE);
} catch (IndexOutOfBoundsException exception) {
+ logger.log(WARNING,"Invalid command format");
return new InvalidCommand(INVALID_VIEW_MESSAGE);
}
}
diff --git a/src/main/java/seedu/manager/ui/Ui.java b/src/main/java/seedu/manager/ui/Ui.java
index 10ecd91231..0251643da3 100644
--- a/src/main/java/seedu/manager/ui/Ui.java
+++ b/src/main/java/seedu/manager/ui/Ui.java
@@ -1,7 +1,6 @@
package seedu.manager.ui;
import seedu.manager.command.Command;
-import seedu.manager.command.CommandOutput;
import java.util.Scanner;
From ca8f7f5ce6b12fd09f0509f08f4779742ec6f17d Mon Sep 17 00:00:00 2001
From: jemehgoh
Date: Thu, 17 Oct 2024 18:40:22 +0800
Subject: [PATCH 143/619] Update unit tests to work with new functionality
---
src/test/java/seedu/manager/command/ListCommandTest.java | 7 +++----
src/test/java/seedu/manager/command/ViewCommandTest.java | 7 +++----
2 files changed, 6 insertions(+), 8 deletions(-)
diff --git a/src/test/java/seedu/manager/command/ListCommandTest.java b/src/test/java/seedu/manager/command/ListCommandTest.java
index 256b26eb3d..30304deaab 100644
--- a/src/test/java/seedu/manager/command/ListCommandTest.java
+++ b/src/test/java/seedu/manager/command/ListCommandTest.java
@@ -20,17 +20,16 @@ public void setUp() {
listCommand = new ListCommand();
listCommand.setData(eventList);
+ listCommand.execute();
}
@Test
public void execute_twoEvents_success() {
- CommandOutput result = listCommand.execute();
-
String expectedMessage = "There are 2 events in your list! Here are your scheduled events:\n"
+ "1. Event name: Event 1 / Event time: 2024-10-10 10:00 / Event venue: Venue A\n"
+ "2. Event name: Event 2 / Event time: 2024-11-11 12:00 / Event venue: Venue B\n";
- assertEquals(expectedMessage, result.getMessage());
- assertFalse(result.getCanExit());
+ assertEquals(expectedMessage, listCommand.getMessage());
+ assertFalse(listCommand.getCanExit());
}
}
diff --git a/src/test/java/seedu/manager/command/ViewCommandTest.java b/src/test/java/seedu/manager/command/ViewCommandTest.java
index 7fef43e4af..f20a802437 100644
--- a/src/test/java/seedu/manager/command/ViewCommandTest.java
+++ b/src/test/java/seedu/manager/command/ViewCommandTest.java
@@ -27,16 +27,15 @@ public void setUp() {
viewCommand = new Parser().parseCommand("view -e Event 1");
viewCommand.setData(eventList);
+ viewCommand.execute();
}
@Test
public void execute_twoEvents_success() {
- CommandOutput result = viewCommand.execute();
-
String expectedMessage = "There are 1 participants in Event 1! Here are your participants:\n"
+ "1. Tom\n";
- assertEquals(expectedMessage, result.getMessage());
- assertFalse(result.getCanExit());
+ assertEquals(expectedMessage, viewCommand.getMessage());
+ assertFalse(viewCommand.getCanExit());
}
}
From b244b84d9a2a8c45e9dae1da684fc0f11d179e44 Mon Sep 17 00:00:00 2001
From: jemehgoh
Date: Thu, 17 Oct 2024 18:50:35 +0800
Subject: [PATCH 144/619] Remove unused imports from Parser and fix indentation
in MenuCommand
---
src/main/java/seedu/manager/command/MenuCommand.java | 2 +-
src/main/java/seedu/manager/parser/Parser.java | 2 --
2 files changed, 1 insertion(+), 3 deletions(-)
diff --git a/src/main/java/seedu/manager/command/MenuCommand.java b/src/main/java/seedu/manager/command/MenuCommand.java
index 969313c18c..61cbcbefa6 100644
--- a/src/main/java/seedu/manager/command/MenuCommand.java
+++ b/src/main/java/seedu/manager/command/MenuCommand.java
@@ -27,6 +27,6 @@ public MenuCommand() {
*/
@Override
public void execute() {
- this.message = MENU_MESSAGE;
+ this.message = MENU_MESSAGE;
}
}
diff --git a/src/main/java/seedu/manager/parser/Parser.java b/src/main/java/seedu/manager/parser/Parser.java
index 229ea4b0ce..bd1b765b54 100644
--- a/src/main/java/seedu/manager/parser/Parser.java
+++ b/src/main/java/seedu/manager/parser/Parser.java
@@ -1,6 +1,5 @@
package seedu.manager.parser;
-import seedu.manager.Main;
import seedu.manager.command.Command;
import seedu.manager.command.AddCommand;
import seedu.manager.command.InvalidCommand;
@@ -12,7 +11,6 @@
import java.util.logging.Logger;
-import static java.util.logging.Level.INFO;
import static java.util.logging.Level.WARNING;
/**
From 549201e1a198f59f7fc15c32a7d11750aff5aab8 Mon Sep 17 00:00:00 2001
From: fuyixuan
Date: Fri, 18 Oct 2024 00:42:21 +0800
Subject: [PATCH 145/619] .
---
src/main/java/seedu/manager/parser/Parser.java | 1 +
1 file changed, 1 insertion(+)
diff --git a/src/main/java/seedu/manager/parser/Parser.java b/src/main/java/seedu/manager/parser/Parser.java
index d39b8acb5a..1284e2da0e 100644
--- a/src/main/java/seedu/manager/parser/Parser.java
+++ b/src/main/java/seedu/manager/parser/Parser.java
@@ -9,6 +9,7 @@
import seedu.manager.command.ListCommand;
import seedu.manager.command.ViewCommand;
+
/**
* Represents the command parser for EventManagerCLI
*/
From a6fcd4b505abd269fa7492216028a478e3cf8493 Mon Sep 17 00:00:00 2001
From: fuyixuan
Date: Fri, 18 Oct 2024 01:23:17 +0800
Subject: [PATCH 146/619] Add assertions to ListCommand and Parser
---
.../seedu/manager/command/CommandOutput.java | 39 -------------------
.../seedu/manager/command/ListCommand.java | 1 +
.../java/seedu/manager/parser/Parser.java | 2 +
3 files changed, 3 insertions(+), 39 deletions(-)
delete mode 100644 src/main/java/seedu/manager/command/CommandOutput.java
diff --git a/src/main/java/seedu/manager/command/CommandOutput.java b/src/main/java/seedu/manager/command/CommandOutput.java
deleted file mode 100644
index b3db269614..0000000000
--- a/src/main/java/seedu/manager/command/CommandOutput.java
+++ /dev/null
@@ -1,39 +0,0 @@
-package seedu.manager.command;
-
-/**
- * Represents the output of the executed command
- */
-public class CommandOutput {
- private final String message;
- private final boolean canExit;
-
- /**
- * Constructs a new CommandOutput with a given message and whether the program can be exited from
- *
- * @param message The given message
- * @param canExit Whether the program can be exited from
- */
- public CommandOutput(String message, boolean canExit) {
- this.message = message;
- this.canExit = canExit;
- }
-
- /**
- * Get the message attribute of CommandOutput
- *
- * @return the message of command output
- */
- public String getMessage() {
- return message;
- }
-
- /**
- * Returns true if the program can be exited from,
- * returns false otherwise.
- *
- * @return Whether the program can be exited from
- */
- public boolean getCanExit() {
- return canExit;
- }
-}
diff --git a/src/main/java/seedu/manager/command/ListCommand.java b/src/main/java/seedu/manager/command/ListCommand.java
index dffb4c6a7e..34e21f28d1 100644
--- a/src/main/java/seedu/manager/command/ListCommand.java
+++ b/src/main/java/seedu/manager/command/ListCommand.java
@@ -19,6 +19,7 @@ public ListCommand() {
public void execute() {
StringBuilder outputMessage = new StringBuilder(String.format(LIST_MESSAGE, eventList.getListSize()) + "\n");
for (int i = 0; i < eventList.getListSize(); i++) {
+ assert eventList.getEvent(i) != null : "Event at index " + i + " should not be null.";
outputMessage.append(String.format("%d. %s\n", i + 1, eventList.getEvent(i).toString()));
}
diff --git a/src/main/java/seedu/manager/parser/Parser.java b/src/main/java/seedu/manager/parser/Parser.java
index bd1b765b54..6306b7d388 100644
--- a/src/main/java/seedu/manager/parser/Parser.java
+++ b/src/main/java/seedu/manager/parser/Parser.java
@@ -117,6 +117,7 @@ public Command parseAddCommand(String input, String[] commandParts) {
* @return a {@link Command} object representing the parsed command.
*/
private Command parseRemoveCommand(String input, String[] commandParts) {
+ assert commandParts[0].equalsIgnoreCase(RemoveCommand.COMMAND_WORD);
try {
String commandFlag = commandParts[1];
String[] inputParts;
@@ -153,6 +154,7 @@ private Command parseRemoveCommand(String input, String[] commandParts) {
* @return a {@link Command} object representing the parsed command.
*/
private Command parseViewCommand(String input, String[] commandParts) {
+ assert commandParts[0].equalsIgnoreCase(ViewCommand.COMMAND_WORD);
try {
String commandFlag = commandParts[1];
From 9b49228eef8b569b0a9d204d732a721054d23ec5 Mon Sep 17 00:00:00 2001
From: fuyixuan
Date: Fri, 18 Oct 2024 01:55:22 +0800
Subject: [PATCH 147/619] add logging to parseAddCommand
---
src/main/java/seedu/manager/parser/Parser.java | 4 ++++
1 file changed, 4 insertions(+)
diff --git a/src/main/java/seedu/manager/parser/Parser.java b/src/main/java/seedu/manager/parser/Parser.java
index 6306b7d388..b8b9e78ebb 100644
--- a/src/main/java/seedu/manager/parser/Parser.java
+++ b/src/main/java/seedu/manager/parser/Parser.java
@@ -86,9 +86,13 @@ public Command parseAddCommand(String input, String[] commandParts) {
if (commandFlag.equals("-e")) {
inputParts = input.split("(-e|-t|-v)");
+ logger.info("Creating AddCommand for event with details: " +
+ inputParts[1].trim() + ", " + inputParts[2].trim() + ", " + inputParts[3].trim());
return new AddCommand(inputParts[1].trim(), inputParts[2].trim(), inputParts[3].trim());
} else if (commandFlag.equals("-p")) {
inputParts = input.split("(-p|-e)");
+ logger.info("Creating AddCommand for participant with details: " +
+ inputParts[1].trim() + ", " + inputParts[2].trim());
return new AddCommand(inputParts[1].trim(), inputParts[2].trim());
}
From 2661d84269cc9c6096c8829c67fccf28d393bd59 Mon Sep 17 00:00:00 2001
From: jemehgoh
Date: Fri, 18 Oct 2024 22:23:46 +0800
Subject: [PATCH 148/619] Add isDone member and associated methods to Event
class
---
src/main/java/seedu/manager/event/Event.java | 25 ++++++++++++++++++++
1 file changed, 25 insertions(+)
diff --git a/src/main/java/seedu/manager/event/Event.java b/src/main/java/seedu/manager/event/Event.java
index 5e4a72cbea..dc00dbb2b7 100644
--- a/src/main/java/seedu/manager/event/Event.java
+++ b/src/main/java/seedu/manager/event/Event.java
@@ -11,6 +11,7 @@ public class Event {
private final String eventName;
private String eventTime;
private String eventVenue;
+ private boolean isDone;
/**
* Constructs an Event with the specified name.
@@ -34,6 +35,7 @@ public Event(String eventName, String eventTime, String eventVenue) {
this.eventTime = eventTime;
this.eventVenue = eventVenue;
this.participantList = new ArrayList<>();
+ this.isDone = false;
}
/**
@@ -97,6 +99,13 @@ public ArrayList getParticipantList() {
return participantList;
}
+ /**
+ * @return true if the event is marked done, false otherwise
+ */
+ public boolean isDone() {
+ return isDone;
+ }
+
/**
* Sets a new time for the event.
*
@@ -115,6 +124,22 @@ public void setEventVenue(String eventVenue) {
this.eventVenue = eventVenue;
}
+ /**
+ * Sets if the event is done or not done
+ *
+ * @param isDone if the event is done
+ */
+ public void setDone(boolean isDone) {
+ this.isDone = isDone;
+ }
+
+ /**
+ * @return 'Y' if event is marked done, 'N' otherwise
+ */
+ public char markIfDone() {
+ return (this.isDone) ? 'Y' : 'N';
+ }
+
/**
* Returns a string representation of the event, indicating its name, time and venue.
*
From 89951adcb0feea0ea1bb612f42d3eba029751556 Mon Sep 17 00:00:00 2001
From: jemehgoh
Date: Fri, 18 Oct 2024 22:34:30 +0800
Subject: [PATCH 149/619] Update toString of Event to print if event has been
marked done
---
src/main/java/seedu/manager/event/Event.java | 3 ++-
src/test/java/seedu/manager/command/ListCommandTest.java | 4 ++--
text-ui-test/EXPECTED.TXT | 2 +-
3 files changed, 5 insertions(+), 4 deletions(-)
diff --git a/src/main/java/seedu/manager/event/Event.java b/src/main/java/seedu/manager/event/Event.java
index dc00dbb2b7..a7d9134eb2 100644
--- a/src/main/java/seedu/manager/event/Event.java
+++ b/src/main/java/seedu/manager/event/Event.java
@@ -147,6 +147,7 @@ public char markIfDone() {
*/
@Override
public String toString(){
- return "Event name: " + eventName + " / Event time: " + eventTime + " / Event venue: " + eventVenue;
+ return String.format("Event name: %s / Event time: %s / Event venue: %s / Done: %c", eventName, eventTime,
+ eventVenue, markIfDone());
}
}
diff --git a/src/test/java/seedu/manager/command/ListCommandTest.java b/src/test/java/seedu/manager/command/ListCommandTest.java
index 30304deaab..847fc0fa5a 100644
--- a/src/test/java/seedu/manager/command/ListCommandTest.java
+++ b/src/test/java/seedu/manager/command/ListCommandTest.java
@@ -26,8 +26,8 @@ public void setUp() {
@Test
public void execute_twoEvents_success() {
String expectedMessage = "There are 2 events in your list! Here are your scheduled events:\n"
- + "1. Event name: Event 1 / Event time: 2024-10-10 10:00 / Event venue: Venue A\n"
- + "2. Event name: Event 2 / Event time: 2024-11-11 12:00 / Event venue: Venue B\n";
+ + "1. Event name: Event 1 / Event time: 2024-10-10 10:00 / Event venue: Venue A / Done: N\n"
+ + "2. Event name: Event 2 / Event time: 2024-11-11 12:00 / Event venue: Venue B / Done: N\n";
assertEquals(expectedMessage, listCommand.getMessage());
assertFalse(listCommand.getCanExit());
diff --git a/text-ui-test/EXPECTED.TXT b/text-ui-test/EXPECTED.TXT
index a40a397bd8..59f14548e1 100644
--- a/text-ui-test/EXPECTED.TXT
+++ b/text-ui-test/EXPECTED.TXT
@@ -21,7 +21,7 @@ add -p PARTICIPANT_NAME -e EVENT_NAME
Enter a command: Event added successfully
------------------------
Enter a command: There are 1 events in your list! Here are your scheduled events:
-1. Event name: dinner party / Event time: 2024-10-10 / Event venue: Alice's House
+1. Event name: dinner party / Event time: 2024-10-10 / Event venue: Alice's House / Done: N
------------------------
Enter a command: Thank you for using EventManagerCLI. Goodbye!
From 326036eb90c3abfc316ca9b3e60e56ac09e92901 Mon Sep 17 00:00:00 2001
From: jemehgoh
Date: Fri, 18 Oct 2024 22:50:45 +0800
Subject: [PATCH 150/619] Add new Mark command to mark events as done
---
.../seedu/manager/command/MarkCommand.java | 42 +++++++++++++++++++
1 file changed, 42 insertions(+)
create mode 100644 src/main/java/seedu/manager/command/MarkCommand.java
diff --git a/src/main/java/seedu/manager/command/MarkCommand.java b/src/main/java/seedu/manager/command/MarkCommand.java
new file mode 100644
index 0000000000..97ac8fb217
--- /dev/null
+++ b/src/main/java/seedu/manager/command/MarkCommand.java
@@ -0,0 +1,42 @@
+package seedu.manager.command;
+
+import seedu.manager.event.Event;
+
+import java.util.Optional;
+
+/**
+ * Represents an executable mark command
+ */
+public class MarkCommand extends Command {
+ public static final String COMMAND_WORD = "mark";
+
+ private static final String EVENT_MARK_MESSAGE = "Event marked as done";
+ private static final String INVALID_EVENT_MESSAGE = "Event not found!";
+
+ private String eventName;
+
+ /**
+ * Constructs a new MarkCommand with the given event name
+ *
+ * @param eventName the given event name
+ */
+ public MarkCommand(String eventName) {
+ super(false);
+ this.eventName = eventName;
+ }
+
+ /**
+ * Executes a mark command by marking the specified event as done
+ */
+ @Override
+ public void execute() {
+ Optional eventToMark = this.eventList.getEventByName(this.eventName);
+
+ if (eventToMark.isPresent()) {
+ eventToMark.get().setDone(true);
+ this.message = EVENT_MARK_MESSAGE;
+ } else {
+ this.message = INVALID_EVENT_MESSAGE;
+ }
+ }
+}
From 4ef357db24fd2f142ebc13fc184ffa720b533cdd Mon Sep 17 00:00:00 2001
From: jemehgoh
Date: Fri, 18 Oct 2024 23:00:54 +0800
Subject: [PATCH 151/619] Add JUnit tests for MarkCommand
---
.../manager/command/MarkCommandTest.java | 33 +++++++++++++++++++
1 file changed, 33 insertions(+)
create mode 100644 src/test/java/seedu/manager/command/MarkCommandTest.java
diff --git a/src/test/java/seedu/manager/command/MarkCommandTest.java b/src/test/java/seedu/manager/command/MarkCommandTest.java
new file mode 100644
index 0000000000..c4eb97b4d0
--- /dev/null
+++ b/src/test/java/seedu/manager/command/MarkCommandTest.java
@@ -0,0 +1,33 @@
+package seedu.manager.command;
+
+import org.junit.jupiter.api.BeforeEach;
+import org.junit.jupiter.api.Test;
+import seedu.manager.event.EventList;
+
+import static org.junit.jupiter.api.Assertions.assertEquals;
+
+class MarkCommandTest {
+ private EventList eventList;
+
+ @BeforeEach
+ public void testSetUp() {
+ eventList = new EventList();
+ eventList.addEvent("Event 1", "2024-10-10 1600", "Venue 1");
+ }
+
+ @Test
+ public void execute_eventPresent_success() {
+ MarkCommand command = new MarkCommand("Event 1");
+ command.setData(eventList);
+ command.execute();
+ assertEquals("Event marked as done", command.getMessage());
+ }
+
+ @Test
+ public void execute_eventAbsent_failure() {
+ MarkCommand command = new MarkCommand("Event 2");
+ command.setData(eventList);
+ command.execute();
+ assertEquals("Event not found!", command.getMessage());
+ }
+}
From b7caf105f3fc3789f0c1539b3bd7e5487b0710d0 Mon Sep 17 00:00:00 2001
From: jemehgoh
Date: Fri, 18 Oct 2024 23:16:13 +0800
Subject: [PATCH 152/619] Add functionality to mark events not done to
MarkCommand
---
.../seedu/manager/command/MarkCommand.java | 12 +++++++----
.../manager/command/MarkCommandTest.java | 21 ++++++++++++++-----
2 files changed, 24 insertions(+), 9 deletions(-)
diff --git a/src/main/java/seedu/manager/command/MarkCommand.java b/src/main/java/seedu/manager/command/MarkCommand.java
index 97ac8fb217..58db304b6f 100644
--- a/src/main/java/seedu/manager/command/MarkCommand.java
+++ b/src/main/java/seedu/manager/command/MarkCommand.java
@@ -11,30 +11,34 @@ public class MarkCommand extends Command {
public static final String COMMAND_WORD = "mark";
private static final String EVENT_MARK_MESSAGE = "Event marked as done";
+ private static final String EVENT_UNMARK_MESSAGE = "Event marked not done";
private static final String INVALID_EVENT_MESSAGE = "Event not found!";
private String eventName;
+ private boolean toMark;
/**
* Constructs a new MarkCommand with the given event name
*
* @param eventName the given event name
*/
- public MarkCommand(String eventName) {
+ public MarkCommand(String eventName, boolean toMark) {
super(false);
this.eventName = eventName;
+ this.toMark = toMark;
}
/**
- * Executes a mark command by marking the specified event as done
+ * Executes a mark command by marking the specified event as done or not done,
+ * depending on the value of toMark.
*/
@Override
public void execute() {
Optional eventToMark = this.eventList.getEventByName(this.eventName);
if (eventToMark.isPresent()) {
- eventToMark.get().setDone(true);
- this.message = EVENT_MARK_MESSAGE;
+ eventToMark.get().setDone(this.toMark);
+ this.message = (this.toMark) ? EVENT_MARK_MESSAGE : EVENT_UNMARK_MESSAGE;
} else {
this.message = INVALID_EVENT_MESSAGE;
}
diff --git a/src/test/java/seedu/manager/command/MarkCommandTest.java b/src/test/java/seedu/manager/command/MarkCommandTest.java
index c4eb97b4d0..c98c68327b 100644
--- a/src/test/java/seedu/manager/command/MarkCommandTest.java
+++ b/src/test/java/seedu/manager/command/MarkCommandTest.java
@@ -16,18 +16,29 @@ public void testSetUp() {
}
@Test
- public void execute_eventPresent_success() {
- MarkCommand command = new MarkCommand("Event 1");
+ public void execute_eventPresentMarkDone_success() {
+ String expectedMessage = "Event marked as done";
+ MarkCommand command = new MarkCommand("Event 1", true);
command.setData(eventList);
command.execute();
- assertEquals("Event marked as done", command.getMessage());
+ assertEquals(expectedMessage, command.getMessage());
+ }
+
+ @Test
+ public void execute_eventPresentMarkNotDone_success() {
+ String expectedMessage = "Event marked not done";
+ MarkCommand command = new MarkCommand("Event 1", false);
+ command.setData(eventList);
+ command.execute();
+ assertEquals(expectedMessage, command.getMessage());
}
@Test
public void execute_eventAbsent_failure() {
- MarkCommand command = new MarkCommand("Event 2");
+ String expectedMessage = "Event not found!";
+ MarkCommand command = new MarkCommand("Event 2", true);
command.setData(eventList);
command.execute();
- assertEquals("Event not found!", command.getMessage());
+ assertEquals(expectedMessage, command.getMessage());
}
}
From 6c18c8647fdf78aa41cbd3f1122f87f314a3e57f Mon Sep 17 00:00:00 2001
From: jemehgoh
Date: Sat, 19 Oct 2024 10:00:16 +0800
Subject: [PATCH 153/619] Add functionality for executing the mark command to
Parser
---
.../seedu/manager/command/MenuCommand.java | 3 +-
.../java/seedu/manager/parser/Parser.java | 66 ++++++++++++++++++-
2 files changed, 67 insertions(+), 2 deletions(-)
diff --git a/src/main/java/seedu/manager/command/MenuCommand.java b/src/main/java/seedu/manager/command/MenuCommand.java
index 61cbcbefa6..831b56ca4a 100644
--- a/src/main/java/seedu/manager/command/MenuCommand.java
+++ b/src/main/java/seedu/manager/command/MenuCommand.java
@@ -13,7 +13,8 @@ public class MenuCommand extends Command {
remove -e EVENT_NAME: Remove an event from the event list.
add -p PARTICIPANT_NAME -e EVENT_NAME: Add a participant to an event.
view -e EVENT_NAME: View the list of participants of an event.
- remove -p PARTICIPANT_NAME -e EVENT_NAME: Remove a participant from an event.""";
+ remove -p PARTICIPANT_NAME -e EVENT_NAME: Remove a participant from an event.
+ mark -e EVENT -s STATUS: Mark an event as done or not done""";
/**
* Constructs a new MenuCommand
diff --git a/src/main/java/seedu/manager/parser/Parser.java b/src/main/java/seedu/manager/parser/Parser.java
index b8b9e78ebb..0068b46e41 100644
--- a/src/main/java/seedu/manager/parser/Parser.java
+++ b/src/main/java/seedu/manager/parser/Parser.java
@@ -3,6 +3,7 @@
import seedu.manager.command.Command;
import seedu.manager.command.AddCommand;
import seedu.manager.command.InvalidCommand;
+import seedu.manager.command.MarkCommand;
import seedu.manager.command.RemoveCommand;
import seedu.manager.command.ExitCommand;
import seedu.manager.command.MenuCommand;
@@ -33,6 +34,14 @@ public class Parser {
Invalid command!
Please enter your commands in the following format:
view -e EVENT_NAME""";
+ private static final String INVALID_MARK_MESSAGE = """
+ Invalid command!
+ Please enter your commands in the following format:
+ mark -e EVENT -s STATUS""";
+ private static final String INVALID_EVENT_STATUS_MESSAGE = """
+ Invalid event status!
+ Please set the event status as either "done" or "undone"
+ """;
/**
* Returns a command based on the given user command string
@@ -56,7 +65,8 @@ public Command parseCommand(String command){
return new MenuCommand();
case ExitCommand.COMMAND_WORD:
return new ExitCommand();
-
+ case MarkCommand.COMMAND_WORD:
+ return parseMarkCommand(command, commandParts);
default:
return new InvalidCommand(INVALID_COMMAND_MESSAGE);
}
@@ -174,4 +184,58 @@ private Command parseViewCommand(String input, String[] commandParts) {
return new InvalidCommand(INVALID_VIEW_MESSAGE);
}
}
+
+ /**
+ * Parses the input string to create a {@link Command} based on the provided command parts.
+ *
+ *
+ * This method checks the command flag extracted from the command parts. If the command
+ * flag is {@code "-e"}, it splits the input string to create a {@link MarkCommand}
+ * to mark an event done or undone. If the command flag is {@code "-p"}, it creates a
+ * {@link RemoveCommand} for removing a participant from an event. Otherwise, it returns
+ * an {@link InvalidCommand} with an error message.
+ *
+ *
+ * @param input the input string containing the command details.
+ * @param commandParts an array of strings representing the parsed command parts,
+ * where the second element is the command flag.
+ * @return a {@link Command} object representing the parsed command.
+ */
+ private Command parseMarkCommand(String input, String[] commandParts) {
+ assert commandParts[0].equalsIgnoreCase(MarkCommand.COMMAND_WORD);
+ try {
+ String commandFlag = commandParts[1];
+
+ if (commandFlag.equalsIgnoreCase("-e")) {
+ String[] inputParts = input.split("-e|-s");
+ return getMarkEventCommand(inputParts[1].trim(), inputParts[2].trim());
+ }
+
+ logger.log(WARNING,"Invalid command format");
+ return new InvalidCommand(INVALID_MARK_MESSAGE);
+ } catch (IndexOutOfBoundsException exception) {
+ logger.log(WARNING,"Invalid command format");
+ return new InvalidCommand(INVALID_MARK_MESSAGE);
+ }
+ }
+
+ /**
+ * Returns a {@link MarkCommand} with a given event name and status, or an
+ * {@link InvalidCommand} if the status is invalid
+ *
+ * @param eventName the given event name
+ * @param status the given event status
+ * @return a MarkCommand with a given event name and status, or an
+ * InvalidCommand if the status is invalid
+ */
+ private Command getMarkEventCommand(String eventName, String status) {
+ if (status.equalsIgnoreCase("done")) {
+ return new MarkCommand(eventName, true);
+ } else if (status.equalsIgnoreCase("undone")) {
+ return new MarkCommand(eventName, false);
+ } else {
+ logger.log(WARNING,"Invalid status keyword");
+ return new InvalidCommand(INVALID_EVENT_STATUS_MESSAGE);
+ }
+ }
}
From 1024f14cbef9680135c26f5d2016048a116db128 Mon Sep 17 00:00:00 2001
From: jemehgoh
Date: Sat, 19 Oct 2024 10:03:43 +0800
Subject: [PATCH 154/619] Fix Javadoc for parseMarkCommand method
---
src/main/java/seedu/manager/parser/Parser.java | 5 ++---
1 file changed, 2 insertions(+), 3 deletions(-)
diff --git a/src/main/java/seedu/manager/parser/Parser.java b/src/main/java/seedu/manager/parser/Parser.java
index 0068b46e41..7803edb84e 100644
--- a/src/main/java/seedu/manager/parser/Parser.java
+++ b/src/main/java/seedu/manager/parser/Parser.java
@@ -191,9 +191,8 @@ private Command parseViewCommand(String input, String[] commandParts) {
*
* This method checks the command flag extracted from the command parts. If the command
* flag is {@code "-e"}, it splits the input string to create a {@link MarkCommand}
- * to mark an event done or undone. If the command flag is {@code "-p"}, it creates a
- * {@link RemoveCommand} for removing a participant from an event. Otherwise, it returns
- * an {@link InvalidCommand} with an error message.
+ * to mark an event done or undone. Otherwise, it returns an {@link InvalidCommand}
+ * with an error message.
*
*
* @param input the input string containing the command details.
From 2cd259a67c8a9e165de44bac605e0247de2db262 Mon Sep 17 00:00:00 2001
From: jemehgoh
Date: Sat, 19 Oct 2024 10:20:47 +0800
Subject: [PATCH 155/619] Add JUnit tests for parsing of mark command
---
.../java/seedu/manager/parser/ParserTest.java | 25 +++++++++++++++++++
1 file changed, 25 insertions(+)
diff --git a/src/test/java/seedu/manager/parser/ParserTest.java b/src/test/java/seedu/manager/parser/ParserTest.java
index b8fc075990..bbe8f8bd9a 100644
--- a/src/test/java/seedu/manager/parser/ParserTest.java
+++ b/src/test/java/seedu/manager/parser/ParserTest.java
@@ -5,6 +5,7 @@
import seedu.manager.command.Command;
import seedu.manager.command.ExitCommand;
import seedu.manager.command.InvalidCommand;
+import seedu.manager.command.MarkCommand;
import seedu.manager.command.MenuCommand;
import seedu.manager.command.ListCommand;
import seedu.manager.command.RemoveCommand;
@@ -76,4 +77,28 @@ public void removeCommand_removeNoParameter_invalid() {
assertInstanceOf(InvalidCommand.class, command);
}
+
+ @Test
+ public void parseCommand_markEvent_mark() {
+ Parser parser = new Parser();
+ Command command = parser.parseCommand("mark -e event -s done");
+
+ assertInstanceOf(MarkCommand.class, command);
+ }
+
+ @Test
+ public void parseCommand_markEventNoStatus_invalid() {
+ Parser parser = new Parser();
+ Command command = parser.parseCommand("mark -e event");
+
+ assertInstanceOf(InvalidCommand.class, command);
+ }
+
+ @Test
+ public void parseCommand_markEventInvalidStatus_invalid() {
+ Parser parser = new Parser();
+ Command command = parser.parseCommand("mark -e event -s yes");
+
+ assertInstanceOf(InvalidCommand.class, command);
+ }
}
From 51ec43620639c8bb54ed98951440f805791aaccc Mon Sep 17 00:00:00 2001
From: jemehgoh
Date: Sat, 19 Oct 2024 10:36:12 +0800
Subject: [PATCH 156/619] Remove "_NAME" from placeholder terms
The attribute placeholders for commands like the remove command have
names like "EVENT_NAME" and "PARTICIPANT_NAME". This makes them
difficult to read and unclear.
Let's change these names and remove the "_NAME" suffixes. This way,
the placeholders can be more easily understood.
---
docs/UserGuide.md | 30 +++++++++----------
.../seedu/manager/command/MenuCommand.java | 10 +++----
.../java/seedu/manager/parser/Parser.java | 10 +++----
3 files changed, 25 insertions(+), 25 deletions(-)
diff --git a/docs/UserGuide.md b/docs/UserGuide.md
index 27d01020fc..42e66299bb 100644
--- a/docs/UserGuide.md
+++ b/docs/UserGuide.md
@@ -25,12 +25,12 @@ Shows a list of all valid user commands in the program.
```
Here are the possible commands:
-add -e EVENT_NAME -t TIME -v VENUE: Add an event to the event list.
+add -e EVENT -t TIME -v VENUE: Add an event to the event list.
list: List events.
-remove -e EVENT_NAME: Remove an event from the event list.
-add -p PARTICIPANT_NAME -e EVENT_NAME: Add a participant to an event.
-view -e EVENT_NAME: View the list of participants of an event.
-remove -p PARTICIPANT_NAME -e EVENT_NAME: Remove a participant from an event.
+remove -e EVENT: Remove an event from the event list.
+add -p PARTICIPANT -e EVENT: Add a participant to an event.
+view -e EVENT: View the list of participants of an event.
+remove -p PARTICIPANT -e EVENT: Remove a participant from an event.
```
Format: `menu`
@@ -44,8 +44,8 @@ Format: `list`
Adds an event to the event list, or a participant to an event.
Format:
-* `add -e EVENT_NAME -t TIME -v VENUE` for adding an event to the events list.
-* `add -p PARTICIPANT_NAME -e EVENT_NAME` for adding a participant to an event.
+* `add -e EVENT -t TIME -v VENUE` for adding an event to the events list.
+* `add -p PARTICIPANT -e EVENT` for adding a participant to an event.
Examples:
* `add -e Origami workshop -t Mon 1600-1800 -v Building A` adds an event with name `Origami workshop`,
@@ -56,8 +56,8 @@ time `Mon 1600-1800` and venue `Building A` to the events list.
Removes an event from the event list, or a participant from an event.
Format:
-* `remove -e EVENT_NAME` for removing an event from the event list.
-* `remove -p PARTICIPANT_NAME -e EVENT_NAME` for removing a participant from an event.
+* `remove -e EVENT` for removing an event from the event list.
+* `remove -p PARTICIPANT -e EVENT` for removing a participant from an event.
Examples:
* `remove -e Origami workshop` removes the event `Origami workshop` from the event list.
@@ -66,7 +66,7 @@ Examples:
### View all participants for an event: `view`
Shows a list of all participants for an event.
-Format: `view -e EVENT_NAME`
+Format: `view -e EVENT`
Examples:
* `view -e Origami workshop` shows a list of all participants for the event `Origami workshop`.
@@ -80,8 +80,8 @@ Format: `exit`
* View all commands: `view`
* List all events: `list`
-* Add event: `add -e EVENT_NAME -t TIME -v VENUE`
-* Add participant to an event: `add -p PARTICIPANT_NAME -e EVENT_NAME`
-* Remove event: `remove -e EVENT_NAME`
-* Remove participant from an event: `remove -p PARTICIPANT_NAME -e EVENT_NAME`
-* View all participants for an event: `view -e EVENT_NAME`
+* Add event: `add -e EVENT -t TIME -v VENUE`
+* Add participant to an event: `add -p PARTICIPANT -e EVENT`
+* Remove event: `remove -e EVENT`
+* Remove participant from an event: `remove -p PARTICIPANT -e EVENT`
+* View all participants for an event: `view -e EVENT`
diff --git a/src/main/java/seedu/manager/command/MenuCommand.java b/src/main/java/seedu/manager/command/MenuCommand.java
index 831b56ca4a..fd6f593f99 100644
--- a/src/main/java/seedu/manager/command/MenuCommand.java
+++ b/src/main/java/seedu/manager/command/MenuCommand.java
@@ -8,12 +8,12 @@ public class MenuCommand extends Command {
private static final String MENU_MESSAGE = """
Here are the possible commands:
- add -e EVENT_NAME -t TIME -v VENUE: Add an event to the event list.
+ add -e EVENT -t TIME -v VENUE: Add an event to the event list.
list: List events.
- remove -e EVENT_NAME: Remove an event from the event list.
- add -p PARTICIPANT_NAME -e EVENT_NAME: Add a participant to an event.
- view -e EVENT_NAME: View the list of participants of an event.
- remove -p PARTICIPANT_NAME -e EVENT_NAME: Remove a participant from an event.
+ remove -e EVENT: Remove an event from the event list.
+ add -p PARTICIPANT -e EVENT: Add a participant to an event.
+ view -e EVENT: View the list of participants of an event.
+ remove -p PARTICIPANT -e EVENT: Remove a participant from an event.
mark -e EVENT -s STATUS: Mark an event as done or not done""";
/**
diff --git a/src/main/java/seedu/manager/parser/Parser.java b/src/main/java/seedu/manager/parser/Parser.java
index 7803edb84e..04f3ec0023 100644
--- a/src/main/java/seedu/manager/parser/Parser.java
+++ b/src/main/java/seedu/manager/parser/Parser.java
@@ -23,17 +23,17 @@ public class Parser {
private static final String INVALID_ADD_MESSAGE = """
Invalid command!
Please enter your commands in the following format:
- add -e EVENT_NAME -t TIME -v VENUE
- add -p PARTICIPANT_NAME -e EVENT_NAME""";
+ add -e EVENT -t TIME -v VENUE
+ add -p PARTICIPANT -e EVENT""";
private static final String INVALID_REMOVE_MESSAGE = """
Invalid command!
Please enter your commands in the following format:
- remove -e EVENT_NAME
- remove -p PARTICIPANT_NAME -e EVENT_NAME""";
+ remove -e EVENT
+ remove -p PARTICIPANT -e EVENT""";
private static final String INVALID_VIEW_MESSAGE = """
Invalid command!
Please enter your commands in the following format:
- view -e EVENT_NAME""";
+ view -e EVENT""";
private static final String INVALID_MARK_MESSAGE = """
Invalid command!
Please enter your commands in the following format:
From fa0d5369fae7498672aa5abb8162a2130cf9b7ec Mon Sep 17 00:00:00 2001
From: jemehgoh
Date: Sat, 19 Oct 2024 10:41:28 +0800
Subject: [PATCH 157/619] Update redirection test to account for mark command
---
text-ui-test/EXPECTED.TXT | 23 ++++++++++++++++-------
text-ui-test/input.txt | 3 +++
2 files changed, 19 insertions(+), 7 deletions(-)
diff --git a/text-ui-test/EXPECTED.TXT b/text-ui-test/EXPECTED.TXT
index 59f14548e1..3163743eff 100644
--- a/text-ui-test/EXPECTED.TXT
+++ b/text-ui-test/EXPECTED.TXT
@@ -3,26 +3,35 @@ Enter a command: Invalid command!
------------------------
Enter a command: Here are the possible commands:
-add -e EVENT_NAME -t TIME -v VENUE: Add an event to the event list.
+add -e EVENT -t TIME -v VENUE: Add an event to the event list.
list: List events.
-remove -e EVENT_NAME: Remove an event from the event list.
-add -p PARTICIPANT_NAME -e EVENT_NAME: Add a participant to an event.
-view -e EVENT_NAME: View the list of participants of an event.
-remove -p PARTICIPANT_NAME -e EVENT_NAME: Remove a participant from an event.
+remove -e EVENT: Remove an event from the event list.
+add -p PARTICIPANT -e EVENT: Add a participant to an event.
+view -e EVENT: View the list of participants of an event.
+remove -p PARTICIPANT -e EVENT: Remove a participant from an event.
+mark -e EVENT -s STATUS: Mark an event as done or not done
------------------------
Enter a command: There are 0 events in your list! Here are your scheduled events:
------------------------
Enter a command: Invalid command!
Please enter your commands in the following format:
-add -e EVENT_NAME -t TIME -v VENUE
-add -p PARTICIPANT_NAME -e EVENT_NAME
+add -e EVENT -t TIME -v VENUE
+add -p PARTICIPANT -e EVENT
------------------------
Enter a command: Event added successfully
------------------------
Enter a command: There are 1 events in your list! Here are your scheduled events:
1. Event name: dinner party / Event time: 2024-10-10 / Event venue: Alice's House / Done: N
+------------------------
+Enter a command: Event marked as done
+------------------------
+Enter a command: There are 1 events in your list! Here are your scheduled events:
+1. Event name: dinner party / Event time: 2024-10-10 / Event venue: Alice's House / Done: Y
+
+------------------------
+Enter a command: Event not found!
------------------------
Enter a command: Thank you for using EventManagerCLI. Goodbye!
------------------------
diff --git a/text-ui-test/input.txt b/text-ui-test/input.txt
index 88bcfb3424..639938715f 100644
--- a/text-ui-test/input.txt
+++ b/text-ui-test/input.txt
@@ -4,4 +4,7 @@ list
add
add -e dinner party -t 2024-10-10 -v Alice's House
list
+mark -e dinner party -s done
+list
+mark -e Saturday brunch -s done
exit
From 37dd8e690212de6cb721e419f61c726486f3b842 Mon Sep 17 00:00:00 2001
From: KuanHsienn
Date: Sun, 20 Oct 2024 21:28:33 +0800
Subject: [PATCH 158/619] Add JUnit test cases
---
.../seedu/manager/command/AddCommandTest.java | 8 ++++++++
.../seedu/manager/command/RemoveCommandTest.java | 9 +++++++++
.../java/seedu/manager/parser/ParserTest.java | 16 ++++++++++++++++
3 files changed, 33 insertions(+)
diff --git a/src/test/java/seedu/manager/command/AddCommandTest.java b/src/test/java/seedu/manager/command/AddCommandTest.java
index b7da30b8cd..ffecbdcf0f 100644
--- a/src/test/java/seedu/manager/command/AddCommandTest.java
+++ b/src/test/java/seedu/manager/command/AddCommandTest.java
@@ -7,6 +7,14 @@
public class AddCommandTest {
+ @Test
+ public void add_event_success() {
+ EventList eventList = new EventList();
+
+ eventList.addEvent("Event 1", "2024-20-10 21:00", "Venue A");
+ assertEquals(1, eventList.getListSize());
+ }
+
@Test
public void add_twoParticipant_success() {
EventList eventList = new EventList();
diff --git a/src/test/java/seedu/manager/command/RemoveCommandTest.java b/src/test/java/seedu/manager/command/RemoveCommandTest.java
index 06769084df..abc343bb02 100644
--- a/src/test/java/seedu/manager/command/RemoveCommandTest.java
+++ b/src/test/java/seedu/manager/command/RemoveCommandTest.java
@@ -7,6 +7,15 @@
public class RemoveCommandTest {
+ @Test
+ public void remove_event_success() {
+ EventList eventList = new EventList();
+
+ eventList.addEvent("Event 1", "2024-20-10 21:00", "Venue A");
+ eventList.addEvent("Event 2", "2024-20-10 21:00", "Venue B");
+ eventList.removeEvent("Event 2");
+ assertEquals(1, eventList.getListSize());
+ }
@Test
public void remove_oneParticipant_success() {
EventList eventList = new EventList();
diff --git a/src/test/java/seedu/manager/parser/ParserTest.java b/src/test/java/seedu/manager/parser/ParserTest.java
index b8fc075990..b1d93b374f 100644
--- a/src/test/java/seedu/manager/parser/ParserTest.java
+++ b/src/test/java/seedu/manager/parser/ParserTest.java
@@ -45,6 +45,22 @@ public void parseCommand_listWord_list() {
assertInstanceOf(ListCommand.class, command);
}
+ @Test
+ public void parseCommand_addlWord_add() {
+ Parser parser = new Parser();
+ Command command = parser.parseCommand("add");
+
+ assertInstanceOf(AddCommand.class, command);
+ }
+
+ @Test
+ public void parseCommand_removeWord_remove() {
+ Parser parser = new Parser();
+ Command command = parser.parseCommand("remove");
+
+ assertInstanceOf(RemoveCommand.class, command);
+ }
+
@Test
public void addCommand_addEvent_add() {
Parser parser = new Parser();
From c6d9cc311092a501bc8bac958582eed22ea8a705 Mon Sep 17 00:00:00 2001
From: KuanHsienn <141622026+KuanHsienn@users.noreply.github.com>
Date: Sun, 20 Oct 2024 21:53:54 +0800
Subject: [PATCH 159/619] Revert "Add JUnit test for addEvent and removeEvent"
---
.../seedu/manager/command/AddCommandTest.java | 8 --------
.../seedu/manager/command/RemoveCommandTest.java | 9 ---------
.../java/seedu/manager/parser/ParserTest.java | 16 ----------------
3 files changed, 33 deletions(-)
diff --git a/src/test/java/seedu/manager/command/AddCommandTest.java b/src/test/java/seedu/manager/command/AddCommandTest.java
index ffecbdcf0f..b7da30b8cd 100644
--- a/src/test/java/seedu/manager/command/AddCommandTest.java
+++ b/src/test/java/seedu/manager/command/AddCommandTest.java
@@ -7,14 +7,6 @@
public class AddCommandTest {
- @Test
- public void add_event_success() {
- EventList eventList = new EventList();
-
- eventList.addEvent("Event 1", "2024-20-10 21:00", "Venue A");
- assertEquals(1, eventList.getListSize());
- }
-
@Test
public void add_twoParticipant_success() {
EventList eventList = new EventList();
diff --git a/src/test/java/seedu/manager/command/RemoveCommandTest.java b/src/test/java/seedu/manager/command/RemoveCommandTest.java
index abc343bb02..06769084df 100644
--- a/src/test/java/seedu/manager/command/RemoveCommandTest.java
+++ b/src/test/java/seedu/manager/command/RemoveCommandTest.java
@@ -7,15 +7,6 @@
public class RemoveCommandTest {
- @Test
- public void remove_event_success() {
- EventList eventList = new EventList();
-
- eventList.addEvent("Event 1", "2024-20-10 21:00", "Venue A");
- eventList.addEvent("Event 2", "2024-20-10 21:00", "Venue B");
- eventList.removeEvent("Event 2");
- assertEquals(1, eventList.getListSize());
- }
@Test
public void remove_oneParticipant_success() {
EventList eventList = new EventList();
diff --git a/src/test/java/seedu/manager/parser/ParserTest.java b/src/test/java/seedu/manager/parser/ParserTest.java
index b1d93b374f..b8fc075990 100644
--- a/src/test/java/seedu/manager/parser/ParserTest.java
+++ b/src/test/java/seedu/manager/parser/ParserTest.java
@@ -45,22 +45,6 @@ public void parseCommand_listWord_list() {
assertInstanceOf(ListCommand.class, command);
}
- @Test
- public void parseCommand_addlWord_add() {
- Parser parser = new Parser();
- Command command = parser.parseCommand("add");
-
- assertInstanceOf(AddCommand.class, command);
- }
-
- @Test
- public void parseCommand_removeWord_remove() {
- Parser parser = new Parser();
- Command command = parser.parseCommand("remove");
-
- assertInstanceOf(RemoveCommand.class, command);
- }
-
@Test
public void addCommand_addEvent_add() {
Parser parser = new Parser();
From a9a8f7f9d0d993d7184672c5d945499752f16fb7 Mon Sep 17 00:00:00 2001
From: KuanHsienn
Date: Sun, 20 Oct 2024 22:09:36 +0800
Subject: [PATCH 160/619] Add JUnit test
---
.../java/seedu/manager/command/AddCommandTest.java | 8 ++++++++
.../java/seedu/manager/command/RemoveCommandTest.java | 10 ++++++++++
2 files changed, 18 insertions(+)
diff --git a/src/test/java/seedu/manager/command/AddCommandTest.java b/src/test/java/seedu/manager/command/AddCommandTest.java
index b7da30b8cd..ffecbdcf0f 100644
--- a/src/test/java/seedu/manager/command/AddCommandTest.java
+++ b/src/test/java/seedu/manager/command/AddCommandTest.java
@@ -7,6 +7,14 @@
public class AddCommandTest {
+ @Test
+ public void add_event_success() {
+ EventList eventList = new EventList();
+
+ eventList.addEvent("Event 1", "2024-20-10 21:00", "Venue A");
+ assertEquals(1, eventList.getListSize());
+ }
+
@Test
public void add_twoParticipant_success() {
EventList eventList = new EventList();
diff --git a/src/test/java/seedu/manager/command/RemoveCommandTest.java b/src/test/java/seedu/manager/command/RemoveCommandTest.java
index 06769084df..61af8db791 100644
--- a/src/test/java/seedu/manager/command/RemoveCommandTest.java
+++ b/src/test/java/seedu/manager/command/RemoveCommandTest.java
@@ -7,6 +7,16 @@
public class RemoveCommandTest {
+ @Test
+ public void remove_event_success() {
+ EventList eventList = new EventList();
+
+ eventList.addEvent("Event 1", "2024-20-10 21:00", "Venue A");
+ eventList.addEvent("Event 2", "2024-20-10 21:00", "Venue B");
+ eventList.removeEvent("Event 2");
+ assertEquals(1, eventList.getListSize());
+ }
+
@Test
public void remove_oneParticipant_success() {
EventList eventList = new EventList();
From b3dbfb487f30704b3f348572f15d02a748892f70 Mon Sep 17 00:00:00 2001
From: jemehgoh
Date: Mon, 21 Oct 2024 13:01:15 +0800
Subject: [PATCH 161/619] Add new Item and Participant classes
---
build.gradle | 1 +
src/main/java/seedu/manager/item/Item.java | 56 +++++++++++++++++++
.../java/seedu/manager/item/Participant.java | 18 ++++++
3 files changed, 75 insertions(+)
create mode 100644 src/main/java/seedu/manager/item/Item.java
create mode 100644 src/main/java/seedu/manager/item/Participant.java
diff --git a/build.gradle b/build.gradle
index f0dd47388b..000d437b3e 100644
--- a/build.gradle
+++ b/build.gradle
@@ -43,4 +43,5 @@ checkstyle {
run{
standardInput = System.in
+ enableAssertions = true
}
diff --git a/src/main/java/seedu/manager/item/Item.java b/src/main/java/seedu/manager/item/Item.java
new file mode 100644
index 0000000000..f4fe4eb36c
--- /dev/null
+++ b/src/main/java/seedu/manager/item/Item.java
@@ -0,0 +1,56 @@
+package seedu.manager.item;
+
+/**
+ * Represents an item to be stored in an item list for an event
+ */
+public class Item {
+ private final String name;
+ private boolean isPresent;
+
+ /**
+ * Constructs a new Item with a given name
+ *
+ * @param name the given name
+ */
+ public Item(String name) {
+ this.name = name;
+ this.isPresent = false;
+ }
+
+ /**
+ * Returns the name of the item.
+ *
+ * @return the name of the item
+ */
+ public String getName() {
+ return name;
+ }
+
+ /**
+ * Sets the item as present or not present.
+ *
+ * @param isPresent whether the item is present or not present
+ */
+ public void setPresent(boolean isPresent) {
+ this.isPresent = isPresent;
+ }
+
+ /**
+ * Returns "present" if isPresent is true, "not present" otherwise.
+ *
+ * @return "present" if isPresent is true, "not present" otherwise.
+ */
+ public String markIfPresent() {
+ return (this.isPresent) ? "present" : "not present";
+ }
+
+ /**
+ * Returns a formatted string of the item
+ *
+ * @return a formatted string of the item
+ */
+ @Override
+ public String toString() {
+ return String.format("%s (status: %s)", this.name, this.markIfPresent());
+ }
+}
diff --git a/src/main/java/seedu/manager/item/Participant.java b/src/main/java/seedu/manager/item/Participant.java
new file mode 100644
index 0000000000..376fe11a5f
--- /dev/null
+++ b/src/main/java/seedu/manager/item/Participant.java
@@ -0,0 +1,18 @@
+package seedu.manager.item;
+
+import seedu.manager.event.Event;
+
+/**
+ * Represents an event participant, in the participant list of an {@link Event}.
+ */
+public class Participant extends Item {
+
+ /**
+ * Constructs a new Item with a given name
+ *
+ * @param name the given name
+ */
+ public Participant(String name) {
+ super(name);
+ }
+}
From a268b262961bf784df9f9fa7a8a8f9186091b85e Mon Sep 17 00:00:00 2001
From: jemehgoh
Date: Mon, 21 Oct 2024 13:06:46 +0800
Subject: [PATCH 162/619] Update Event and ViewCommand to use Participant class
---
src/main/java/seedu/manager/command/ViewCommand.java | 5 +++--
src/main/java/seedu/manager/event/Event.java | 12 ++++++++----
2 files changed, 11 insertions(+), 6 deletions(-)
diff --git a/src/main/java/seedu/manager/command/ViewCommand.java b/src/main/java/seedu/manager/command/ViewCommand.java
index 1a264658b2..5bb7dc7d12 100644
--- a/src/main/java/seedu/manager/command/ViewCommand.java
+++ b/src/main/java/seedu/manager/command/ViewCommand.java
@@ -1,6 +1,7 @@
package seedu.manager.command;
import seedu.manager.event.Event;
+import seedu.manager.item.Participant;
import java.util.Optional;
@@ -36,8 +37,8 @@ public void execute() {
StringBuilder outputMessage = new StringBuilder(
String.format(VIEW_MESSAGE, eventToView.get().getParticipantCount(), eventName) + "\n");
int count = 1;
- for (String participant : eventToView.get().getParticipantList()) {
- outputMessage.append(String.format("%d. %s\n", count, participant));
+ for (Participant participant : eventToView.get().getParticipantList()) {
+ outputMessage.append(String.format("%d. %s\n", count, participant.toString()));
count++;
}
diff --git a/src/main/java/seedu/manager/event/Event.java b/src/main/java/seedu/manager/event/Event.java
index a7d9134eb2..9b937fcd37 100644
--- a/src/main/java/seedu/manager/event/Event.java
+++ b/src/main/java/seedu/manager/event/Event.java
@@ -1,5 +1,7 @@
package seedu.manager.event;
+import seedu.manager.item.Participant;
+
import java.util.ArrayList;
/**
@@ -7,7 +9,7 @@
* It provides methods to access and modify the time and venue of the event.
*/
public class Event {
- protected ArrayList participantList;
+ protected ArrayList participantList;
private final String eventName;
private String eventTime;
private String eventVenue;
@@ -44,7 +46,8 @@ public Event(String eventName, String eventTime, String eventVenue) {
* @param participantName the name of the participant to be added to the list.
*/
public void addParticipant(String participantName) {
- this.participantList.add(participantName);
+ Participant participant = new Participant(participantName);
+ this.participantList.add(participant);
}
/**
@@ -62,7 +65,8 @@ public void addParticipant(String participantName) {
* {@code false} if the participant was not found in the list.
*/
public boolean removeParticipant(String participantName) {
- return this.participantList.remove(participantName);
+ Participant participant = new Participant(participantName);
+ return this.participantList.remove(participant);
}
/**
@@ -95,7 +99,7 @@ public String getEventVenue() {
return eventVenue;
}
- public ArrayList getParticipantList() {
+ public ArrayList getParticipantList() {
return participantList;
}
From 6e0f5e2c3428c265beccaf27aaf21f8463b250ee Mon Sep 17 00:00:00 2001
From: jemehgoh
Date: Mon, 21 Oct 2024 13:20:17 +0800
Subject: [PATCH 163/619] Merge Participant class into its parent Item class
---
src/main/java/seedu/manager/item/Item.java | 56 -------------------
.../java/seedu/manager/item/Participant.java | 46 ++++++++++++++-
2 files changed, 43 insertions(+), 59 deletions(-)
delete mode 100644 src/main/java/seedu/manager/item/Item.java
diff --git a/src/main/java/seedu/manager/item/Item.java b/src/main/java/seedu/manager/item/Item.java
deleted file mode 100644
index f4fe4eb36c..0000000000
--- a/src/main/java/seedu/manager/item/Item.java
+++ /dev/null
@@ -1,56 +0,0 @@
-package seedu.manager.item;
-
-/**
- * Represents an item to be stored in an item list for an event
- */
-public class Item {
- private final String name;
- private boolean isPresent;
-
- /**
- * Constructs a new Item with a given name
- *
- * @param name the given name
- */
- public Item(String name) {
- this.name = name;
- this.isPresent = false;
- }
-
- /**
- * Returns the name of the item.
- *
- * @return the name of the item
- */
- public String getName() {
- return name;
- }
-
- /**
- * Sets the item as present or not present.
- *
- * @param isPresent whether the item is present or not present
- */
- public void setPresent(boolean isPresent) {
- this.isPresent = isPresent;
- }
-
- /**
- * Returns "present" if isPresent is true, "not present" otherwise.
- *
- * @return "present" if isPresent is true, "not present" otherwise.
- */
- public String markIfPresent() {
- return (this.isPresent) ? "present" : "not present";
- }
-
- /**
- * Returns a formatted string of the item
- *
- * @return a formatted string of the item
- */
- @Override
- public String toString() {
- return String.format("%s (status: %s)", this.name, this.markIfPresent());
- }
-}
diff --git a/src/main/java/seedu/manager/item/Participant.java b/src/main/java/seedu/manager/item/Participant.java
index 376fe11a5f..9d6de3a575 100644
--- a/src/main/java/seedu/manager/item/Participant.java
+++ b/src/main/java/seedu/manager/item/Participant.java
@@ -5,14 +5,54 @@
/**
* Represents an event participant, in the participant list of an {@link Event}.
*/
-public class Participant extends Item {
+public class Participant {
+ private final String name;
+ private boolean isPresent;
/**
- * Constructs a new Item with a given name
+ * Constructs a new Participant with a given name
*
* @param name the given name
*/
public Participant(String name) {
- super(name);
+ this.name = name;
+ this.isPresent = false;
+ }
+
+ /**
+ * Returns the name of the participant.
+ *
+ * @return the name of the participant
+ */
+ public String getName() {
+ return name;
+ }
+
+ /**
+ * Sets the participant as present or not present.
+ *
+ * @param isPresent whether the participant is present or not present
+ */
+ public void setPresent(boolean isPresent) {
+ this.isPresent = isPresent;
+ }
+
+ /**
+ * Returns "present" if isPresent is true, "not present" otherwise.
+ *
+ * @return "present" if isPresent is true, "not present" otherwise.
+ */
+ public String markIfPresent() {
+ return (this.isPresent) ? "present" : "not present";
+ }
+
+ /**
+ * Returns a formatted string of the item
+ *
+ * @return a formatted string of the item
+ */
+ @Override
+ public String toString() {
+ return String.format("%s (status: %s)", this.name, this.markIfPresent());
}
}
From 8451134cad0f68d84515a8122931c4db77b166b6 Mon Sep 17 00:00:00 2001
From: jemehgoh
Date: Mon, 21 Oct 2024 16:58:59 +0800
Subject: [PATCH 164/619] Add unit tests for Participant and update existing
unit and I/O tests
---
.../seedu/manager/command/MarkCommand.java | 6 ++--
src/main/java/seedu/manager/event/Event.java | 4 +--
.../manager/command/ViewCommandTest.java | 2 +-
.../seedu/manager/item/ParticipantTest.java | 29 +++++++++++++++++++
text-ui-test/EXPECTED.TXT | 6 ++++
text-ui-test/input.txt | 2 ++
6 files changed, 43 insertions(+), 6 deletions(-)
create mode 100644 src/test/java/seedu/manager/item/ParticipantTest.java
diff --git a/src/main/java/seedu/manager/command/MarkCommand.java b/src/main/java/seedu/manager/command/MarkCommand.java
index 58db304b6f..4a18c6b782 100644
--- a/src/main/java/seedu/manager/command/MarkCommand.java
+++ b/src/main/java/seedu/manager/command/MarkCommand.java
@@ -12,10 +12,10 @@ public class MarkCommand extends Command {
private static final String EVENT_MARK_MESSAGE = "Event marked as done";
private static final String EVENT_UNMARK_MESSAGE = "Event marked not done";
- private static final String INVALID_EVENT_MESSAGE = "Event not found!";
+ protected static final String INVALID_EVENT_MESSAGE = "Event not found!";
- private String eventName;
- private boolean toMark;
+ protected String eventName;
+ protected boolean toMark;
/**
* Constructs a new MarkCommand with the given event name
diff --git a/src/main/java/seedu/manager/event/Event.java b/src/main/java/seedu/manager/event/Event.java
index 9b937fcd37..26f1c9dafb 100644
--- a/src/main/java/seedu/manager/event/Event.java
+++ b/src/main/java/seedu/manager/event/Event.java
@@ -65,8 +65,8 @@ public void addParticipant(String participantName) {
* {@code false} if the participant was not found in the list.
*/
public boolean removeParticipant(String participantName) {
- Participant participant = new Participant(participantName);
- return this.participantList.remove(participant);
+ return this.participantList.removeIf((participant) ->
+ (participant.getName().equalsIgnoreCase(participantName)));
}
/**
diff --git a/src/test/java/seedu/manager/command/ViewCommandTest.java b/src/test/java/seedu/manager/command/ViewCommandTest.java
index f20a802437..221ff82ff5 100644
--- a/src/test/java/seedu/manager/command/ViewCommandTest.java
+++ b/src/test/java/seedu/manager/command/ViewCommandTest.java
@@ -33,7 +33,7 @@ public void setUp() {
@Test
public void execute_twoEvents_success() {
String expectedMessage = "There are 1 participants in Event 1! Here are your participants:\n"
- + "1. Tom\n";
+ + "1. Tom (status: not present)\n";
assertEquals(expectedMessage, viewCommand.getMessage());
assertFalse(viewCommand.getCanExit());
diff --git a/src/test/java/seedu/manager/item/ParticipantTest.java b/src/test/java/seedu/manager/item/ParticipantTest.java
new file mode 100644
index 0000000000..ab6e948752
--- /dev/null
+++ b/src/test/java/seedu/manager/item/ParticipantTest.java
@@ -0,0 +1,29 @@
+package seedu.manager.item;
+
+import org.junit.jupiter.api.Test;
+
+import static org.junit.jupiter.api.Assertions.*;
+
+class ParticipantTest {
+
+ @Test
+ public void setPresent_setTrue_present() {
+ Participant participant = new Participant("Participant");
+ participant.setPresent(true);
+ assertEquals("present", participant.markIfPresent());
+ }
+
+ @Test
+ public void setPresent_setFalse_notPresent() {
+ Participant participant = new Participant("Participant");
+ participant.setPresent(false);
+ assertEquals("not present", participant.markIfPresent());
+ }
+
+ @Test
+ public void toString_setTrue_present() {
+ Participant participant = new Participant("Participant");
+ participant.setPresent(true);
+ assertEquals("Participant (status: present)", participant.toString());
+ }
+}
\ No newline at end of file
diff --git a/text-ui-test/EXPECTED.TXT b/text-ui-test/EXPECTED.TXT
index 3163743eff..cdb5199831 100644
--- a/text-ui-test/EXPECTED.TXT
+++ b/text-ui-test/EXPECTED.TXT
@@ -32,6 +32,12 @@ Enter a command: There are 1 events in your list! Here are your scheduled events
------------------------
Enter a command: Event not found!
+------------------------
+Enter a command: Participant added successfully
+------------------------
+Enter a command: There are 1 participants in dinner party! Here are your participants:
+1. Mary (status: not present)
+
------------------------
Enter a command: Thank you for using EventManagerCLI. Goodbye!
------------------------
diff --git a/text-ui-test/input.txt b/text-ui-test/input.txt
index 639938715f..e312c513f5 100644
--- a/text-ui-test/input.txt
+++ b/text-ui-test/input.txt
@@ -7,4 +7,6 @@ list
mark -e dinner party -s done
list
mark -e Saturday brunch -s done
+add -p Mary -e dinner party
+view -e dinner party
exit
From 59215ced23d6c83f528bfdcf40a04bb270b2d1af Mon Sep 17 00:00:00 2001
From: jemehgoh
Date: Mon, 21 Oct 2024 17:07:28 +0800
Subject: [PATCH 165/619] Fix Checkstyle violations
---
src/main/java/seedu/manager/command/MarkCommand.java | 2 +-
src/test/java/seedu/manager/item/ParticipantTest.java | 4 ++--
2 files changed, 3 insertions(+), 3 deletions(-)
diff --git a/src/main/java/seedu/manager/command/MarkCommand.java b/src/main/java/seedu/manager/command/MarkCommand.java
index 4a18c6b782..814f7e197a 100644
--- a/src/main/java/seedu/manager/command/MarkCommand.java
+++ b/src/main/java/seedu/manager/command/MarkCommand.java
@@ -12,7 +12,7 @@ public class MarkCommand extends Command {
private static final String EVENT_MARK_MESSAGE = "Event marked as done";
private static final String EVENT_UNMARK_MESSAGE = "Event marked not done";
- protected static final String INVALID_EVENT_MESSAGE = "Event not found!";
+ private static final String INVALID_EVENT_MESSAGE = "Event not found!";
protected String eventName;
protected boolean toMark;
diff --git a/src/test/java/seedu/manager/item/ParticipantTest.java b/src/test/java/seedu/manager/item/ParticipantTest.java
index ab6e948752..b90fefbdf1 100644
--- a/src/test/java/seedu/manager/item/ParticipantTest.java
+++ b/src/test/java/seedu/manager/item/ParticipantTest.java
@@ -2,7 +2,7 @@
import org.junit.jupiter.api.Test;
-import static org.junit.jupiter.api.Assertions.*;
+import static org.junit.jupiter.api.Assertions.assertEquals;
class ParticipantTest {
@@ -26,4 +26,4 @@ public void toString_setTrue_present() {
participant.setPresent(true);
assertEquals("Participant (status: present)", participant.toString());
}
-}
\ No newline at end of file
+}
From bf84fa2a045d24b8dbbdf2194e0c8f2b88481a74 Mon Sep 17 00:00:00 2001
From: jemehgoh
Date: Mon, 21 Oct 2024 17:45:25 +0800
Subject: [PATCH 166/619] Replace InvalidCommand with an exception
User command errors are handled by an InvalidCommand, which then passes
the error message back to the user. This makes the code less readable,
as it is not obvious that InvalidCommand handles errors.
Let's replace InvalidCommand with an exception, that is handled by the
UI. This way, the code is easier to read as it is clearer how the
user command errors are handled.
---
src/main/java/seedu/manager/Main.java | 17 +++--
.../seedu/manager/command/InvalidCommand.java | 26 --------
.../exception/InvalidCommandException.java | 14 +++++
.../java/seedu/manager/parser/Parser.java | 63 ++++++++++---------
src/main/java/seedu/manager/ui/Ui.java | 12 +++-
.../java/seedu/manager/parser/ParserTest.java | 28 +++++----
6 files changed, 86 insertions(+), 74 deletions(-)
delete mode 100644 src/main/java/seedu/manager/command/InvalidCommand.java
create mode 100644 src/main/java/seedu/manager/exception/InvalidCommandException.java
diff --git a/src/main/java/seedu/manager/Main.java b/src/main/java/seedu/manager/Main.java
index 9c202a0e36..b385b00802 100644
--- a/src/main/java/seedu/manager/Main.java
+++ b/src/main/java/seedu/manager/Main.java
@@ -2,6 +2,7 @@
import seedu.manager.command.Command;
import seedu.manager.event.EventList;
+import seedu.manager.exception.InvalidCommandException;
import seedu.manager.parser.Parser;
import seedu.manager.ui.Ui;
@@ -27,13 +28,17 @@ private static void runCommandLoop() {
Command command;
boolean isGettingCommands = true;
while (isGettingCommands){
- String userCommandText = ui.getCommand();
- command = new Parser().parseCommand(userCommandText);
- command.setData(events);
- command.execute();
- ui.showOutputToUser(command);
+ try {
+ String userCommandText = ui.getCommand();
+ command = new Parser().parseCommand(userCommandText);
+ command.setData(events);
+ command.execute();
+ ui.showOutputToUser(command);
- isGettingCommands = !command.getCanExit();
+ isGettingCommands = !command.getCanExit();
+ } catch (InvalidCommandException exception) {
+ ui.showErrorMessageToUser(exception);
+ }
}
}
}
diff --git a/src/main/java/seedu/manager/command/InvalidCommand.java b/src/main/java/seedu/manager/command/InvalidCommand.java
deleted file mode 100644
index b3a97be87f..0000000000
--- a/src/main/java/seedu/manager/command/InvalidCommand.java
+++ /dev/null
@@ -1,26 +0,0 @@
-package seedu.manager.command;
-
-/**
- * Represents an invalid command that cannot be executed
- */
-public class InvalidCommand extends Command {
- private final String errorMessage;
-
- /**
- * Constructs a new invalid command with a given error message
- *
- * @param errorMessage The specified error message
- */
- public InvalidCommand(String errorMessage) {
- super(false);
- this.errorMessage = errorMessage;
- }
-
- /**
- * Executes the invalid command
- */
- @Override
- public void execute() {
- this.message = this.errorMessage;
- }
-}
diff --git a/src/main/java/seedu/manager/exception/InvalidCommandException.java b/src/main/java/seedu/manager/exception/InvalidCommandException.java
new file mode 100644
index 0000000000..cc2680b7e4
--- /dev/null
+++ b/src/main/java/seedu/manager/exception/InvalidCommandException.java
@@ -0,0 +1,14 @@
+package seedu.manager.exception;
+
+/**
+ * Signals that an entered command is invalid
+ */
+public class InvalidCommandException extends RuntimeException {
+
+ /**
+ * @param message contains information on how the command is invalid
+ */
+ public InvalidCommandException(String message) {
+ super(message);
+ }
+}
diff --git a/src/main/java/seedu/manager/parser/Parser.java b/src/main/java/seedu/manager/parser/Parser.java
index 04f3ec0023..b0e6dee41a 100644
--- a/src/main/java/seedu/manager/parser/Parser.java
+++ b/src/main/java/seedu/manager/parser/Parser.java
@@ -2,13 +2,13 @@
import seedu.manager.command.Command;
import seedu.manager.command.AddCommand;
-import seedu.manager.command.InvalidCommand;
import seedu.manager.command.MarkCommand;
import seedu.manager.command.RemoveCommand;
import seedu.manager.command.ExitCommand;
import seedu.manager.command.MenuCommand;
import seedu.manager.command.ListCommand;
import seedu.manager.command.ViewCommand;
+import seedu.manager.exception.InvalidCommandException;
import java.util.logging.Logger;
@@ -44,11 +44,12 @@ public class Parser {
""";
/**
- * Returns a command based on the given user command string
+ * Returns a command based on the given user command string.
*
- * @param command The given command string from the user
+ * @param command The given command string from the user.
+ * @throws InvalidCommandException if the given command string cannot be parsed to a valid command.
*/
- public Command parseCommand(String command){
+ public Command parseCommand(String command) throws InvalidCommandException {
String[] commandParts = command.split(" ");
String commandWord = commandParts[0];
@@ -68,7 +69,7 @@ public Command parseCommand(String command){
case MarkCommand.COMMAND_WORD:
return parseMarkCommand(command, commandParts);
default:
- return new InvalidCommand(INVALID_COMMAND_MESSAGE);
+ throw new InvalidCommandException(INVALID_COMMAND_MESSAGE);
}
}
@@ -80,15 +81,16 @@ public Command parseCommand(String command){
* flag is {@code "-e"}, it splits the input string into parts to create an
* {@link AddCommand} for adding an event. If the command flag is {@code "-p"},
* it creates an {@link AddCommand} for adding a participant to an event. If neither
- * flag is matched, it returns an {@link InvalidCommand} with an error message.
+ * flag is matched, it throws a {@link InvalidCommandException} with an error message.
*
*
* @param input the input string containing the command details.
* @param commandParts an array of strings representing the parsed command parts,
* where the second element is the command flag.
* @return a {@link Command} object representing the parsed command.
+ * @throws InvalidCommandException if the flags are not matched in the command parts.
*/
- public Command parseAddCommand(String input, String[] commandParts) {
+ public Command parseAddCommand(String input, String[] commandParts) throws InvalidCommandException {
assert commandParts[0].equalsIgnoreCase(AddCommand.COMMAND_WORD);
try {
String commandFlag = commandParts[1];
@@ -107,10 +109,10 @@ public Command parseAddCommand(String input, String[] commandParts) {
}
logger.log(WARNING,"Invalid command format");
- return new InvalidCommand(INVALID_ADD_MESSAGE);
+ throw new InvalidCommandException(INVALID_ADD_MESSAGE);
} catch (IndexOutOfBoundsException exception) {
logger.log(WARNING,"Invalid command format");
- return new InvalidCommand(INVALID_ADD_MESSAGE);
+ throw new InvalidCommandException(INVALID_ADD_MESSAGE);
}
}
@@ -122,15 +124,16 @@ public Command parseAddCommand(String input, String[] commandParts) {
* flag is {@code "-e"}, it splits the input string to create a {@link RemoveCommand}
* for removing an event. If the command flag is {@code "-p"}, it creates a
* {@link RemoveCommand} for removing a participant from an event. If neither flag
- * is matched, it returns an {@link InvalidCommand} with an error message.
+ * is matched, it throws an {@link InvalidCommandException} with an error message.
*
*
* @param input the input string containing the command details.
* @param commandParts an array of strings representing the parsed command parts,
* where the second element is the command flag.
* @return a {@link Command} object representing the parsed command.
+ * @throws InvalidCommandException if the flags are not matched in the command parts.
*/
- private Command parseRemoveCommand(String input, String[] commandParts) {
+ private Command parseRemoveCommand(String input, String[] commandParts) throws InvalidCommandException {
assert commandParts[0].equalsIgnoreCase(RemoveCommand.COMMAND_WORD);
try {
String commandFlag = commandParts[1];
@@ -145,10 +148,10 @@ private Command parseRemoveCommand(String input, String[] commandParts) {
}
logger.log(WARNING,"Invalid command format");
- return new InvalidCommand(INVALID_REMOVE_MESSAGE);
+ throw new InvalidCommandException(INVALID_REMOVE_MESSAGE);
} catch (IndexOutOfBoundsException exception) {
logger.log(WARNING,"Invalid command format");
- return new InvalidCommand(INVALID_REMOVE_MESSAGE);
+ throw new InvalidCommandException(INVALID_REMOVE_MESSAGE);
}
}
@@ -159,15 +162,16 @@ private Command parseRemoveCommand(String input, String[] commandParts) {
* This method checks the command flag extracted from the command parts. If the command
* flag is {@code "-e"}, it splits the input string to create a {@link ViewCommand}
* for viewing the participants in the event.
- * Otherwise, it returns an {@link InvalidCommand} with an error message.
+ * Otherwise, it throws an {@link InvalidCommandException} with an error message.
*
*
* @param input the input string containing the command details.
* @param commandParts an array of strings representing the parsed command parts,
* where the second element is the command flag.
* @return a {@link Command} object representing the parsed command.
+ * @throws InvalidCommandException if the flag is not matched.
*/
- private Command parseViewCommand(String input, String[] commandParts) {
+ private Command parseViewCommand(String input, String[] commandParts) throws InvalidCommandException {
assert commandParts[0].equalsIgnoreCase(ViewCommand.COMMAND_WORD);
try {
String commandFlag = commandParts[1];
@@ -178,10 +182,10 @@ private Command parseViewCommand(String input, String[] commandParts) {
}
logger.log(WARNING,"Invalid command format");
- return new InvalidCommand(INVALID_VIEW_MESSAGE);
+ throw new InvalidCommandException(INVALID_VIEW_MESSAGE);
} catch (IndexOutOfBoundsException exception) {
logger.log(WARNING,"Invalid command format");
- return new InvalidCommand(INVALID_VIEW_MESSAGE);
+ throw new InvalidCommandException(INVALID_VIEW_MESSAGE);
}
}
@@ -191,7 +195,7 @@ private Command parseViewCommand(String input, String[] commandParts) {
*
* This method checks the command flag extracted from the command parts. If the command
* flag is {@code "-e"}, it splits the input string to create a {@link MarkCommand}
- * to mark an event done or undone. Otherwise, it returns an {@link InvalidCommand}
+ * to mark an event done or undone. Otherwise, it throws an {@link InvalidCommandException}
* with an error message.
*
*
@@ -199,8 +203,9 @@ private Command parseViewCommand(String input, String[] commandParts) {
* @param commandParts an array of strings representing the parsed command parts,
* where the second element is the command flag.
* @return a {@link Command} object representing the parsed command.
+ * @throws InvalidCommandException if the flag is not matched.
*/
- private Command parseMarkCommand(String input, String[] commandParts) {
+ private Command parseMarkCommand(String input, String[] commandParts) throws InvalidCommandException {
assert commandParts[0].equalsIgnoreCase(MarkCommand.COMMAND_WORD);
try {
String commandFlag = commandParts[1];
@@ -211,30 +216,30 @@ private Command parseMarkCommand(String input, String[] commandParts) {
}
logger.log(WARNING,"Invalid command format");
- return new InvalidCommand(INVALID_MARK_MESSAGE);
+ throw new InvalidCommandException(INVALID_MARK_MESSAGE);
} catch (IndexOutOfBoundsException exception) {
logger.log(WARNING,"Invalid command format");
- return new InvalidCommand(INVALID_MARK_MESSAGE);
+ throw new InvalidCommandException(INVALID_MARK_MESSAGE);
}
}
/**
- * Returns a {@link MarkCommand} with a given event name and status, or an
- * {@link InvalidCommand} if the status is invalid
+ * Returns a {@link MarkCommand} with a given event name and status. If the given status is invalid,
+ * throws an {@link InvalidCommandException}.
*
- * @param eventName the given event name
- * @param status the given event status
- * @return a MarkCommand with a given event name and status, or an
- * InvalidCommand if the status is invalid
+ * @param eventName the given event name.
+ * @param status the given event status.
+ * @return a MarkCommand with a given event name and status
+ * @throws InvalidCommandException if the given status is invalid.
*/
- private Command getMarkEventCommand(String eventName, String status) {
+ private Command getMarkEventCommand(String eventName, String status) throws InvalidCommandException {
if (status.equalsIgnoreCase("done")) {
return new MarkCommand(eventName, true);
} else if (status.equalsIgnoreCase("undone")) {
return new MarkCommand(eventName, false);
} else {
logger.log(WARNING,"Invalid status keyword");
- return new InvalidCommand(INVALID_EVENT_STATUS_MESSAGE);
+ throw new InvalidCommandException(INVALID_EVENT_STATUS_MESSAGE);
}
}
}
diff --git a/src/main/java/seedu/manager/ui/Ui.java b/src/main/java/seedu/manager/ui/Ui.java
index 0251643da3..03f091e8bd 100644
--- a/src/main/java/seedu/manager/ui/Ui.java
+++ b/src/main/java/seedu/manager/ui/Ui.java
@@ -37,10 +37,18 @@ public String getCommand() {
}
/**
- * show the output message a of command to the users.
+ * show the output message of a command to the users.
*/
- public void showOutputToUser(Command command){
+ public void showOutputToUser(Command command) {
System.out.println(command.getMessage());
System.out.println(SEPARATOR);
}
+
+ /**
+ * Shows the error message of an exception to the user.
+ */
+ public void showErrorMessageToUser(Exception exception) {
+ System.out.println(exception.getMessage());
+ System.out.println(SEPARATOR);
+ }
}
diff --git a/src/test/java/seedu/manager/parser/ParserTest.java b/src/test/java/seedu/manager/parser/ParserTest.java
index bbe8f8bd9a..bc1c5a5049 100644
--- a/src/test/java/seedu/manager/parser/ParserTest.java
+++ b/src/test/java/seedu/manager/parser/ParserTest.java
@@ -4,22 +4,24 @@
import seedu.manager.command.AddCommand;
import seedu.manager.command.Command;
import seedu.manager.command.ExitCommand;
-import seedu.manager.command.InvalidCommand;
import seedu.manager.command.MarkCommand;
import seedu.manager.command.MenuCommand;
import seedu.manager.command.ListCommand;
import seedu.manager.command.RemoveCommand;
+import seedu.manager.exception.InvalidCommandException;
import static org.junit.jupiter.api.Assertions.assertInstanceOf;
+import static org.junit.jupiter.api.Assertions.assertThrows;
class ParserTest {
@Test
public void parseCommand_invalidString_invalid() {
Parser parser = new Parser();
- Command command = parser.parseCommand("Hello world!");
+ String commandString = "Hello world!";
- assertInstanceOf(InvalidCommand.class, command);
+ assertThrows(InvalidCommandException.class,() -> {
+ parser.parseCommand(commandString);});
}
@Test
@@ -57,9 +59,10 @@ public void addCommand_addEvent_add() {
@Test
public void addCommand_addNoParameter_invalid() {
Parser parser = new Parser();
- Command command = parser.parseCommand("add");
+ String commandString = "add";
- assertInstanceOf(InvalidCommand.class, command);
+ assertThrows(InvalidCommandException.class,() -> {
+ parser.parseCommand(commandString);});
}
@Test
@@ -73,9 +76,10 @@ public void removeCommand_removeEvent_add() {
@Test
public void removeCommand_removeNoParameter_invalid() {
Parser parser = new Parser();
- Command command = parser.parseCommand("remove");
+ String commandString = "remove";
- assertInstanceOf(InvalidCommand.class, command);
+ assertThrows(InvalidCommandException.class,() -> {
+ parser.parseCommand(commandString);});
}
@Test
@@ -89,16 +93,18 @@ public void parseCommand_markEvent_mark() {
@Test
public void parseCommand_markEventNoStatus_invalid() {
Parser parser = new Parser();
- Command command = parser.parseCommand("mark -e event");
+ String commandString = "mark -e event";
- assertInstanceOf(InvalidCommand.class, command);
+ assertThrows(InvalidCommandException.class,() -> {
+ parser.parseCommand(commandString);});
}
@Test
public void parseCommand_markEventInvalidStatus_invalid() {
Parser parser = new Parser();
- Command command = parser.parseCommand("mark -e event -s yes");
+ String commandString = "mark -e event -s yes";
- assertInstanceOf(InvalidCommand.class, command);
+ assertThrows(InvalidCommandException.class,() -> {
+ parser.parseCommand(commandString);});
}
}
From 161e6ce7b665b1fd03bbcdeacedc1a13e3a43251 Mon Sep 17 00:00:00 2001
From: jemehgoh
Date: Mon, 21 Oct 2024 18:57:17 +0800
Subject: [PATCH 167/619] Add error handling for adding participants
When participants are added to events that are not present in the event
list, the program informs the user that the participant was added,
although neither the participant nor the event are stored in the
program. This is misleading to the user.
Let's amend the add participant command to show the user a message that
the adding failed for this case. This makes the add command more
inituitive to the user.
---
src/main/java/seedu/manager/command/AddCommand.java | 5 +++--
src/main/java/seedu/manager/event/EventList.java | 10 +++++++---
.../manager/exception/InvalidCommandException.java | 12 ++++++------
.../java/seedu/manager/command/AddCommandTest.java | 12 ++++++++++++
src/test/java/seedu/manager/parser/ParserTest.java | 2 +-
5 files changed, 29 insertions(+), 12 deletions(-)
diff --git a/src/main/java/seedu/manager/command/AddCommand.java b/src/main/java/seedu/manager/command/AddCommand.java
index ec379908d3..7c0d523d9d 100644
--- a/src/main/java/seedu/manager/command/AddCommand.java
+++ b/src/main/java/seedu/manager/command/AddCommand.java
@@ -8,6 +8,7 @@ public class AddCommand extends Command {
public static final String COMMAND_WORD = "add";
private static final String ADD_EVENT_MESSAGE = "Event added successfully";
private static final String ADD_PARTICIPANT_MESSAGE = "Participant added successfully";
+ private static final String ADD_FAILURE_MESSAGE = "Event not found!";
protected String eventName;
protected String time;
protected String venue;
@@ -56,8 +57,8 @@ public void execute() {
this.eventList.addEvent(this.eventName, this.time, this.venue);
this.message = ADD_EVENT_MESSAGE;
} else {
- this.eventList.addParticipantToEvent(this.participantName, this.eventName);
- this.message = ADD_PARTICIPANT_MESSAGE;
+ boolean isAdded = this.eventList.addParticipantToEvent(this.participantName, this.eventName);
+ this.message = (isAdded) ? ADD_PARTICIPANT_MESSAGE : ADD_FAILURE_MESSAGE;
}
}
}
diff --git a/src/main/java/seedu/manager/event/EventList.java b/src/main/java/seedu/manager/event/EventList.java
index 71a02ca1e9..b7e8ddb7bf 100644
--- a/src/main/java/seedu/manager/event/EventList.java
+++ b/src/main/java/seedu/manager/event/EventList.java
@@ -94,18 +94,22 @@ public boolean removeEvent(String eventName) {
}
/**
- * Adds a participant to an existing event.
+ * Returns true if a participant can be added to a specified event,
+ * returns false otherwise.
*
* @param participantName the name of the participant to be added.
* @param eventName the name of the event to which the participant will be added.
+ * @return {@code true} if the participant can be added to the event, {@code false} otherwise.
*/
- public void addParticipantToEvent(String participantName, String eventName) {
+ public boolean addParticipantToEvent(String participantName, String eventName) {
for (Event event : eventList) {
if (event.getEventName().equals(eventName)) {
event.addParticipant(participantName);
- return;
+ return true;
}
}
+
+ return false;
}
/**
diff --git a/src/main/java/seedu/manager/exception/InvalidCommandException.java b/src/main/java/seedu/manager/exception/InvalidCommandException.java
index cc2680b7e4..92e02e7cfe 100644
--- a/src/main/java/seedu/manager/exception/InvalidCommandException.java
+++ b/src/main/java/seedu/manager/exception/InvalidCommandException.java
@@ -5,10 +5,10 @@
*/
public class InvalidCommandException extends RuntimeException {
- /**
- * @param message contains information on how the command is invalid
- */
- public InvalidCommandException(String message) {
- super(message);
- }
+ /**
+ * @param message contains information on how the command is invalid
+ */
+ public InvalidCommandException(String message) {
+ super(message);
+ }
}
diff --git a/src/test/java/seedu/manager/command/AddCommandTest.java b/src/test/java/seedu/manager/command/AddCommandTest.java
index ffecbdcf0f..683b7d21ca 100644
--- a/src/test/java/seedu/manager/command/AddCommandTest.java
+++ b/src/test/java/seedu/manager/command/AddCommandTest.java
@@ -36,5 +36,17 @@ public void add_oneParticipantWrongly_success() {
assertEquals(1, eventList.getEvent(0).getParticipantCount());
}
+
+ @Test
+ public void add_oneParticipantInvalidEvent_failure() {
+ EventList eventList = new EventList();
+ String expectedMessage = "Event not found!";
+
+ AddCommand addCommand = new AddCommand("Tom", "Event 1");
+ addCommand.setData(eventList);
+ addCommand.execute();
+
+ assertEquals(expectedMessage, addCommand.getMessage());
+ }
}
diff --git a/src/test/java/seedu/manager/parser/ParserTest.java b/src/test/java/seedu/manager/parser/ParserTest.java
index bc1c5a5049..d0e4d98e99 100644
--- a/src/test/java/seedu/manager/parser/ParserTest.java
+++ b/src/test/java/seedu/manager/parser/ParserTest.java
@@ -105,6 +105,6 @@ public void parseCommand_markEventInvalidStatus_invalid() {
String commandString = "mark -e event -s yes";
assertThrows(InvalidCommandException.class,() -> {
- parser.parseCommand(commandString);});
+ parser.parseCommand(commandString);});
}
}
From eec8f61c7178d06ab0a6c81a4740959460c224eb Mon Sep 17 00:00:00 2001
From: jemehgoh
Date: Tue, 22 Oct 2024 11:53:11 +0800
Subject: [PATCH 168/619] Split MarkCommand into two classes, for events and
for participants
---
.../seedu/manager/command/MarkCommand.java | 25 +++-------
.../manager/command/MarkEventCommand.java | 39 +++++++++++++++
.../command/MarkParticipantCommand.java | 50 +++++++++++++++++++
src/main/java/seedu/manager/event/Event.java | 39 +++++++++++++++
.../java/seedu/manager/parser/Parser.java | 5 +-
...andTest.java => MarkEventCommandTest.java} | 8 +--
.../java/seedu/manager/parser/ParserTest.java | 4 +-
7 files changed, 144 insertions(+), 26 deletions(-)
create mode 100644 src/main/java/seedu/manager/command/MarkEventCommand.java
create mode 100644 src/main/java/seedu/manager/command/MarkParticipantCommand.java
rename src/test/java/seedu/manager/command/{MarkCommandTest.java => MarkEventCommandTest.java} (83%)
diff --git a/src/main/java/seedu/manager/command/MarkCommand.java b/src/main/java/seedu/manager/command/MarkCommand.java
index 814f7e197a..062dfafe4e 100644
--- a/src/main/java/seedu/manager/command/MarkCommand.java
+++ b/src/main/java/seedu/manager/command/MarkCommand.java
@@ -7,20 +7,19 @@
/**
* Represents an executable mark command
*/
-public class MarkCommand extends Command {
+public abstract class MarkCommand extends Command {
public static final String COMMAND_WORD = "mark";
- private static final String EVENT_MARK_MESSAGE = "Event marked as done";
- private static final String EVENT_UNMARK_MESSAGE = "Event marked not done";
- private static final String INVALID_EVENT_MESSAGE = "Event not found!";
+ protected static final String INVALID_EVENT_MESSAGE = "Event not found!";
protected String eventName;
protected boolean toMark;
/**
- * Constructs a new MarkCommand with the given event name
+ * Constructs a new MarkCommand with the given event name.
*
- * @param eventName the given event name
+ * @param eventName the given event name.
+ * @param toMark true if the item is to be marked, false if it is to be unmarked.
*/
public MarkCommand(String eventName, boolean toMark) {
super(false);
@@ -29,18 +28,8 @@ public MarkCommand(String eventName, boolean toMark) {
}
/**
- * Executes a mark command by marking the specified event as done or not done,
- * depending on the value of toMark.
+ * Executes a mark command.
*/
@Override
- public void execute() {
- Optional eventToMark = this.eventList.getEventByName(this.eventName);
-
- if (eventToMark.isPresent()) {
- eventToMark.get().setDone(this.toMark);
- this.message = (this.toMark) ? EVENT_MARK_MESSAGE : EVENT_UNMARK_MESSAGE;
- } else {
- this.message = INVALID_EVENT_MESSAGE;
- }
- }
+ public abstract void execute();
}
diff --git a/src/main/java/seedu/manager/command/MarkEventCommand.java b/src/main/java/seedu/manager/command/MarkEventCommand.java
new file mode 100644
index 0000000000..0cd3cc37ef
--- /dev/null
+++ b/src/main/java/seedu/manager/command/MarkEventCommand.java
@@ -0,0 +1,39 @@
+package seedu.manager.command;
+
+import seedu.manager.event.Event;
+
+import java.util.Optional;
+
+/**
+ * Represents an executable mark command for marking events.
+ */
+public class MarkEventCommand extends MarkCommand {
+ private static final String EVENT_MARK_MESSAGE = "Event marked as done";
+ private static final String EVENT_UNMARK_MESSAGE = "Event marked not done";
+
+ /**
+ * Constructs a new MarkEventCommand with the given event name.
+ *
+ * @param eventName the event name.
+ * @param toMark true if the event is to be marked done, false otherwise.
+ */
+ public MarkEventCommand(String eventName, boolean toMark) {
+ super(eventName, toMark);
+ }
+
+ /**
+ * Executes a mark command by marking the specified event as done or not done,
+ * depending on the value of toMark.
+ */
+ @Override
+ public void execute() {
+ Optional eventToMark = this.eventList.getEventByName(this.eventName);
+
+ if (eventToMark.isPresent()) {
+ eventToMark.get().setDone(this.toMark);
+ this.message = (this.toMark) ? EVENT_MARK_MESSAGE : EVENT_UNMARK_MESSAGE;
+ } else {
+ this.message = INVALID_EVENT_MESSAGE;
+ }
+ }
+}
diff --git a/src/main/java/seedu/manager/command/MarkParticipantCommand.java b/src/main/java/seedu/manager/command/MarkParticipantCommand.java
new file mode 100644
index 0000000000..73cad3d790
--- /dev/null
+++ b/src/main/java/seedu/manager/command/MarkParticipantCommand.java
@@ -0,0 +1,50 @@
+package seedu.manager.command;
+
+import seedu.manager.event.Event;
+
+import java.util.Optional;
+
+/**
+ * Represents an executable mark command for marking participants.
+ */
+public class MarkParticipantCommand extends MarkCommand {
+ private static final String PARTICIPANT_MARK_MESSAGE = "Participant marked present.";
+ private static final String PARTICIPANT_UNMARK_MESSAGE = "Participant marked absent.";
+ private static final String INVALID_PARTICIPANT_MESSAGE = "Participant not found!";
+
+ private final String participantName;
+
+ /**
+ * Constructs a new MarkParticipantCommand with a given participant name, event name and whether to mark
+ * or unmark the participant.
+ *
+ * @param participantName the name of the participant.
+ * @param eventName the name of the event.
+ * @param toMark true if the participant is to be marked present, false if he is to be marked absent.
+ */
+ public MarkParticipantCommand(String participantName, String eventName, boolean toMark) {
+ super(eventName, toMark);
+ this.participantName = participantName;
+ }
+
+ /**
+ * Executes the mark participant command, by marking the participant as present or absent
+ */
+ @Override
+ public void execute() {
+ Optional event = eventList.getEventByName(this.eventName);
+
+ if (event.isEmpty()) {
+ this.message = INVALID_EVENT_MESSAGE;
+ return;
+ }
+
+ boolean isMarked = event.get().markParticipant(this.participantName, this.toMark);
+
+ if (isMarked) {
+ this.message = (this.toMark) ? PARTICIPANT_MARK_MESSAGE : PARTICIPANT_UNMARK_MESSAGE;
+ } else {
+ this.message = INVALID_PARTICIPANT_MESSAGE;
+ }
+ }
+}
diff --git a/src/main/java/seedu/manager/event/Event.java b/src/main/java/seedu/manager/event/Event.java
index 26f1c9dafb..81866f21c4 100644
--- a/src/main/java/seedu/manager/event/Event.java
+++ b/src/main/java/seedu/manager/event/Event.java
@@ -3,6 +3,7 @@
import seedu.manager.item.Participant;
import java.util.ArrayList;
+import java.util.Optional;
/**
* The Event class represents an event with a name, time, and venue.
@@ -78,6 +79,25 @@ public int getParticipantCount() {
return this.participantList.size();
}
+ /**
+ * Returns the participant in the participant list with the given name.
+ * If the participant is not in the participant list, returns null.
+ *
+ * @param participantName the name of the participant.
+ * @return the participant in the participant list with participantName, or null if
+ * no such participant exists.
+ */
+ private Optional getParticipantByName(String participantName) {
+ for (Participant participant : this.participantList) {
+ if (participant.getName().equalsIgnoreCase(participantName))
+ {
+ return Optional.of(participant);
+ }
+ }
+
+ return Optional.empty();
+ }
+
/**
* @return the event name
*/
@@ -144,6 +164,25 @@ public char markIfDone() {
return (this.isDone) ? 'Y' : 'N';
}
+ /**
+ * Returns true if the participant with the given name can be marked present or absent.
+ * Returns false otherwise.
+ *
+ * @param participantName the name of the participant.
+ * @param isPresent true if the participant is to be marked present, false if he is to be marked absent.
+ * @return {@code true} if the participant with participantName has been marked present or absent,
+ * {@code false} otherwise.
+ */
+ public boolean markParticipant(String participantName, boolean isPresent) {
+ Optional participant = getParticipantByName(participantName);
+
+ if (participant.isEmpty()) {
+ return false;
+ }
+
+ participant.get().setPresent(isPresent);
+ return true;
+ }
/**
* Returns a string representation of the event, indicating its name, time and venue.
*
diff --git a/src/main/java/seedu/manager/parser/Parser.java b/src/main/java/seedu/manager/parser/Parser.java
index 04f3ec0023..7007d1708e 100644
--- a/src/main/java/seedu/manager/parser/Parser.java
+++ b/src/main/java/seedu/manager/parser/Parser.java
@@ -4,6 +4,7 @@
import seedu.manager.command.AddCommand;
import seedu.manager.command.InvalidCommand;
import seedu.manager.command.MarkCommand;
+import seedu.manager.command.MarkEventCommand;
import seedu.manager.command.RemoveCommand;
import seedu.manager.command.ExitCommand;
import seedu.manager.command.MenuCommand;
@@ -229,9 +230,9 @@ private Command parseMarkCommand(String input, String[] commandParts) {
*/
private Command getMarkEventCommand(String eventName, String status) {
if (status.equalsIgnoreCase("done")) {
- return new MarkCommand(eventName, true);
+ return new MarkEventCommand(eventName, true);
} else if (status.equalsIgnoreCase("undone")) {
- return new MarkCommand(eventName, false);
+ return new MarkEventCommand(eventName, false);
} else {
logger.log(WARNING,"Invalid status keyword");
return new InvalidCommand(INVALID_EVENT_STATUS_MESSAGE);
diff --git a/src/test/java/seedu/manager/command/MarkCommandTest.java b/src/test/java/seedu/manager/command/MarkEventCommandTest.java
similarity index 83%
rename from src/test/java/seedu/manager/command/MarkCommandTest.java
rename to src/test/java/seedu/manager/command/MarkEventCommandTest.java
index c98c68327b..b6fe012e7c 100644
--- a/src/test/java/seedu/manager/command/MarkCommandTest.java
+++ b/src/test/java/seedu/manager/command/MarkEventCommandTest.java
@@ -6,7 +6,7 @@
import static org.junit.jupiter.api.Assertions.assertEquals;
-class MarkCommandTest {
+class MarkEventCommandTest {
private EventList eventList;
@BeforeEach
@@ -18,7 +18,7 @@ public void testSetUp() {
@Test
public void execute_eventPresentMarkDone_success() {
String expectedMessage = "Event marked as done";
- MarkCommand command = new MarkCommand("Event 1", true);
+ MarkCommand command = new MarkEventCommand("Event 1", true);
command.setData(eventList);
command.execute();
assertEquals(expectedMessage, command.getMessage());
@@ -27,7 +27,7 @@ public void execute_eventPresentMarkDone_success() {
@Test
public void execute_eventPresentMarkNotDone_success() {
String expectedMessage = "Event marked not done";
- MarkCommand command = new MarkCommand("Event 1", false);
+ MarkCommand command = new MarkEventCommand("Event 1", false);
command.setData(eventList);
command.execute();
assertEquals(expectedMessage, command.getMessage());
@@ -36,7 +36,7 @@ public void execute_eventPresentMarkNotDone_success() {
@Test
public void execute_eventAbsent_failure() {
String expectedMessage = "Event not found!";
- MarkCommand command = new MarkCommand("Event 2", true);
+ MarkCommand command = new MarkEventCommand("Event 2", true);
command.setData(eventList);
command.execute();
assertEquals(expectedMessage, command.getMessage());
diff --git a/src/test/java/seedu/manager/parser/ParserTest.java b/src/test/java/seedu/manager/parser/ParserTest.java
index bbe8f8bd9a..4780cdf05c 100644
--- a/src/test/java/seedu/manager/parser/ParserTest.java
+++ b/src/test/java/seedu/manager/parser/ParserTest.java
@@ -5,7 +5,7 @@
import seedu.manager.command.Command;
import seedu.manager.command.ExitCommand;
import seedu.manager.command.InvalidCommand;
-import seedu.manager.command.MarkCommand;
+import seedu.manager.command.MarkEventCommand;
import seedu.manager.command.MenuCommand;
import seedu.manager.command.ListCommand;
import seedu.manager.command.RemoveCommand;
@@ -83,7 +83,7 @@ public void parseCommand_markEvent_mark() {
Parser parser = new Parser();
Command command = parser.parseCommand("mark -e event -s done");
- assertInstanceOf(MarkCommand.class, command);
+ assertInstanceOf(MarkEventCommand.class, command);
}
@Test
From 5aecfd63d6102de29896ae66e2a6a4b04fa4c315 Mon Sep 17 00:00:00 2001
From: jemehgoh
Date: Tue, 22 Oct 2024 12:47:48 +0800
Subject: [PATCH 169/619] Add JUnit tests for MarkParticipantCommand and fix
Checkstyle issues
---
.../seedu/manager/command/MarkCommand.java | 4 --
src/main/java/seedu/manager/event/Event.java | 7 +--
.../command/MarkParticipantCommandTest.java | 62 +++++++++++++++++++
3 files changed, 65 insertions(+), 8 deletions(-)
create mode 100644 src/test/java/seedu/manager/command/MarkParticipantCommandTest.java
diff --git a/src/main/java/seedu/manager/command/MarkCommand.java b/src/main/java/seedu/manager/command/MarkCommand.java
index 062dfafe4e..5119c82504 100644
--- a/src/main/java/seedu/manager/command/MarkCommand.java
+++ b/src/main/java/seedu/manager/command/MarkCommand.java
@@ -1,9 +1,5 @@
package seedu.manager.command;
-import seedu.manager.event.Event;
-
-import java.util.Optional;
-
/**
* Represents an executable mark command
*/
diff --git a/src/main/java/seedu/manager/event/Event.java b/src/main/java/seedu/manager/event/Event.java
index 81866f21c4..a28d136e23 100644
--- a/src/main/java/seedu/manager/event/Event.java
+++ b/src/main/java/seedu/manager/event/Event.java
@@ -85,12 +85,11 @@ public int getParticipantCount() {
*
* @param participantName the name of the participant.
* @return the participant in the participant list with participantName, or null if
- * no such participant exists.
+ * no such participant exists.
*/
private Optional getParticipantByName(String participantName) {
for (Participant participant : this.participantList) {
- if (participant.getName().equalsIgnoreCase(participantName))
- {
+ if (participant.getName().equalsIgnoreCase(participantName)) {
return Optional.of(participant);
}
}
@@ -171,7 +170,7 @@ public char markIfDone() {
* @param participantName the name of the participant.
* @param isPresent true if the participant is to be marked present, false if he is to be marked absent.
* @return {@code true} if the participant with participantName has been marked present or absent,
- * {@code false} otherwise.
+ * {@code false} otherwise.
*/
public boolean markParticipant(String participantName, boolean isPresent) {
Optional participant = getParticipantByName(participantName);
diff --git a/src/test/java/seedu/manager/command/MarkParticipantCommandTest.java b/src/test/java/seedu/manager/command/MarkParticipantCommandTest.java
new file mode 100644
index 0000000000..56bec68dbf
--- /dev/null
+++ b/src/test/java/seedu/manager/command/MarkParticipantCommandTest.java
@@ -0,0 +1,62 @@
+package seedu.manager.command;
+
+import org.junit.jupiter.api.BeforeEach;
+import org.junit.jupiter.api.Test;
+import seedu.manager.event.EventList;
+
+import static org.junit.jupiter.api.Assertions.assertEquals;
+
+class MarkParticipantCommandTest {
+ private EventList eventList;
+
+ @BeforeEach
+ public void testSetUp() {
+ eventList = new EventList();
+ eventList.addEvent("Event 1", "2024-10-10 1600", "Venue 1");
+ eventList.addParticipantToEvent("John Doe", "Event 1");
+ }
+
+ @Test
+ public void execute_validParticipantMarkPresent_success() {
+ String expectedMessage = "Participant marked present.";
+
+ MarkParticipantCommand command = new MarkParticipantCommand("John Doe",
+ "Event 1", true);
+ command.setData(eventList);
+ command.execute();
+ assertEquals(expectedMessage, command.getMessage());
+ }
+
+ @Test
+ public void execute_validParticipantMarkAbsent_success() {
+ String expectedMessage = "Participant marked absent.";
+
+ MarkParticipantCommand command = new MarkParticipantCommand("John Doe",
+ "Event 1", false);
+ command.setData(eventList);
+ command.execute();
+ assertEquals(expectedMessage, command.getMessage());
+ }
+
+ @Test
+ public void execute_invalidParticipantMarkAbsent_failure() {
+ String expectedMessage = "Participant not found!";
+
+ MarkParticipantCommand command = new MarkParticipantCommand("Jane Doe",
+ "Event 1", true);
+ command.setData(eventList);
+ command.execute();
+ assertEquals(expectedMessage, command.getMessage());
+ }
+
+ @Test
+ public void execute_invalidEventMarkAbsent_failure() {
+ String expectedMessage = "Event not found!";
+
+ MarkParticipantCommand command = new MarkParticipantCommand("Jane Doe",
+ "Event 2", true);
+ command.setData(eventList);
+ command.execute();
+ assertEquals(expectedMessage, command.getMessage());
+ }
+}
From 4b50a623083e7b781696729c679c1942c9d3ba38 Mon Sep 17 00:00:00 2001
From: jemehgoh
Date: Tue, 22 Oct 2024 16:10:23 +0800
Subject: [PATCH 170/619] Change message syntax for participant details
The participants' status is denoted using the terms "present", if they
are present, and "not present", if they are not present. This makes the
participant list entries long and difficult to read.
Let's change the syntax such that whether a participant has been marked
present or not is indicated by the presence or absence of an "X"
beside the participant's name. This makes the participant list easier
to read.
---
src/main/java/seedu/manager/item/Participant.java | 8 ++++----
src/test/java/seedu/manager/command/ViewCommandTest.java | 2 +-
src/test/java/seedu/manager/item/ParticipantTest.java | 6 +++---
text-ui-test/EXPECTED.TXT | 2 +-
4 files changed, 9 insertions(+), 9 deletions(-)
diff --git a/src/main/java/seedu/manager/item/Participant.java b/src/main/java/seedu/manager/item/Participant.java
index 9d6de3a575..ad193a1ec9 100644
--- a/src/main/java/seedu/manager/item/Participant.java
+++ b/src/main/java/seedu/manager/item/Participant.java
@@ -38,12 +38,12 @@ public void setPresent(boolean isPresent) {
}
/**
- * Returns "present" if isPresent is true, "not present" otherwise.
+ * Returns "X" if isPresent is true, " " otherwise.
*
- * @return "present" if isPresent is true, "not present" otherwise.
+ * @return "X" if isPresent is true, " " otherwise.
*/
public String markIfPresent() {
- return (this.isPresent) ? "present" : "not present";
+ return (this.isPresent) ? "X" : " ";
}
/**
@@ -53,6 +53,6 @@ public String markIfPresent() {
*/
@Override
public String toString() {
- return String.format("%s (status: %s)", this.name, this.markIfPresent());
+ return String.format("%s [%s]", this.name, this.markIfPresent());
}
}
diff --git a/src/test/java/seedu/manager/command/ViewCommandTest.java b/src/test/java/seedu/manager/command/ViewCommandTest.java
index 221ff82ff5..f1f5d16387 100644
--- a/src/test/java/seedu/manager/command/ViewCommandTest.java
+++ b/src/test/java/seedu/manager/command/ViewCommandTest.java
@@ -33,7 +33,7 @@ public void setUp() {
@Test
public void execute_twoEvents_success() {
String expectedMessage = "There are 1 participants in Event 1! Here are your participants:\n"
- + "1. Tom (status: not present)\n";
+ + "1. Tom [ ]\n";
assertEquals(expectedMessage, viewCommand.getMessage());
assertFalse(viewCommand.getCanExit());
diff --git a/src/test/java/seedu/manager/item/ParticipantTest.java b/src/test/java/seedu/manager/item/ParticipantTest.java
index b90fefbdf1..3d9317ebfd 100644
--- a/src/test/java/seedu/manager/item/ParticipantTest.java
+++ b/src/test/java/seedu/manager/item/ParticipantTest.java
@@ -10,20 +10,20 @@ class ParticipantTest {
public void setPresent_setTrue_present() {
Participant participant = new Participant("Participant");
participant.setPresent(true);
- assertEquals("present", participant.markIfPresent());
+ assertEquals("X", participant.markIfPresent());
}
@Test
public void setPresent_setFalse_notPresent() {
Participant participant = new Participant("Participant");
participant.setPresent(false);
- assertEquals("not present", participant.markIfPresent());
+ assertEquals(" ", participant.markIfPresent());
}
@Test
public void toString_setTrue_present() {
Participant participant = new Participant("Participant");
participant.setPresent(true);
- assertEquals("Participant (status: present)", participant.toString());
+ assertEquals("Participant [X]", participant.toString());
}
}
diff --git a/text-ui-test/EXPECTED.TXT b/text-ui-test/EXPECTED.TXT
index cdb5199831..d0409addb4 100644
--- a/text-ui-test/EXPECTED.TXT
+++ b/text-ui-test/EXPECTED.TXT
@@ -36,7 +36,7 @@ Enter a command: Event not found!
Enter a command: Participant added successfully
------------------------
Enter a command: There are 1 participants in dinner party! Here are your participants:
-1. Mary (status: not present)
+1. Mary [ ]
------------------------
Enter a command: Thank you for using EventManagerCLI. Goodbye!
From d1bd734351ef94ef71945248201f27637d94a6ef Mon Sep 17 00:00:00 2001
From: fuyixuan
Date: Wed, 23 Oct 2024 17:05:09 +0800
Subject: [PATCH 171/619] implement the sortCommand to sort the events by name.
---
src/main/java/seedu/manager/command/SortCommand.java | 4 ++++
1 file changed, 4 insertions(+)
create mode 100644 src/main/java/seedu/manager/command/SortCommand.java
diff --git a/src/main/java/seedu/manager/command/SortCommand.java b/src/main/java/seedu/manager/command/SortCommand.java
new file mode 100644
index 0000000000..37a7a788a3
--- /dev/null
+++ b/src/main/java/seedu/manager/command/SortCommand.java
@@ -0,0 +1,4 @@
+package seedu.manager.command;
+
+public class SortCommand {
+}
From 43ef9ce9dc3e33ab7df18ab305c6322f6ce66b7d Mon Sep 17 00:00:00 2001
From: fuyixuan
Date: Wed, 23 Oct 2024 17:05:16 +0800
Subject: [PATCH 172/619] implement the sortCommand to sort the events by name.
---
.../seedu/manager/command/SortCommand.java | 42 ++++++++++++++++++-
.../java/seedu/manager/event/EventList.java | 26 +++++++-----
.../java/seedu/manager/parser/Parser.java | 35 ++++++++++++++++
3 files changed, 92 insertions(+), 11 deletions(-)
diff --git a/src/main/java/seedu/manager/command/SortCommand.java b/src/main/java/seedu/manager/command/SortCommand.java
index 37a7a788a3..6524b2b745 100644
--- a/src/main/java/seedu/manager/command/SortCommand.java
+++ b/src/main/java/seedu/manager/command/SortCommand.java
@@ -1,4 +1,44 @@
package seedu.manager.command;
-public class SortCommand {
+import seedu.manager.event.Event;
+import seedu.manager.event.EventList;
+
+import java.util.ArrayList;
+import java.util.List;
+
+/**
+ * Represents a command to sort the events in different ways.
+ * The sort command will store the sorting keyword.
+ */
+public class SortCommand extends Command {
+ public static final String COMMAND_WORD = "sort";
+
+ private static final String SORT_BY_NAME_MESSAGE = "Successfully sort events by name!";
+
+ protected String keyword;
+
+ public SortCommand(String keyword) {
+ super(false);
+ this.keyword = keyword;
+ }
+
+ @Override
+ public void execute() {
+ StringBuilder outputMessage = new StringBuilder();
+ EventList sortedEventList = new EventList(eventList); // deep copy
+
+ switch(keyword){
+ case "name":
+ sortedEventList.sortByName();
+ outputMessage.append(SORT_BY_NAME_MESSAGE + "\n");
+ case "time", "priority":
+ break;
+ }
+
+ // print out the sorted new list.
+ for (int i = 0; i < sortedEventList.getListSize(); i++) {
+ outputMessage.append(String.format("%d. %s\n", i + 1, sortedEventList.getEvent(i).toString()));
+ }
+ this.message = outputMessage.toString();
+ }
}
diff --git a/src/main/java/seedu/manager/event/EventList.java b/src/main/java/seedu/manager/event/EventList.java
index b7e8ddb7bf..849a02b947 100644
--- a/src/main/java/seedu/manager/event/EventList.java
+++ b/src/main/java/seedu/manager/event/EventList.java
@@ -1,6 +1,7 @@
package seedu.manager.event;
import java.util.ArrayList;
+import java.util.Comparator;
import java.util.Optional;
@@ -12,19 +13,19 @@ public class EventList {
private final ArrayList eventList;
/**
- * Constructor that initializes EventList with a given list of event.
- *
- * @param eventList The initial list of tasks.
+ * Default constructor that initializes an empty event list.
*/
- public EventList(ArrayList eventList) {
- this.eventList = eventList;
+ public EventList(){
+ eventList = new ArrayList<>();
}
/**
- * Default constructor that initializes an empty event list.
+ * Constructor that initializes EventList with a given list of event.
+ *
+ * @param otherEventList The initial list of tasks.
*/
- public EventList(){
- eventList = new ArrayList<>();
+ public EventList(EventList otherEventList) {
+ this.eventList = new ArrayList<>(otherEventList.eventList);
}
/**
@@ -72,7 +73,6 @@ public Optional getEventByName(String eventName) {
return Optional.of(event);
}
}
-
return Optional.empty();
}
@@ -108,7 +108,6 @@ public boolean addParticipantToEvent(String participantName, String eventName) {
return true;
}
}
-
return false;
}
@@ -136,4 +135,11 @@ public boolean removeParticipantFromEvent(String participantName, String eventNa
}
return false;
}
+
+ /**
+ * Sort the event list by name, alphabetically.
+ */
+ public void sortByName(){
+ eventList.sort(Comparator.comparing(Event::getEventName));
+ }
}
diff --git a/src/main/java/seedu/manager/parser/Parser.java b/src/main/java/seedu/manager/parser/Parser.java
index b0e6dee41a..6175a17083 100644
--- a/src/main/java/seedu/manager/parser/Parser.java
+++ b/src/main/java/seedu/manager/parser/Parser.java
@@ -8,8 +8,10 @@
import seedu.manager.command.MenuCommand;
import seedu.manager.command.ListCommand;
import seedu.manager.command.ViewCommand;
+import seedu.manager.command.SortCommand;
import seedu.manager.exception.InvalidCommandException;
+import java.util.Set;
import java.util.logging.Logger;
import static java.util.logging.Level.WARNING;
@@ -42,6 +44,15 @@ public class Parser {
Invalid event status!
Please set the event status as either "done" or "undone"
""";
+ private static final String INVALID_SORT_MESSAGE = """
+ Invalid command!
+ Please enter your commands in the following format:
+ sort -e EVENT -by name/time/priority
+ """;
+ private static final String INVALID_SORT_KEYWORD_MESSAGE = """
+ Invalid sort keyword!
+ Please set the sort keyword as either "name"/"time"/"priority"
+ """;
/**
* Returns a command based on the given user command string.
@@ -68,6 +79,8 @@ public Command parseCommand(String command) throws InvalidCommandException {
return new ExitCommand();
case MarkCommand.COMMAND_WORD:
return parseMarkCommand(command, commandParts);
+ case SortCommand.COMMAND_WORD:
+ return parseSortCommand(command, commandParts);
default:
throw new InvalidCommandException(INVALID_COMMAND_MESSAGE);
}
@@ -242,4 +255,26 @@ private Command getMarkEventCommand(String eventName, String status) throws Inva
throw new InvalidCommandException(INVALID_EVENT_STATUS_MESSAGE);
}
}
+
+ private Command parseSortCommand(String input, String[] commandParts) throws InvalidCommandException{
+ assert commandParts[0].equalsIgnoreCase(SortCommand.COMMAND_WORD);
+ try {
+ String[] inputParts = input.split("-by", 2);
+ if (inputParts.length < 2) {
+ throw new InvalidCommandException(INVALID_SORT_MESSAGE);
+ }
+
+ String keyword = inputParts[1].trim();
+ System.out.println(keyword);
+ Set validKeywords = Set.of("name", "time", "priority");
+ if (validKeywords.contains(keyword.toLowerCase())) {
+ return new SortCommand(keyword);
+ }
+ throw new InvalidCommandException(INVALID_SORT_KEYWORD_MESSAGE);
+
+ } catch (IndexOutOfBoundsException exception) {
+ logger.log(WARNING, "Invalid command format");
+ throw new InvalidCommandException(INVALID_SORT_MESSAGE);
+ }
+ }
}
From 92b5c78e1aa6c3906973a256ff7adfecf3a9eb43 Mon Sep 17 00:00:00 2001
From: fuyixuan
Date: Wed, 23 Oct 2024 17:08:17 +0800
Subject: [PATCH 173/619] edit the menu.
---
src/main/java/seedu/manager/command/MenuCommand.java | 4 ++--
1 file changed, 2 insertions(+), 2 deletions(-)
diff --git a/src/main/java/seedu/manager/command/MenuCommand.java b/src/main/java/seedu/manager/command/MenuCommand.java
index fd6f593f99..28be9683a5 100644
--- a/src/main/java/seedu/manager/command/MenuCommand.java
+++ b/src/main/java/seedu/manager/command/MenuCommand.java
@@ -14,8 +14,8 @@ public class MenuCommand extends Command {
add -p PARTICIPANT -e EVENT: Add a participant to an event.
view -e EVENT: View the list of participants of an event.
remove -p PARTICIPANT -e EVENT: Remove a participant from an event.
- mark -e EVENT -s STATUS: Mark an event as done or not done""";
-
+ mark -e EVENT -s STATUS: Mark an event as done or not done.
+ sort -by name/time/priority.""";
/**
* Constructs a new MenuCommand
*/
From b0e4b6637dfa377e3487e2edf2049e3d1953dea5 Mon Sep 17 00:00:00 2001
From: jemehgoh
Date: Wed, 23 Oct 2024 17:09:25 +0800
Subject: [PATCH 174/619] Add functionality for executing the mark participant
command to Parser
---
.../java/seedu/manager/parser/Parser.java | 29 +++++++++++++++++--
1 file changed, 27 insertions(+), 2 deletions(-)
diff --git a/src/main/java/seedu/manager/parser/Parser.java b/src/main/java/seedu/manager/parser/Parser.java
index 53344d52b9..abad6f8270 100644
--- a/src/main/java/seedu/manager/parser/Parser.java
+++ b/src/main/java/seedu/manager/parser/Parser.java
@@ -4,6 +4,7 @@
import seedu.manager.command.AddCommand;
import seedu.manager.command.MarkCommand;
import seedu.manager.command.MarkEventCommand;
+import seedu.manager.command.MarkParticipantCommand;
import seedu.manager.command.RemoveCommand;
import seedu.manager.command.ExitCommand;
import seedu.manager.command.MenuCommand;
@@ -214,6 +215,9 @@ private Command parseMarkCommand(String input, String[] commandParts) throws Inv
if (commandFlag.equalsIgnoreCase("-e")) {
String[] inputParts = input.split("-e|-s");
return getMarkEventCommand(inputParts[1].trim(), inputParts[2].trim());
+ } else if (commandFlag.equalsIgnoreCase("-p")) {
+ String[] inputParts = input.split("-p|-e|-s");
+ return getMarkParticipantCommand(inputParts[1].trim(), inputParts[2].trim(), inputParts[3].trim());
}
logger.log(WARNING,"Invalid command format");
@@ -225,8 +229,8 @@ private Command parseMarkCommand(String input, String[] commandParts) throws Inv
}
/**
- * Returns a {@link MarkCommand} with a given event name and status. If the given status is invalid,
- * throws an {@link InvalidCommandException}.
+ * Returns a {@link MarkEventCommand} with a given event name and status. If the given status is invalid,
+ * throws an {@link InvalidCommandException}.
*
* @param eventName the given event name.
* @param status the given event status.
@@ -243,4 +247,25 @@ private Command getMarkEventCommand(String eventName, String status) throws Inva
throw new InvalidCommandException(INVALID_EVENT_STATUS_MESSAGE);
}
}
+
+ /**
+ * Returns a {@link MarkCommand} with a given participant name, event name and status. If the given status is
+ * invalid, throws an {@link InvalidCommandException}.
+ *
+ * @param participantName the given participant name.
+ * @param eventName the given event name.
+ * @param status the given event status.
+ * @return a MarkCommand with a given event name and status
+ * @throws InvalidCommandException if the given status is invalid.
+ */
+ private Command getMarkParticipantCommand(String participantName, String eventName, String status) {
+ if (status.equalsIgnoreCase("present")) {
+ return new MarkParticipantCommand(participantName, eventName, true);
+ } else if (status.equalsIgnoreCase("absent")) {
+ return new MarkParticipantCommand(participantName, eventName, false);
+ } else {
+ logger.log(WARNING,"Invalid status keyword");
+ throw new InvalidCommandException(INVALID_EVENT_STATUS_MESSAGE);
+ }
+ }
}
From 1e67517f369e98801fc9cdc0949af84ad59e6c88 Mon Sep 17 00:00:00 2001
From: fuyixuan
Date: Wed, 23 Oct 2024 17:16:24 +0800
Subject: [PATCH 175/619] add Java Doc
---
.../java/seedu/manager/command/SortCommand.java | 13 +++++++++----
src/main/java/seedu/manager/parser/Parser.java | 15 +++++++++++++++
2 files changed, 24 insertions(+), 4 deletions(-)
diff --git a/src/main/java/seedu/manager/command/SortCommand.java b/src/main/java/seedu/manager/command/SortCommand.java
index 6524b2b745..f019eba090 100644
--- a/src/main/java/seedu/manager/command/SortCommand.java
+++ b/src/main/java/seedu/manager/command/SortCommand.java
@@ -1,11 +1,7 @@
package seedu.manager.command;
-import seedu.manager.event.Event;
import seedu.manager.event.EventList;
-import java.util.ArrayList;
-import java.util.List;
-
/**
* Represents a command to sort the events in different ways.
* The sort command will store the sorting keyword.
@@ -17,11 +13,20 @@ public class SortCommand extends Command {
protected String keyword;
+ /**
+ * Constructs a new SortCommand with the given keyword
+ *
+ * @param keyword the keyword of sorting
+ */
public SortCommand(String keyword) {
super(false);
this.keyword = keyword;
}
+ /**
+ * Executes a sort command by sorting events in different ways,
+ * depending on the keyword.
+ */
@Override
public void execute() {
StringBuilder outputMessage = new StringBuilder();
diff --git a/src/main/java/seedu/manager/parser/Parser.java b/src/main/java/seedu/manager/parser/Parser.java
index 6175a17083..e7a64f30fd 100644
--- a/src/main/java/seedu/manager/parser/Parser.java
+++ b/src/main/java/seedu/manager/parser/Parser.java
@@ -256,6 +256,21 @@ private Command getMarkEventCommand(String eventName, String status) throws Inva
}
}
+ /**
+ * Parses the input string to create a {@link Command} based on the provided command parts.
+ *
+ *
+ * This method checks the command flag extracted from the command parts. If the command
+ * flag is {@code "-by"}, it splits the input string to create a {@link SortCommand}
+ * Otherwise, it throws an {@link InvalidCommandException} with an error message.
+ *
+ *
+ * @param input the input string containing the command details.
+ * @param commandParts an array of strings representing the parsed command parts,
+ * where the second element is the command flag.
+ * @return a {@link Command} object representing the parsed command.
+ * @throws InvalidCommandException if the flag is not matched.
+ */
private Command parseSortCommand(String input, String[] commandParts) throws InvalidCommandException{
assert commandParts[0].equalsIgnoreCase(SortCommand.COMMAND_WORD);
try {
From 5e16859d54f6c6d75ddabe2a1e864acdc04d8214 Mon Sep 17 00:00:00 2001
From: fuyixuan
Date: Wed, 23 Oct 2024 17:18:57 +0800
Subject: [PATCH 176/619] correct error
---
src/main/java/seedu/manager/command/SortCommand.java | 2 ++
1 file changed, 2 insertions(+)
diff --git a/src/main/java/seedu/manager/command/SortCommand.java b/src/main/java/seedu/manager/command/SortCommand.java
index f019eba090..1f90e070aa 100644
--- a/src/main/java/seedu/manager/command/SortCommand.java
+++ b/src/main/java/seedu/manager/command/SortCommand.java
@@ -36,8 +36,10 @@ public void execute() {
case "name":
sortedEventList.sortByName();
outputMessage.append(SORT_BY_NAME_MESSAGE + "\n");
+ break;
case "time", "priority":
break;
+ default:
}
// print out the sorted new list.
From 42c05ca0c73134d3e44b4a24c740bf22ff85b38c Mon Sep 17 00:00:00 2001
From: fuyixuan
Date: Wed, 23 Oct 2024 17:33:39 +0800
Subject: [PATCH 177/619] add test
---
text-ui-test/EXPECTED.TXT | 11 ++++++++++-
text-ui-test/input.txt | 2 ++
2 files changed, 12 insertions(+), 1 deletion(-)
diff --git a/text-ui-test/EXPECTED.TXT b/text-ui-test/EXPECTED.TXT
index d0409addb4..acce44ea2b 100644
--- a/text-ui-test/EXPECTED.TXT
+++ b/text-ui-test/EXPECTED.TXT
@@ -9,7 +9,8 @@ remove -e EVENT: Remove an event from the event list.
add -p PARTICIPANT -e EVENT: Add a participant to an event.
view -e EVENT: View the list of participants of an event.
remove -p PARTICIPANT -e EVENT: Remove a participant from an event.
-mark -e EVENT -s STATUS: Mark an event as done or not done
+mark -e EVENT -s STATUS: Mark an event as done or not done.
+sort -by name/time/priority.
------------------------
Enter a command: There are 0 events in your list! Here are your scheduled events:
@@ -38,6 +39,14 @@ Enter a command: Participant added successfully
Enter a command: There are 1 participants in dinner party! Here are your participants:
1. Mary [ ]
+------------------------
+Enter a command: Event added successfully
+------------------------
+Enter a command: name
+Successfully sort events by name!
+1. Event name: anniversary celebration / Event time: 2024-10-23 / Event venue: hotel / Done: N
+2. Event name: dinner party / Event time: 2024-10-10 / Event venue: Alice's House / Done: Y
+
------------------------
Enter a command: Thank you for using EventManagerCLI. Goodbye!
------------------------
diff --git a/text-ui-test/input.txt b/text-ui-test/input.txt
index e312c513f5..dfa2f70151 100644
--- a/text-ui-test/input.txt
+++ b/text-ui-test/input.txt
@@ -9,4 +9,6 @@ list
mark -e Saturday brunch -s done
add -p Mary -e dinner party
view -e dinner party
+add -e anniversary celebration -t 2024-10-23 -v hotel
+sort -by name
exit
From 923ee39ee8e9e6abb8e7e76998a866eada6b06eb Mon Sep 17 00:00:00 2001
From: jemehgoh
Date: Wed, 23 Oct 2024 18:32:03 +0800
Subject: [PATCH 178/619] Add target user and value proposition
---
docs/DeveloperGuide.md | 17 +++++++++++------
1 file changed, 11 insertions(+), 6 deletions(-)
diff --git a/docs/DeveloperGuide.md b/docs/DeveloperGuide.md
index 64e1f0ed2b..f34070b4a6 100644
--- a/docs/DeveloperGuide.md
+++ b/docs/DeveloperGuide.md
@@ -12,18 +12,23 @@
## Product scope
### Target user profile
-{Describe the target user profile}
+The target user:
+* has a need to organise a large number of events
+* organises small-scale events, such that he is able to handle all matters on his own
+* prefers typing to mouse interactions
+* is comfortable using a command-line interface
### Value proposition
-{Describe the value proposition: what problem does it solve?}
+The user is able to organise and manage his events more quickly and efficiently than with a mouse/GUI app
## User Stories
-|Version| As a ... | I want to ... | So that I can ...|
-|--------|----------|---------------|------------------|
-|v1.0|new user|see usage instructions|refer to them when I forget how to use the application|
-|v2.0|user|find a to-do item by name|locate a to-do without having to go through the entire list|
+| Version | As a ... | I want to ... | So that I can ... |
+|---------|----------|--------------------------|--------------------------------------------------------|
+| v1.0 | new user | see usage instructions | refer to them when I forget how to use the application |
+| v2.0 | user | mark events as completed | easily track all past events |
+| v2.0 | user | mark participants present| know exactly who signed up but did not attend the event|
## Non-Functional Requirements
From db72cdfa31f36e173b70a3e617cb2f9a49d0c1e6 Mon Sep 17 00:00:00 2001
From: jemehgoh
Date: Wed, 23 Oct 2024 19:19:41 +0800
Subject: [PATCH 179/619] Add author tags to functional code
---
src/main/java/seedu/manager/command/AddCommand.java | 3 +++
src/main/java/seedu/manager/command/Command.java | 3 +++
src/main/java/seedu/manager/command/ExitCommand.java | 1 +
src/main/java/seedu/manager/command/ListCommand.java | 2 +-
src/main/java/seedu/manager/command/MarkCommand.java | 1 +
src/main/java/seedu/manager/command/MarkEventCommand.java | 1 +
.../java/seedu/manager/command/MarkParticipantCommand.java | 1 +
src/main/java/seedu/manager/command/MenuCommand.java | 1 +
src/main/java/seedu/manager/command/RemoveCommand.java | 2 ++
src/main/java/seedu/manager/command/ViewCommand.java | 1 +
src/main/java/seedu/manager/event/Event.java | 7 +++++++
src/main/java/seedu/manager/event/EventList.java | 3 +++
.../seedu/manager/exception/InvalidCommandException.java | 1 +
src/main/java/seedu/manager/item/Participant.java | 1 +
src/main/java/seedu/manager/parser/Parser.java | 2 ++
src/main/java/seedu/manager/ui/Ui.java | 3 +++
16 files changed, 32 insertions(+), 1 deletion(-)
diff --git a/src/main/java/seedu/manager/command/AddCommand.java b/src/main/java/seedu/manager/command/AddCommand.java
index 7c0d523d9d..b7311c882d 100644
--- a/src/main/java/seedu/manager/command/AddCommand.java
+++ b/src/main/java/seedu/manager/command/AddCommand.java
@@ -1,5 +1,6 @@
package seedu.manager.command;
+//@@author KuanHsienn
/**
* Represents a command to add an event to the event list.
* The add command will store the event's name, time, and venue.
@@ -28,6 +29,7 @@ public AddCommand(String eventName, String time, String venue) {
this.venue = venue;
}
+ //@@author LTK-1606
/**
* Constructs an {@code AddCommand} with the specified participant name and event name.
*
@@ -42,6 +44,7 @@ public AddCommand(String participantName, String eventName) {
this.eventName = eventName;
}
+ //@@author KuanHsienn
/**
* Executes the command to add an event or a participant to an event.
*
diff --git a/src/main/java/seedu/manager/command/Command.java b/src/main/java/seedu/manager/command/Command.java
index 836d5b1c76..f1dedd51b6 100644
--- a/src/main/java/seedu/manager/command/Command.java
+++ b/src/main/java/seedu/manager/command/Command.java
@@ -2,6 +2,7 @@
import seedu.manager.event.EventList;
+//@@author jemehgoh
/**
* Represents an executable command
*/
@@ -19,6 +20,7 @@ protected Command(boolean canExit) {
this.canExit = canExit;
}
+ //@@author MatchaRRR
/**
* Sets the command's event list to a specified event list
*
@@ -28,6 +30,7 @@ public void setData(EventList events) {
this.eventList = events;
}
+ //@@jemehgoh
/**
* Executes the command
*/
diff --git a/src/main/java/seedu/manager/command/ExitCommand.java b/src/main/java/seedu/manager/command/ExitCommand.java
index 1db9224fc6..18185fc1cc 100644
--- a/src/main/java/seedu/manager/command/ExitCommand.java
+++ b/src/main/java/seedu/manager/command/ExitCommand.java
@@ -1,5 +1,6 @@
package seedu.manager.command;
+//@@author jemehgoh
/**
* Represents an executable exit command
*/
diff --git a/src/main/java/seedu/manager/command/ListCommand.java b/src/main/java/seedu/manager/command/ListCommand.java
index 34e21f28d1..5f4b88da1b 100644
--- a/src/main/java/seedu/manager/command/ListCommand.java
+++ b/src/main/java/seedu/manager/command/ListCommand.java
@@ -1,6 +1,6 @@
package seedu.manager.command;
-
+//@@author MatchaRRR
public class ListCommand extends Command {
public static final String COMMAND_WORD = "list";
private static final String LIST_MESSAGE = "There are %1$d events in your list! " +
diff --git a/src/main/java/seedu/manager/command/MarkCommand.java b/src/main/java/seedu/manager/command/MarkCommand.java
index 5119c82504..15b873c04b 100644
--- a/src/main/java/seedu/manager/command/MarkCommand.java
+++ b/src/main/java/seedu/manager/command/MarkCommand.java
@@ -1,5 +1,6 @@
package seedu.manager.command;
+//@@author jemehgoh
/**
* Represents an executable mark command
*/
diff --git a/src/main/java/seedu/manager/command/MarkEventCommand.java b/src/main/java/seedu/manager/command/MarkEventCommand.java
index 0cd3cc37ef..629a911c47 100644
--- a/src/main/java/seedu/manager/command/MarkEventCommand.java
+++ b/src/main/java/seedu/manager/command/MarkEventCommand.java
@@ -4,6 +4,7 @@
import java.util.Optional;
+//@@author jemehgoh
/**
* Represents an executable mark command for marking events.
*/
diff --git a/src/main/java/seedu/manager/command/MarkParticipantCommand.java b/src/main/java/seedu/manager/command/MarkParticipantCommand.java
index 73cad3d790..43666d93bc 100644
--- a/src/main/java/seedu/manager/command/MarkParticipantCommand.java
+++ b/src/main/java/seedu/manager/command/MarkParticipantCommand.java
@@ -4,6 +4,7 @@
import java.util.Optional;
+//@@author jemehgoh
/**
* Represents an executable mark command for marking participants.
*/
diff --git a/src/main/java/seedu/manager/command/MenuCommand.java b/src/main/java/seedu/manager/command/MenuCommand.java
index fd6f593f99..5b240a6965 100644
--- a/src/main/java/seedu/manager/command/MenuCommand.java
+++ b/src/main/java/seedu/manager/command/MenuCommand.java
@@ -1,5 +1,6 @@
package seedu.manager.command;
+//@@author glenn-chew
/**
* Represents an executable menu command
*/
diff --git a/src/main/java/seedu/manager/command/RemoveCommand.java b/src/main/java/seedu/manager/command/RemoveCommand.java
index c66f9cc292..e15a35dd9b 100644
--- a/src/main/java/seedu/manager/command/RemoveCommand.java
+++ b/src/main/java/seedu/manager/command/RemoveCommand.java
@@ -1,5 +1,6 @@
package seedu.manager.command;
+//@@author KuanHsienn
/**
* Represents a command to remove an event from the event list.
* The remove command will search for an event by its name and remove it if found.
@@ -21,6 +22,7 @@ public RemoveCommand(String eventName) {
this.eventName = eventName;
}
+ //@@author LTK-1606
/**
* Constructs a RemoveCommand object with the specified event name.
*
diff --git a/src/main/java/seedu/manager/command/ViewCommand.java b/src/main/java/seedu/manager/command/ViewCommand.java
index 5bb7dc7d12..7966c1d73f 100644
--- a/src/main/java/seedu/manager/command/ViewCommand.java
+++ b/src/main/java/seedu/manager/command/ViewCommand.java
@@ -5,6 +5,7 @@
import java.util.Optional;
+//@@author glenn-chew
/**
* Represents a command to view the list of participants in an event.
* The view command will search for an event by its name and display all its participants if found.
diff --git a/src/main/java/seedu/manager/event/Event.java b/src/main/java/seedu/manager/event/Event.java
index a28d136e23..4814e24664 100644
--- a/src/main/java/seedu/manager/event/Event.java
+++ b/src/main/java/seedu/manager/event/Event.java
@@ -5,6 +5,7 @@
import java.util.ArrayList;
import java.util.Optional;
+//@@author MatchaRRR
/**
* The Event class represents an event with a name, time, and venue.
* It provides methods to access and modify the time and venue of the event.
@@ -41,6 +42,7 @@ public Event(String eventName, String eventTime, String eventVenue) {
this.isDone = false;
}
+ //@@author LTK-1606
/**
* Adds a participant to the participant list for the event.
*
@@ -79,6 +81,7 @@ public int getParticipantCount() {
return this.participantList.size();
}
+ //@@author jemehgoh
/**
* Returns the participant in the participant list with the given name.
* If the participant is not in the participant list, returns null.
@@ -97,6 +100,7 @@ private Optional getParticipantByName(String participantName) {
return Optional.empty();
}
+ //@@author MatchaRRR
/**
* @return the event name
*/
@@ -147,6 +151,7 @@ public void setEventVenue(String eventVenue) {
this.eventVenue = eventVenue;
}
+ //@@author jemehgoh
/**
* Sets if the event is done or not done
*
@@ -182,6 +187,8 @@ public boolean markParticipant(String participantName, boolean isPresent) {
participant.get().setPresent(isPresent);
return true;
}
+
+ //@@author MatchaRRR
/**
* Returns a string representation of the event, indicating its name, time and venue.
*
diff --git a/src/main/java/seedu/manager/event/EventList.java b/src/main/java/seedu/manager/event/EventList.java
index b7e8ddb7bf..5a733503b0 100644
--- a/src/main/java/seedu/manager/event/EventList.java
+++ b/src/main/java/seedu/manager/event/EventList.java
@@ -59,6 +59,7 @@ public Event getEvent(int index) {
return eventList.get(index);
}
+ //@@author jemehgoh
/**
* Returns an event in the event list with a specified name.
* Returns null if the event is not found.
@@ -76,6 +77,7 @@ public Optional getEventByName(String eventName) {
return Optional.empty();
}
+ //@@author KuanHsienn
/**
* Removes an event from the event list by its name.
*
@@ -93,6 +95,7 @@ public boolean removeEvent(String eventName) {
return false;
}
+ //@@author LTK-1606
/**
* Returns true if a participant can be added to a specified event,
* returns false otherwise.
diff --git a/src/main/java/seedu/manager/exception/InvalidCommandException.java b/src/main/java/seedu/manager/exception/InvalidCommandException.java
index 92e02e7cfe..5013a38b65 100644
--- a/src/main/java/seedu/manager/exception/InvalidCommandException.java
+++ b/src/main/java/seedu/manager/exception/InvalidCommandException.java
@@ -1,5 +1,6 @@
package seedu.manager.exception;
+//@@author jemehgoh
/**
* Signals that an entered command is invalid
*/
diff --git a/src/main/java/seedu/manager/item/Participant.java b/src/main/java/seedu/manager/item/Participant.java
index ad193a1ec9..4b03a3f99f 100644
--- a/src/main/java/seedu/manager/item/Participant.java
+++ b/src/main/java/seedu/manager/item/Participant.java
@@ -2,6 +2,7 @@
import seedu.manager.event.Event;
+//@@author jemehgoh
/**
* Represents an event participant, in the participant list of an {@link Event}.
*/
diff --git a/src/main/java/seedu/manager/parser/Parser.java b/src/main/java/seedu/manager/parser/Parser.java
index abad6f8270..c03da093c3 100644
--- a/src/main/java/seedu/manager/parser/Parser.java
+++ b/src/main/java/seedu/manager/parser/Parser.java
@@ -157,6 +157,7 @@ private Command parseRemoveCommand(String input, String[] commandParts) throws I
}
}
+ //@@author glenn-chew
/**
* Parses the input string to create a {@link Command} based on the provided command parts.
*
@@ -191,6 +192,7 @@ private Command parseViewCommand(String input, String[] commandParts) throws Inv
}
}
+ //@@author jemehgoh
/**
* Parses the input string to create a {@link Command} based on the provided command parts.
*
diff --git a/src/main/java/seedu/manager/ui/Ui.java b/src/main/java/seedu/manager/ui/Ui.java
index 03f091e8bd..3d35201dc9 100644
--- a/src/main/java/seedu/manager/ui/Ui.java
+++ b/src/main/java/seedu/manager/ui/Ui.java
@@ -4,6 +4,7 @@
import java.util.Scanner;
+//@@author jemehgoh
/**
* Represents the program's user interface
*/
@@ -36,6 +37,7 @@ public String getCommand() {
return this.userInput.nextLine();
}
+ //@@author MatchaRRR
/**
* show the output message of a command to the users.
*/
@@ -44,6 +46,7 @@ public void showOutputToUser(Command command) {
System.out.println(SEPARATOR);
}
+ //@@author jemehgoh
/**
* Shows the error message of an exception to the user.
*/
From 879d3be2c31ed7e381089ddf4337a51fc9f04ae6 Mon Sep 17 00:00:00 2001
From: jemehgoh
Date: Wed, 23 Oct 2024 20:38:10 +0800
Subject: [PATCH 180/619] Add overall architecture and sequence diagram
---
docs/diagrams/ArchitectureSequence.puml | 50 +++++++++++++++++++++++++
docs/diagrams/OverallArchitecture.puml | 39 +++++++++++++++++++
2 files changed, 89 insertions(+)
create mode 100644 docs/diagrams/ArchitectureSequence.puml
create mode 100644 docs/diagrams/OverallArchitecture.puml
diff --git a/docs/diagrams/ArchitectureSequence.puml b/docs/diagrams/ArchitectureSequence.puml
new file mode 100644
index 0000000000..d4db4e3db5
--- /dev/null
+++ b/docs/diagrams/ArchitectureSequence.puml
@@ -0,0 +1,50 @@
+@startuml
+'https://plantuml.com/sequence-diagram
+
+Participant ":Main" as main
+Participant ":Ui" as ui
+Participant ":Parser" as parser
+Participant ":XYZCommand" as command
+
+main -> ui : getCommand()
+activate ui
+ui --> main : UserCommandText: String
+deactivate ui
+
+create parser
+main -> parser : Parser()
+activate parser
+parser --> main : :Parser
+deactivate parser
+
+main -> parser : parseCommand(UserCommandText: String)
+activate parser
+
+create command
+parser -> command : XYZCommand()
+activate command
+command --> parser : :XYZCommand
+deactivate command
+
+parser --> main : command:XYZCommand
+deactivate parser
+destroy parser
+
+main -> command : execute()
+activate command
+command --> main
+deactivate command
+
+main -> ui : showOutputToUser(command: Command)
+activate ui
+
+ui -> command : getMessage()
+activate command
+
+command --> ui : :String
+deactivate command
+
+ui --> main
+deactivate ui
+
+@enduml
\ No newline at end of file
diff --git a/docs/diagrams/OverallArchitecture.puml b/docs/diagrams/OverallArchitecture.puml
new file mode 100644
index 0000000000..69217d1805
--- /dev/null
+++ b/docs/diagrams/OverallArchitecture.puml
@@ -0,0 +1,39 @@
+@startuml
+'https://plantuml.com/class-diagram
+
+class Main {
+}
+
+Main --> "1" Ui : ui
+Main --> "1" EventList : events
+Main ..> Parser
+Main ..> Command
+
+class Ui {
+}
+
+Ui ..> Command
+
+class Parser {
+}
+
+Parser ..> Command
+
+abstract class Command {
+}
+
+Command <|-- AddCommand
+Command <|-- ExitCommand
+Command <|-- ListCommand
+Command <|-- XYZCommand
+
+Command ..> EventList
+
+class EventList {
+}
+
+EventList *--> "*" Event
+
+Event *--> "*" Participant
+
+@enduml
\ No newline at end of file
From e7ce886c0f775fcfe2c4753ef7116e76c93f3967 Mon Sep 17 00:00:00 2001
From: jemehgoh
Date: Thu, 24 Oct 2024 00:17:30 +0800
Subject: [PATCH 181/619] Modify UML diagrams and add architecture section to
developer guide
---
docs/DeveloperGuide.md | 19 +++++++++++++++-
docs/diagrams/ArchitectureSequence.puml | 24 +++++++++++++++-----
docs/diagrams/OverallArchitecture.puml | 4 ++--
docs/images/ArchitectureDiagram.png | Bin 0 -> 33634 bytes
docs/images/ArchitectureSequenceDiagram.png | Bin 0 -> 49379 bytes
5 files changed, 38 insertions(+), 9 deletions(-)
create mode 100644 docs/images/ArchitectureDiagram.png
create mode 100644 docs/images/ArchitectureSequenceDiagram.png
diff --git a/docs/DeveloperGuide.md b/docs/DeveloperGuide.md
index f34070b4a6..11cd7da1e5 100644
--- a/docs/DeveloperGuide.md
+++ b/docs/DeveloperGuide.md
@@ -6,8 +6,25 @@
## Design & implementation
-{Describe the design and implementation of the product. Use UML diagrams and short code snippets where applicable.}
+
+The *Architecture Diagram* given above provides the high-level design of the application.
+
+### Main components
+
+The application comprises the following components:
+* `Main`, which handles program startup and shutdown, and also interactions between other components.
+* `UI`, which handles user input and showing messages to the user.
+* `Parser`, which converts user input into commands.
+* `Command`, which are executed to modify the data stored in the program.
+* `EventList`, which stores the program's data.
+
+### Interactions between components
+
+
+
+The above *Sequence Diagram* shows how the different components of the system interact with one
+another in the scenario when the command `add -e event -t 1200 -v venue` is executed.
## Product scope
### Target user profile
diff --git a/docs/diagrams/ArchitectureSequence.puml b/docs/diagrams/ArchitectureSequence.puml
index d4db4e3db5..736158c5f9 100644
--- a/docs/diagrams/ArchitectureSequence.puml
+++ b/docs/diagrams/ArchitectureSequence.puml
@@ -4,11 +4,12 @@
Participant ":Main" as main
Participant ":Ui" as ui
Participant ":Parser" as parser
-Participant ":XYZCommand" as command
+Participant ":AddCommand" as command
+Participant ":EventList" as eventList
main -> ui : getCommand()
activate ui
-ui --> main : UserCommandText: String
+ui --> main : "add -e event -t 1200 -v venue"
deactivate ui
create parser
@@ -17,21 +18,32 @@ activate parser
parser --> main : :Parser
deactivate parser
-main -> parser : parseCommand(UserCommandText: String)
+main -> parser : parseCommand("add -e event -t 1200 -v venue")
activate parser
create command
-parser -> command : XYZCommand()
+parser -> command : AddCommand("event", "1200", "venue")
activate command
-command --> parser : :XYZCommand
+command --> parser : :AddCommand
deactivate command
-parser --> main : command:XYZCommand
+parser --> main : command:AddCommand
deactivate parser
destroy parser
+main -> command : setData(events:EventList)
+activate command
+command --> main
+deactivate command
+
main -> command : execute()
activate command
+
+command -> eventList : addEvent("event", "1200", "venue")
+activate eventList
+eventList --> command
+deactivate eventList
+
command --> main
deactivate command
diff --git a/docs/diagrams/OverallArchitecture.puml b/docs/diagrams/OverallArchitecture.puml
index 69217d1805..7fb32fa512 100644
--- a/docs/diagrams/OverallArchitecture.puml
+++ b/docs/diagrams/OverallArchitecture.puml
@@ -4,8 +4,8 @@
class Main {
}
-Main --> "1" Ui : ui
-Main --> "1" EventList : events
+Main --> Ui
+Main --> EventList
Main ..> Parser
Main ..> Command
diff --git a/docs/images/ArchitectureDiagram.png b/docs/images/ArchitectureDiagram.png
new file mode 100644
index 0000000000000000000000000000000000000000..9a1f8cc59c35cc4d4ae2a395311544a1faf05492
GIT binary patch
literal 33634
zcmaI81yogQ+cmraMLe~Tjgq2(loHY)CDNOaP*RcZMhWSZ
z&i~q;bKdv+WBku}&ftv0V(qo=`-*wZIq&^aO+_9bj}i}oK;Yk3kW)t>FvsAZ$2geq
zU#{m~B!(Ys&UYU<8{64?AWhAj5%Q+CrjAC=rY7{yJm@W)o$Z}OxVi0-Mz+o_Hb^dG
zI~&)ob~*$C!_iXnk@J859f1M&aeu$2@l~Z!im+}&N4W~;24^hc*H%K!o=`sGbh$eG
zHC;i=%FcCEZ|?azmyM-DmDkol!v0i8?dbg+^>j54;+QhGY@Ve(&&RJP=w093tfRko
ztMHA{joS<+sV_oaH<2GQn9w~Qy5K$3{O5&Zg^7CH8ynT9K{D#SbAp!9^jBAcCD_N8
zHgHiKTx43_S&hk>m{=FHYa5k(lJ$M{uIUFEJ#h}~mW&smjcShjF?>hWL3&f?P56B0CnTewXx-NmKIBR{ylKExhxX
zG1Bq1vt9eH(o+3Q|6tcQZb?HqS_}%>1O&n#abHea)7@Zo^3o&H;VH?@8#k-(?DMbf
z{*GkcW9@r|gQ-~dR8y)YxK6G}jw6ln?TD9MC@W?dCfha5o<~v-S1-0;z6ir%!+b$T
z`0M<0M^fF&V-Y$6HR_a*On%N5xO2ot^nUGb0d;{z90I<=%(e0|Nv4E@fW(>u=r=x*8)8
zfdmd00xf?v2Cb?U-CTTIMuml-cMfHuS6-%)f6Mix-S!H?zlR~h|29Je0+CD9Ohou$
zdse~B)od|+GV|tZTXWM-dHuSwvY8bTZ?nU*liCi9+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