Browse Source

Relationship Player_PlayerService

main
fdai7920 11 months ago
parent
commit
196d8041fe
  1. 14
      src/main/java/de/hsfulda/onses/models/Player.java
  2. 6
      src/main/java/de/hsfulda/onses/services/PlayerService.java

14
src/main/java/de/hsfulda/onses/models/Player.java

@ -1,9 +1,12 @@
package de.hsfulda.onses.models; package de.hsfulda.onses.models;
import de.hsfulda.onses.services.PlayerService;
import java.util.ArrayList; import java.util.ArrayList;
public class Player { public class Player {
private PlayerService playerService;
private final ArrayList<Card> playerDeck = new ArrayList<>(); private final ArrayList<Card> playerDeck = new ArrayList<>();
public ArrayList<Card> getPlayerDeck() { public ArrayList<Card> getPlayerDeck() {
@ -13,4 +16,15 @@ public class Player {
public void addCardToPlayerDeck(Card card) { public void addCardToPlayerDeck(Card card) {
playerDeck.add(card); playerDeck.add(card);
} }
public PlayerService getPlayerService() {
return playerService;
}
public Player setPlayerService(PlayerService playerService) {
this.playerService = playerService;
return this;
}
} }

6
src/main/java/de/hsfulda/onses/services/PlayerService.java

@ -41,4 +41,10 @@ public class PlayerService {
this.game = game; this.game = game;
return this; return this;
} }
public PlayerService()
{
addPlayerToList(new Player().setPlayerService(this));
addPlayerToList(new Player().setPlayerService(this));
}
} }
Loading…
Cancel
Save