Compare commits

..

No commits in common. "dtos" and "main" have entirely different histories.
dtos ... main

3 changed files with 5 additions and 22 deletions

View File

@ -1,7 +1,7 @@
package de.th_mannheim.informatik.blackjack.facade; package de.th_mannheim.informatik.blackjack.facade;
import de.th_mannheim.informatik.blackjack.domain.Card;
import de.th_mannheim.informatik.blackjack.domain.CardDeck; import de.th_mannheim.informatik.blackjack.domain.CardDeck;
import de.th_mannheim.informatik.blackjack.facade.dtos.CardDTO;
public class BlackjackGame { public class BlackjackGame {
private CardDeck deck; private CardDeck deck;
@ -10,8 +10,8 @@ public class BlackjackGame {
this.deck = new CardDeck(); this.deck = new CardDeck();
} }
public CardDTO getNextCard() { public Card getNextCard() {
return new CardDTO(deck.getNextCard()); return deck.getNextCard();
} }
} }

View File

@ -1,17 +0,0 @@
package de.th_mannheim.informatik.blackjack.facade.dtos;
import de.th_mannheim.informatik.blackjack.domain.Card;
// Records sind "immutable data classes", die seit Version 14 verfügbar sind.
// Sie benötigen nur die Angaben der gewünschten Attribute, auf die per Punkt-Notation
// zugegriffen werden kann.
public record CardDTO(String name, int points) {
public CardDTO(Card card) {
this(card.toString(), card.getPoints());
}
public String toString() {
return name;
}
}

View File

@ -7,11 +7,11 @@ public class GameMenu {
public GameMenu(BlackjackGame game) { public GameMenu(BlackjackGame game) {
this.game = game; this.game = game;
System.out.println("Willkommen beim THMA Blackjack!");
} }
public void show() { public void show() {
System.out.println();
System.out.println("Ihre Karten sind: "); System.out.println("Ihre Karten sind: ");
System.out.println(game.getNextCard()); System.out.println(game.getNextCard());