diff --git a/Projekte/monopoly/model/src/main/java/pp/monopoly/model/card/Card.java b/Projekte/monopoly/model/src/main/java/pp/monopoly/model/card/Card.java new file mode 100644 index 0000000..95e07d1 --- /dev/null +++ b/Projekte/monopoly/model/src/main/java/pp/monopoly/model/card/Card.java @@ -0,0 +1,23 @@ +package pp.monopoly.model.card; + +public class Card { + private final String description; + private final String keyword; + + Card(String description, String keyword) { + this.description = description; + this.keyword = keyword; + } + + public void accept(DeckHelper visitor) { + visitor.visit(this); + } + + String getDescription() { + return description; + } + + String getKeyword() { + return keyword; + } +} diff --git a/Projekte/monopoly/model/src/main/java/pp/monopoly/model/card/DeckHelper.java b/Projekte/monopoly/model/src/main/java/pp/monopoly/model/card/DeckHelper.java new file mode 100644 index 0000000..a270fd6 --- /dev/null +++ b/Projekte/monopoly/model/src/main/java/pp/monopoly/model/card/DeckHelper.java @@ -0,0 +1,34 @@ +package pp.monopoly.model.card; + +import java.util.ArrayList; +import java.util.Collections; +import java.util.List; +import java.util.Queue; + +import pp.monopoly.model.CardVisitor; + +public class DeckHelper implements CardVisitor{ + + private static Queue cards; + + private DeckHelper() { + + } + + @Override + public Void visit(Card c) { + // TODO Auto-generated method stub + throw new UnsupportedOperationException("Unimplemented method 'visit'"); + } + + private void shuffle() { + List cardList = new ArrayList<>(cards); + Collections.shuffle(cardList); + cards.clear(); + cards.addAll(cardList); + } + + public static Card drawCard() { + return cards != null ? cards.poll() : null; + } +}