Back to project page Briscola.
The source code is released under:
GNU General Public License
If you think the Android project Briscola listed in this page is inappropriate, such as containing malicious code/tools or violating the copyright, please email info at java2s dot com, thanks.
package com.gmail.craptik.briscola; /*from w w w.ja va 2 s.c o m*/ import java.util.ArrayList; public class GameData { private ArrayList<Player> players; private Player first; private Player caller; private int callerBid; private Card calledCard; private Player callee; private Player nemesisCaller; private int callerScore; GameData() { players = new ArrayList<Player>(); first = null; caller = null; callerBid = -1; calledCard = new Card(ECardSuit.NONE, ECardNumber.NONE); callee = null; nemesisCaller = null; callerScore = -1; } public int findPlayer(Player player) { return findPlayer(player.getName()); } public int findPlayer(String playerName) { int ixPlayer = -1; for(int i = 0; i < players.size(); i++) { if(players.get(i).getName().equals(playerName)) { ixPlayer = i; break; } } return ixPlayer; } public int findNemesis() { return findPlayer("Nemesis"); } public boolean isPlayerPresent(Player player) { return isPlayerPresent(player.getName()); } public boolean isPlayerPresent(String playerName) { return findPlayer(playerName) != -1; } public boolean isNemesisPresent() { return isPlayerPresent("Nemesis"); } public ArrayList<Player> getPlayers() { assert players != null; return players; } // Shouldn't be null; we can have an empty list public Player getFirst() { return first; } public Player getCaller() { return caller; } public int getCallerBid() { return callerBid; } public Card getCalledCard() { assert calledCard != null; return calledCard; } // Shouldn't be null; we have enums for invalid public Player getCallee() { return callee; } public Player getNemesisCaller() { return nemesisCaller; } public int getCallerScore() { return callerScore; } public void setPlayers(ArrayList<Player> players) { this.players = players; } public void setFirst(Player first) { this.first = first; } public void setCaller(Player caller) { this.caller = caller; } public void setCallerBid(int callerBid) { this.callerBid = callerBid; } public void setCalledCard(Card calledCard) { this.calledCard = calledCard; } public void setCallee(Player callee) { this.callee = callee; } public void setNemesisCaller(Player nemesisCaller) { this.nemesisCaller = nemesisCaller; } public void setCallerScore(int callerScore) { this.callerScore = callerScore; } }