Android Open Source - Briscola Game Data






From Project

Back to project page Briscola.

License

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.

Java Source Code

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; }
}




Java Source Code List

com.gmail.craptik.briscola.ActionAdapter.java
com.gmail.craptik.briscola.ActionItem.java
com.gmail.craptik.briscola.CallCardCupsSelectActivity.java
com.gmail.craptik.briscola.CallCardFeathersSelectActivity.java
com.gmail.craptik.briscola.CallCardSuitSelectActivity.java
com.gmail.craptik.briscola.CallCardSunsSelectActivity.java
com.gmail.craptik.briscola.CallCardSwordsSelectActivity.java
com.gmail.craptik.briscola.CalleeSelectActivity.java
com.gmail.craptik.briscola.CallerBidSelectActivity.java
com.gmail.craptik.briscola.Card.java
com.gmail.craptik.briscola.ECardNumber.java
com.gmail.craptik.briscola.ECardSuit.java
com.gmail.craptik.briscola.EGameProgress.java
com.gmail.craptik.briscola.FirstNemesisSelectActivity.java
com.gmail.craptik.briscola.GameData.java
com.gmail.craptik.briscola.IDatabase.java
com.gmail.craptik.briscola.MainActivity.java
com.gmail.craptik.briscola.NewGameActivity.java
com.gmail.craptik.briscola.PlayerAdapter.java
com.gmail.craptik.briscola.Player.java
com.gmail.craptik.briscola.PlayersSelectActivity.java
com.gmail.craptik.briscola.SQLGameDatabase.java
com.gmail.craptik.briscola.ScoreSelectActivity.java
com.gmail.craptik.briscola.TestDatabase.java