From f6a42abb5921831b7c096ad6885303cb10d9b4c3 Mon Sep 17 00:00:00 2001 From: keithxun Date: Fri, 18 Oct 2024 10:10:08 +0800 Subject: [PATCH 1/6] Update sample data to include sessions and points --- .../address/model/util/SampleDataUtil.java | 58 +++++++++++++++++-- 1 file changed, 52 insertions(+), 6 deletions(-) diff --git a/src/main/java/hallpointer/address/model/util/SampleDataUtil.java b/src/main/java/hallpointer/address/model/util/SampleDataUtil.java index 4a36b625ac8..d3a906178bd 100644 --- a/src/main/java/hallpointer/address/model/util/SampleDataUtil.java +++ b/src/main/java/hallpointer/address/model/util/SampleDataUtil.java @@ -1,6 +1,7 @@ package hallpointer.address.model.util; import java.util.Arrays; +import java.util.HashSet; import java.util.Set; import java.util.stream.Collectors; @@ -10,32 +11,59 @@ import hallpointer.address.model.member.Name; import hallpointer.address.model.member.Room; import hallpointer.address.model.member.Telegram; +import hallpointer.address.model.point.Point; +import hallpointer.address.model.session.Session; +import hallpointer.address.model.session.SessionName; +import hallpointer.address.model.session.SessionDate; import hallpointer.address.model.tag.Tag; /** * Contains utility methods for populating {@code AddressBook} with sample data. */ public class SampleDataUtil { + public static Member[] getSampleMembers() { return new Member[] { new Member(new Name("Alex Yeoh"), new Telegram("alex_yeoh98"), new Room("12/04/201"), - getTagSet("subcommLeader")), + getTagSet("subcommLeader"), new Point("6"), + getSessionSet( + new SessionName[]{new SessionName("AGM"), new SessionName("Team Meeting")}, + new SessionDate[]{new SessionDate("24 Sep 2024"), new SessionDate("02 Oct 2024")}, + new Point[]{new Point("6"), new Point("4")} + )), new Member(new Name("Bernice Yu"), new Telegram("BobLim23"), new Room("5/03/102"), - getTagSet("competitionLeader", "achiever")), + getTagSet("competitionLeader", "achiever"), + new Point("10"), + getSessionSet( + new SessionName[]{new SessionName("Workshop")}, + new SessionDate[]{new SessionDate("15 Oct 2024")}, + new Point[]{new Point("10")} + )), new Member(new Name("Charlotte Oliveiro"), new Telegram("oliveiro"), new Room("3/02/301"), - getTagSet("team1")), + getTagSet("team1"), new Point("5"), + getSessionSet( + new SessionName[]{new SessionName("Team Bonding")}, + new SessionDate[]{new SessionDate("20 Sep 2024")}, + new Point[]{new Point("5")} + )), new Member(new Name("David Li"), new Telegram("davidLiOnly"), new Room("14/06/301"), - getTagSet("team3")), + getTagSet("team3"), + new Point("7"), + getSessionSet()), // Empty session set new Member(new Name("Irfan Ibrahim"), new Telegram("ibrahim_irfan"), new Room("3/05/323"), - getTagSet("team2")), + getTagSet("team2"), + new Point("3"), + getSessionSet()), // Empty session set new Member(new Name("Roy Balakrishnan"), new Telegram("roy_da_bomb"), new Room("8/04/258"), - getTagSet("team2")) + getTagSet("team2"), + new Point("5"), + getSessionSet()) // Empty session set }; } @@ -56,4 +84,22 @@ public static Set getTagSet(String... strings) { .collect(Collectors.toSet()); } + /** + * Returns a session set containing the list of information given. + * If no arguments are provided, returns an empty session set. + */ + public static Set getSessionSet(SessionName[] names, SessionDate[] dates, Point[] points) { + Set sessionSet = new HashSet<>(); + for (int i = 0; i < names.length; i++) { + sessionSet.add(new Session(names[i], dates[i], points[i])); + } + return sessionSet; + } + + /** + * Returns an empty session set if no sessions are provided. + */ + public static Set getSessionSet() { + return new HashSet<>(); + } } From 6afbd6d2660030249601971eb3c163e6a5676afa Mon Sep 17 00:00:00 2001 From: keithxun Date: Fri, 18 Oct 2024 10:22:20 +0800 Subject: [PATCH 2/6] Fix style --- .../java/hallpointer/address/model/util/SampleDataUtil.java | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/src/main/java/hallpointer/address/model/util/SampleDataUtil.java b/src/main/java/hallpointer/address/model/util/SampleDataUtil.java index d3a906178bd..23619f6107c 100644 --- a/src/main/java/hallpointer/address/model/util/SampleDataUtil.java +++ b/src/main/java/hallpointer/address/model/util/SampleDataUtil.java @@ -13,8 +13,8 @@ import hallpointer.address.model.member.Telegram; import hallpointer.address.model.point.Point; import hallpointer.address.model.session.Session; -import hallpointer.address.model.session.SessionName; import hallpointer.address.model.session.SessionDate; +import hallpointer.address.model.session.SessionName; import hallpointer.address.model.tag.Tag; /** @@ -63,7 +63,7 @@ public static Member[] getSampleMembers() { new Room("8/04/258"), getTagSet("team2"), new Point("5"), - getSessionSet()) // Empty session set + getSessionSet()) // Empty session set }; } From 3d7c331e7e92b8369179ab9ae5961b776589c09d Mon Sep 17 00:00:00 2001 From: keithxun Date: Fri, 18 Oct 2024 10:28:46 +0800 Subject: [PATCH 3/6] Update SampleDataUtil.java --- .../address/model/util/SampleDataUtil.java | 36 ++++++++----------- 1 file changed, 14 insertions(+), 22 deletions(-) diff --git a/src/main/java/hallpointer/address/model/util/SampleDataUtil.java b/src/main/java/hallpointer/address/model/util/SampleDataUtil.java index 23619f6107c..20580389643 100644 --- a/src/main/java/hallpointer/address/model/util/SampleDataUtil.java +++ b/src/main/java/hallpointer/address/model/util/SampleDataUtil.java @@ -26,44 +26,39 @@ public static Member[] getSampleMembers() { return new Member[] { new Member(new Name("Alex Yeoh"), new Telegram("alex_yeoh98"), new Room("12/04/201"), - getTagSet("subcommLeader"), new Point("6"), + getTagSet("subcommLeader"), new Point("10"), getSessionSet( - new SessionName[]{new SessionName("AGM"), new SessionName("Team Meeting")}, - new SessionDate[]{new SessionDate("24 Sep 2024"), new SessionDate("02 Oct 2024")}, - new Point[]{new Point("6"), new Point("4")} + new Session(new SessionName("AGM"), new SessionDate("24 Sep 2024"), new Point("6")), + new Session(new SessionName("Team Meeting"), new SessionDate("02 Oct 2024"), new Point("4")) )), new Member(new Name("Bernice Yu"), new Telegram("BobLim23"), new Room("5/03/102"), getTagSet("competitionLeader", "achiever"), new Point("10"), getSessionSet( - new SessionName[]{new SessionName("Workshop")}, - new SessionDate[]{new SessionDate("15 Oct 2024")}, - new Point[]{new Point("10")} + new Session(new SessionName("Workshop"), new SessionDate("15 Oct 2024"), new Point("10")) )), new Member(new Name("Charlotte Oliveiro"), new Telegram("oliveiro"), new Room("3/02/301"), getTagSet("team1"), new Point("5"), getSessionSet( - new SessionName[]{new SessionName("Team Bonding")}, - new SessionDate[]{new SessionDate("20 Sep 2024")}, - new Point[]{new Point("5")} + new Session(new SessionName("Team Bonding"), new SessionDate("20 Sep 2024"), new Point("5")) )), new Member(new Name("David Li"), new Telegram("davidLiOnly"), new Room("14/06/301"), getTagSet("team3"), - new Point("7"), + new Point("0"), getSessionSet()), // Empty session set new Member(new Name("Irfan Ibrahim"), new Telegram("ibrahim_irfan"), new Room("3/05/323"), getTagSet("team2"), - new Point("3"), + new Point("0"), getSessionSet()), // Empty session set new Member(new Name("Roy Balakrishnan"), new Telegram("roy_da_bomb"), new Room("8/04/258"), getTagSet("team2"), - new Point("5"), - getSessionSet()) // Empty session set + new Point("0"), + getSessionSet()) // Empty session set }; } @@ -85,15 +80,12 @@ public static Set getTagSet(String... strings) { } /** - * Returns a session set containing the list of information given. - * If no arguments are provided, returns an empty session set. + * Returns a session set containing the list of sessions provided. + * If no sessions are provided, returns an empty session set. */ - public static Set getSessionSet(SessionName[] names, SessionDate[] dates, Point[] points) { - Set sessionSet = new HashSet<>(); - for (int i = 0; i < names.length; i++) { - sessionSet.add(new Session(names[i], dates[i], points[i])); - } - return sessionSet; + public static Set getSessionSet(Session... sessions) { + return Arrays.stream(sessions) + .collect(Collectors.toSet()); } /** From 2526d0897358a4608dad48b356f235c6103e9acd Mon Sep 17 00:00:00 2001 From: keithxun Date: Fri, 18 Oct 2024 10:30:46 +0800 Subject: [PATCH 4/6] Update app name in fxml --- src/main/resources/view/MainWindow.fxml | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/src/main/resources/view/MainWindow.fxml b/src/main/resources/view/MainWindow.fxml index 8d4bcdb7801..bd4060d7434 100644 --- a/src/main/resources/view/MainWindow.fxml +++ b/src/main/resources/view/MainWindow.fxml @@ -11,7 +11,7 @@ + title="Hall pointer" minWidth="450" minHeight="600" onCloseRequest="#handleExit"> From 20474c083831eacb7a0ecec1b61e5ee3425793f4 Mon Sep 17 00:00:00 2001 From: keithxun Date: Fri, 18 Oct 2024 10:32:12 +0800 Subject: [PATCH 5/6] Fix style --- .../java/hallpointer/address/model/util/SampleDataUtil.java | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/src/main/java/hallpointer/address/model/util/SampleDataUtil.java b/src/main/java/hallpointer/address/model/util/SampleDataUtil.java index 20580389643..dac250f78ce 100644 --- a/src/main/java/hallpointer/address/model/util/SampleDataUtil.java +++ b/src/main/java/hallpointer/address/model/util/SampleDataUtil.java @@ -58,7 +58,7 @@ public static Member[] getSampleMembers() { new Room("8/04/258"), getTagSet("team2"), new Point("0"), - getSessionSet()) // Empty session set + getSessionSet()) // Empty session set }; } From e025f714053338bbdc9d8061eff743245510d096 Mon Sep 17 00:00:00 2001 From: keithxun Date: Fri, 18 Oct 2024 10:35:41 +0800 Subject: [PATCH 6/6] Update name --- src/main/resources/view/MainWindow.fxml | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/src/main/resources/view/MainWindow.fxml b/src/main/resources/view/MainWindow.fxml index bd4060d7434..c8aeda21364 100644 --- a/src/main/resources/view/MainWindow.fxml +++ b/src/main/resources/view/MainWindow.fxml @@ -11,7 +11,7 @@ + title="Hall Pointer" minWidth="450" minHeight="600" onCloseRequest="#handleExit">