summaryrefslogtreecommitdiff
path: root/src/main/java/design/model/Match.java
diff options
context:
space:
mode:
authorsowgro <tpoke.ferrari@gmail.com>2025-11-09 00:06:03 -0500
committersowgro <tpoke.ferrari@gmail.com>2025-11-09 00:06:03 -0500
commite56ad78ddba089b5bb93af96e33ee7c42b7d0b51 (patch)
tree2fa7e80f18ad516e46a8b2c783c29d61777337ad /src/main/java/design/model/Match.java
parentac4a71e3b43370fe45e39ac4e735b88f2e284a14 (diff)
downloaddesignproject-design-6-e56ad78ddba089b5bb93af96e33ee7c42b7d0b51.tar.gz
designproject-design-6-e56ad78ddba089b5bb93af96e33ee7c42b7d0b51.tar.bz2
designproject-design-6-e56ad78ddba089b5bb93af96e33ee7c42b7d0b51.zip
create most of the model and league DAOs
Diffstat (limited to '')
-rw-r--r--src/main/java/design/model/Match.java57
1 files changed, 57 insertions, 0 deletions
diff --git a/src/main/java/design/model/Match.java b/src/main/java/design/model/Match.java
new file mode 100644
index 0000000..4f01c98
--- /dev/null
+++ b/src/main/java/design/model/Match.java
@@ -0,0 +1,57 @@
+package design.model;
+
+import com.fasterxml.jackson.annotation.JsonCreator;
+
+import java.time.LocalDateTime;
+import java.util.ArrayList;
+import java.util.Date;
+import java.util.List;
+
+public class Match {
+ private final Course course;
+ private final Date dateScheduled;
+ private final LocalDateTime start;
+ private final int holeCount;
+ private final List<Round> rounds;
+
+ @JsonCreator
+ private Match(Course course, Date dateScheduled, LocalDateTime start, int holeCount, List<Round> rounds) {
+ this.course = course;
+ this.dateScheduled = dateScheduled;
+ this.start = start;
+ this.holeCount = holeCount;
+ this.rounds = rounds;
+ }
+
+ public Match(Course course, Date dateScheduled, LocalDateTime start, int holeCount) {
+ this.course = course;
+ this.dateScheduled = dateScheduled;
+ this.start = start;
+ this.holeCount = holeCount;
+ this.rounds = new ArrayList<>();
+ }
+
+ public Course getCourse() {
+ return course;
+ }
+
+ public Date getDateScheduled() {
+ return dateScheduled;
+ }
+
+ public LocalDateTime getStart() {
+ return start;
+ }
+
+ public int getHoleCount() {
+ return holeCount;
+ }
+
+ public boolean addRound(Round round) {
+ return rounds.add(round);
+ }
+
+ public Round[] getRounds() {
+ return rounds.toArray(Round[]::new);
+ }
+}