Skip to content

Commit

Permalink
Merge pull request #93 from keithxun/branch-sampleData
Browse files Browse the repository at this point in the history
Update sample data to include sessions and points
  • Loading branch information
starchypotatocode authored Oct 18, 2024
2 parents 78f7864 + e025f71 commit 951b288
Show file tree
Hide file tree
Showing 2 changed files with 45 additions and 7 deletions.
50 changes: 44 additions & 6 deletions src/main/java/hallpointer/address/model/util/SampleDataUtil.java
Original file line number Diff line number Diff line change
@@ -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;

Expand All @@ -10,32 +11,54 @@
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.SessionDate;
import hallpointer.address.model.session.SessionName;
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("10"),
getSessionSet(
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")),
getTagSet("competitionLeader", "achiever"),
new Point("10"),
getSessionSet(
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")),
getTagSet("team1"), new Point("5"),
getSessionSet(
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")),
getTagSet("team3"),
new Point("0"),
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("0"),
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("0"),
getSessionSet()) // Empty session set
};
}

Expand All @@ -56,4 +79,19 @@ public static Set<Tag> getTagSet(String... strings) {
.collect(Collectors.toSet());
}

/**
* Returns a session set containing the list of sessions provided.
* If no sessions are provided, returns an empty session set.
*/
public static Set<Session> getSessionSet(Session... sessions) {
return Arrays.stream(sessions)
.collect(Collectors.toSet());
}

/**
* Returns an empty session set if no sessions are provided.
*/
public static Set<Session> getSessionSet() {
return new HashSet<>();
}
}
2 changes: 1 addition & 1 deletion src/main/resources/view/MainWindow.fxml
Original file line number Diff line number Diff line change
Expand Up @@ -11,7 +11,7 @@
<?import javafx.scene.Scene?>
<?import javafx.stage.Stage?>
<fx:root type="javafx.stage.Stage" xmlns="http://javafx.com/javafx/17" xmlns:fx="http://javafx.com/fxml/1"
title="Address App" minWidth="450" minHeight="600" onCloseRequest="#handleExit">
title="Hall Pointer" minWidth="450" minHeight="600" onCloseRequest="#handleExit">
<icons>
<Image url="@/images/address_book_32.png" />
</icons>
Expand Down

0 comments on commit 951b288

Please sign in to comment.