From 644c3e93fcd2a8f99c129d3319d79947416c9c42 Mon Sep 17 00:00:00 2001 From: Julian Kropff Date: Fri, 10 Apr 2026 20:31:15 +0200 Subject: [PATCH] Refactor: improve Card class Refs #52 --- .../dbis/cs108/casono/client/game/Card.java | 51 ++++++++++++++++++- 1 file changed, 49 insertions(+), 2 deletions(-) diff --git a/src/main/java/ch/unibas/dmi/dbis/cs108/casono/client/game/Card.java b/src/main/java/ch/unibas/dmi/dbis/cs108/casono/client/game/Card.java index 1d2a7f4..abd4e4a 100644 --- a/src/main/java/ch/unibas/dmi/dbis/cs108/casono/client/game/Card.java +++ b/src/main/java/ch/unibas/dmi/dbis/cs108/casono/client/game/Card.java @@ -4,6 +4,53 @@ package ch.unibas.dmi.dbis.cs108.casono.client.game; * Represents a playing card with a value and suit. */ public class Card { - public String value; - public String suit; + private String value; + private String suit; + + /** + * Constructs a Card with the specified value and suit. + * + * @param value The value of the card (e.g., 2, 3, ..., 10, J, Q, K, A). + * @param suit The suit of the card (e.g., Hearts, Diamonds, Clubs, Spades). + */ + public Card(String value, String suit) { + this.value = value; + this.suit = suit; + } + + /** + * Retrieves the value of the card. + * + * @return The value of the card. + */ + public String getValue() { + return value; + } + + /** + * Retrieves the suit of the card. + * + * @return The suit of the card. + */ + public String getSuit() { + return suit; + } + + /** + * Sets the value of the card. + * + * @param value The value to set for the card. + */ + public void setValue(String value) { + this.value = value; + } + + /** + * Sets the suit of the card. + * + * @param suit The suit to set for the card. + */ + public void setSuit(String suit) { + this.suit = suit; + } }