|
||||||||
| PREV CLASS NEXT CLASS | FRAMES NO FRAMES | |||||||
| SUMMARY: INNER | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD | |||||||
java.lang.Object
|
+--java.rmi.server.RemoteObject
|
+--java.rmi.server.RemoteServer
|
+--java.rmi.server.UnicastRemoteObject
|
+--au.com.solidsoftware.multimahjong.shared.Referee
Referee is in charge of initialising the game and delivering the moves to
each player. The Game class has a reference to the Referee and
it calls it to place the player's next move. The Referee also has references
to all of the Observers, which in turn have references to the
respective Game classes on each MMC.
RegistrarImpl, Serialized Form| Field Summary | |
private ObserverIntf[] |
game
List of games. |
(package private) Wall |
gameWall
Temp hold for players. |
private int |
limit
Games limit |
static int |
MAX_CLIENTS
|
protected int |
noOfClients
Number of clients present. |
(package private) int[] |
player
Temp holder for wall. |
private MiniPlayer[] |
players
Players in the game |
private int[] |
positions
Indicated the location of the players. |
private boolean[] |
received
Indicates whether wall has been receieved. |
(package private) int[] |
robSelection
List of moves for robbing the kong. |
(package private) int[] |
selection
List of moves selected by players |
private int |
selectionsMade
Selections placed on the Referee |
boolean |
serverInitialised
Flag to signal if server wall has been reinitialised |
(package private) Tile[] |
wall
|
| Fields inherited from class java.rmi.server.UnicastRemoteObject |
csf,
port,
portFactoryParamTypes,
portParamTypes,
serialVersionUID,
ssf |
| Fields inherited from class java.rmi.server.RemoteServer |
log,
logname,
serialVersionUID |
| Fields inherited from class java.rmi.server.RemoteObject |
ref,
serialVersionUID |
| Constructor Summary | |
Referee(java.lang.String name,
int limit,
int iconID,
ObserverIntf creatorObserver)
Server Constructor- constructs wall and players positions. |
|
| Method Summary | |
int |
addPlayer(ObserverIntf observer,
java.lang.String name,
int iconID)
|
void |
beginGame()
|
void |
determineRobKong(int willRob,
int playerPosition,
int currentPlayer)
Players enter there selections, if they can and want to rob kong. |
void |
exitGame()
|
int |
getLimit()
|
MiniPlayer[] |
getPlayers()
|
int |
getPos()
Get the next players position and removes position from the list once retrieved. |
int[] |
getPositions()
|
Wall |
getWall()
Given a tile position in the wall getWall returns the contents of this given position. |
void |
initServer()
Initialise wall and player positions. |
void |
placePlayerAction(Moves currentMove,
int action)
Inserts the selected tile to kong into the server3 and notifies all other waiting threads that the new discard has been placed. |
void |
placeSelection(int selectionNo,
int playerNo,
int currentPlayer)
Inserts a players selection into the selection storage, and checks to see if all selections have been placed. |
| Methods inherited from class java.rmi.server.UnicastRemoteObject |
|
| Methods inherited from class java.rmi.server.RemoteServer |
getClientHost,
getLog,
setLog |
| Methods inherited from class java.rmi.server.RemoteObject |
equals,
getRef,
hashCode,
toString,
toStub,
writeObject |
| Methods inherited from class java.lang.Object |
finalize,
getClass,
notify,
notifyAll,
registerNatives,
wait,
wait,
wait |
| Field Detail |
public static final int MAX_CLIENTS
public boolean serverInitialised
Tile[] wall
int[] player
Wall gameWall
int[] selection
int[] robSelection
private ObserverIntf[] game
private int[] positions
private MiniPlayer[] players
private boolean[] received
protected int noOfClients
private int limit
private int selectionsMade
| Constructor Detail |
public Referee(java.lang.String name,
int limit,
int iconID,
ObserverIntf creatorObserver)
throws java.rmi.RemoteException
| Method Detail |
public MiniPlayer[] getPlayers()
throws java.rmi.RemoteException
public int[] getPositions()
throws java.rmi.RemoteException
public int getLimit()
throws java.rmi.RemoteException
public int addPlayer(ObserverIntf observer,
java.lang.String name,
int iconID)
throws java.rmi.RemoteException
public void beginGame()
throws java.rmi.RemoteException
public void initServer()
throws java.rmi.RemoteException
public int getPos()
throws java.rmi.RemoteException
public Wall getWall()
throws java.rmi.RemoteException
tileNo - The location at which the game thread wants the next tile.
public void placeSelection(int selectionNo,
int playerNo,
int currentPlayer)
throws java.rmi.RemoteException
selectionNo - Players selection.playerNo - Position of player making this selection.
public void placePlayerAction(Moves currentMove,
int action)
throws java.rmi.RemoteException
selectedTile - Tile to try and reveal.action - Whether to continue revealing kongs. 1-Continue, 0-Don't.
public void determineRobKong(int willRob,
int playerPosition,
int currentPlayer)
throws java.rmi.RemoteException
willrob - 0- if cant or don't want to rob kong.
1- if select to rob.playerPosition - Player making the selection.
public void exitGame()
throws java.rmi.RemoteException
|
||||||||
| PREV CLASS NEXT CLASS | FRAMES NO FRAMES | |||||||
| SUMMARY: INNER | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD | |||||||