edu.umk.mat.merdacz.JGFramework
Class GameTable

java.lang.Object
  extended byedu.umk.mat.merdacz.JGFramework.GameTable

public class GameTable
extends java.lang.Object

Thread safe

Author:
Marcin Daczkowski

Field Summary
(package private)  java.lang.Object lockTable
           
(package private)  java.lang.Object lockWinner
           
(package private)  int maxPlayers
           
(package private)  java.util.HashMap table
           
private  Player winner
           
 
Constructor Summary
GameTable(int maxPlayers)
           
 
Method Summary
 int emptyPlaces()
           
 Player getWinner()
           
 boolean isAllReady()
           
 boolean isAllUnpaused()
           
private  boolean isByTable(java.lang.String playerName)
           
 boolean isDefeat(Player p)
           
 boolean isGameOver()
           
 void reset()
          after we have winner we need to reset some values in out players HashMap for example need to set all ready's to false etc
 void setDefeat(Player p)
           
 boolean setReady(java.lang.String playerName)
           
 boolean sitDown(Player p)
           
 boolean standUp(Player p)
           
 boolean switchPause(java.lang.String playerName)
           
 java.lang.String toXml()
          Produces xml which contains all players sitting by the table
 
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
 

Field Detail

maxPlayers

int maxPlayers

table

java.util.HashMap table

lockTable

java.lang.Object lockTable

lockWinner

java.lang.Object lockWinner

winner

private Player winner
Constructor Detail

GameTable

public GameTable(int maxPlayers)
Method Detail

sitDown

public boolean sitDown(Player p)

standUp

public boolean standUp(Player p)

emptyPlaces

public int emptyPlaces()

isAllUnpaused

public boolean isAllUnpaused()

isAllReady

public boolean isAllReady()

isGameOver

public boolean isGameOver()

getWinner

public Player getWinner()

setDefeat

public void setDefeat(Player p)

isDefeat

public boolean isDefeat(Player p)

switchPause

public boolean switchPause(java.lang.String playerName)

setReady

public boolean setReady(java.lang.String playerName)

reset

public void reset()
after we have winner we need to reset some values in out players HashMap for example need to set all ready's to false etc


toXml

public java.lang.String toXml()
Produces xml which contains all players sitting by the table

Returns:

isByTable

private boolean isByTable(java.lang.String playerName)