au.com.solidsoftware.multimahjong.shared
Class GamesObserver

java.lang.Object
  |
  +--java.rmi.server.RemoteObject
        |
        +--java.rmi.server.RemoteServer
              |
              +--java.rmi.server.UnicastRemoteObject
                    |
                    +--au.com.solidsoftware.multimahjong.shared.Observer
                          |
                          +--au.com.solidsoftware.multimahjong.shared.GamesObserver

public class GamesObserver
extends Observer

GamesObserver extends the Observer class and keeps the MultiGameJoiner updated about any changes in the list of games on the MMS. It is created by the MultiGameJoiner and passed to the GamesList when the MultiGameJoiner gets the list of games. The GamesList then uses this class to update the MultiGameJoiner when changes to the list of games occur.

Author:
Michael Hart
See Also:
MultiGameJoiner, GamesList, Serialized Form

Field Summary
private  MultiGameJoiner parent
          This is a reference to the MultiGameJoiner that is passed in when this class is instantiated.
 
Fields inherited from class au.com.solidsoftware.multimahjong.shared.Observer
game
 
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
GamesObserver(MultiGameJoiner parent)
          Sets the local variable parent.
 
Method Summary
 void addGame(java.lang.String name, int limit, int gameID)
          Calls a method in the MultiGameJoiner to add a game to the list.
 void removeGame(int gameID)
          Calls a method in the MultiGameJoiner to remove a game from the list.
 void updateWaiting(int gameID, int waitingToJoin)
          Calls a method in the MultiGameJoiner to update the number of people waiting for a certain game.
 
Methods inherited from class au.com.solidsoftware.multimahjong.shared.Observer
addPlayer, exitGame, placePlayerAction, placeResult, placeRobResult, setGame
 
Methods inherited from class java.rmi.server.UnicastRemoteObject
, clone, exportObject, exportObject, exportObject, exportObject, readObject, reexport, unexportObject
 
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

parent

private MultiGameJoiner parent
This is a reference to the MultiGameJoiner that is passed in when this class is instantiated.
Constructor Detail

GamesObserver

public GamesObserver(MultiGameJoiner parent)
              throws java.rmi.RemoteException
Sets the local variable parent.
Parameters:
parent - the MultiGameJoiner to contact with updates
See Also:
MultiGameJoiner
Method Detail

addGame

public void addGame(java.lang.String name,
                    int limit,
                    int gameID)
             throws java.rmi.RemoteException
Calls a method in the MultiGameJoiner to add a game to the list.
Parameters:
name - the name of the player who created the game
limit - the limit of the newly created game
gameID - the ID of the newly created game
Overrides:
addGame in class Observer
See Also:
MultiGameJoiner

updateWaiting

public void updateWaiting(int gameID,
                          int waitingToJoin)
                   throws java.rmi.RemoteException
Calls a method in the MultiGameJoiner to update the number of people waiting for a certain game.
Parameters:
gameID - the ID of the game that is being updated
waitingToJoin - the new number of players that can join this game
Overrides:
updateWaiting in class Observer
See Also:
MultiGameJoiner

removeGame

public void removeGame(int gameID)
                throws java.rmi.RemoteException
Calls a method in the MultiGameJoiner to remove a game from the list.
Parameters:
gameID - the ID of the game to be removed.
Overrides:
removeGame in class Observer
See Also:
MultiGameJoiner