dk.brics.bisimulationGame.controller
Class GameControllerImpl
java.lang.Object
java.rmi.server.RemoteObject
java.rmi.server.RemoteServer
java.rmi.server.UnicastRemoteObject
dk.brics.bisimulationGame.controller.GameControllerImpl
- All Implemented Interfaces:
- GameController, java.io.Serializable, java.rmi.Remote
public class GameControllerImpl
- extends java.rmi.server.UnicastRemoteObject
- implements GameController
Implementation of the GameController.
- Author:
- Martin Mosegaard martinm@daimi.au.dk
- See Also:
GameController
,
Serialized Form
Fields inherited from class java.rmi.server.RemoteObject |
ref |
Method Summary |
private void |
attackerChoseSide(int side,
java.lang.String message)
|
private void |
attackerStep(java.lang.String action,
java.lang.String nodeName,
java.lang.String message)
|
private void |
defenderStep(java.lang.String nodeName)
|
private java.lang.String |
getRoleMessage()
|
private void |
prepareGameView()
|
void |
quit()
Invoked by the message passer when the other player wants to quit. |
private void |
resetGame()
|
void |
setChatMessage(java.lang.String message)
Invoked by the message passer when the other player sends a
chat message. |
private void |
setupListeners()
|
void |
updateStatus(int messageNumber,
java.lang.String message)
Invoked by the message passer when status has changed by another players
move. |
Methods inherited from class java.rmi.server.UnicastRemoteObject |
clone, exportObject, exportObject, exportObject, 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 |
Methods inherited from class java.lang.Object |
finalize, getClass, notify, notifyAll, wait, wait, wait |
serialVersionUID
private static final long serialVersionUID
- See Also:
- Constant Field Values
myRole
private int myRole
clientServerRole
private int clientServerRole
gameModel
private GameModel gameModel
gameView
private GameView gameView
controller
private BisimulationGame controller
messagePasser
private MessagePasser messagePasser
lonely
private boolean lonely
gameGrappaAdapter
private GameControllerImpl.GameGrappaAdapter gameGrappaAdapter
- Listeners
remoteActionListener
private GameControllerImpl.RemoteActionListener remoteActionListener
remoteMouseListener
private GameControllerImpl.RemoteMouseListener remoteMouseListener
GameControllerImpl
public GameControllerImpl(BisimulationGame controller,
GameView gameView,
GameModel gameModel,
int myRole,
int clientServerRole,
MessagePasser messagePasser)
throws java.rmi.RemoteException
- Constructs a game controller.
- Parameters:
controller
- A game instancegameView
- A view on which to listen on eventsgameModel
- A data modelmyRole
- As specified in the game modelclientServerRole
- As specified in the game modelmessagePasser
- A message passer to send move messages to the other player
- Throws:
java.rmi.RemoteException
setupListeners
private void setupListeners()
prepareGameView
private void prepareGameView()
throws java.rmi.RemoteException
- Throws:
java.rmi.RemoteException
getRoleMessage
private java.lang.String getRoleMessage()
attackerChoseSide
private void attackerChoseSide(int side,
java.lang.String message)
attackerStep
private void attackerStep(java.lang.String action,
java.lang.String nodeName,
java.lang.String message)
defenderStep
private void defenderStep(java.lang.String nodeName)
resetGame
private void resetGame()
updateStatus
public void updateStatus(int messageNumber,
java.lang.String message)
- Description copied from interface:
GameController
- Invoked by the message passer when status has changed by another players
move.
Message numbers are specified in the protocol.
- Specified by:
updateStatus
in interface GameController
- Parameters:
messageNumber
- A protocol message numbermessage
- A message- See Also:
Protocol
quit
public void quit()
throws java.rmi.RemoteException
- Description copied from interface:
GameController
- Invoked by the message passer when the other player wants to quit.
- Specified by:
quit
in interface GameController
- Throws:
java.rmi.RemoteException
setChatMessage
public void setChatMessage(java.lang.String message)
throws java.rmi.RemoteException
- Description copied from interface:
GameController
- Invoked by the message passer when the other player sends a
chat message.
- Specified by:
setChatMessage
in interface GameController
- Throws:
java.rmi.RemoteException