From 196d8041fe23a863e08d4880204776ced2318fc4 Mon Sep 17 00:00:00 2001 From: fdai7920 Date: Fri, 2 Feb 2024 15:07:45 +0100 Subject: [PATCH] Relationship Player_PlayerService --- src/main/java/de/hsfulda/onses/models/Player.java | 14 ++++++++++++++ .../de/hsfulda/onses/services/PlayerService.java | 6 ++++++ 2 files changed, 20 insertions(+) diff --git a/src/main/java/de/hsfulda/onses/models/Player.java b/src/main/java/de/hsfulda/onses/models/Player.java index 77eb2b1..3f92e8d 100644 --- a/src/main/java/de/hsfulda/onses/models/Player.java +++ b/src/main/java/de/hsfulda/onses/models/Player.java @@ -1,9 +1,12 @@ package de.hsfulda.onses.models; +import de.hsfulda.onses.services.PlayerService; + import java.util.ArrayList; public class Player { + private PlayerService playerService; private final ArrayList playerDeck = new ArrayList<>(); public ArrayList getPlayerDeck() { @@ -13,4 +16,15 @@ public class Player { public void addCardToPlayerDeck(Card card) { playerDeck.add(card); } + + + + public PlayerService getPlayerService() { + return playerService; + } + + public Player setPlayerService(PlayerService playerService) { + this.playerService = playerService; + return this; + } } diff --git a/src/main/java/de/hsfulda/onses/services/PlayerService.java b/src/main/java/de/hsfulda/onses/services/PlayerService.java index 32d1c5e..61c5eff 100644 --- a/src/main/java/de/hsfulda/onses/services/PlayerService.java +++ b/src/main/java/de/hsfulda/onses/services/PlayerService.java @@ -41,4 +41,10 @@ public class PlayerService { this.game = game; return this; } + + public PlayerService() + { + addPlayerToList(new Player().setPlayerService(this)); + addPlayerToList(new Player().setPlayerService(this)); + } }