dk.brics.bisim.controller
Class GameControllerImpl
java.lang.Object
java.rmi.server.RemoteObject
java.rmi.server.RemoteServer
java.rmi.server.UnicastRemoteObject
dk.brics.bisim.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 void |
displayConfiguration()
|
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
gameActionListener
private GameControllerImpl.GameActionListener gameActionListener
gameMouseListener
private GameControllerImpl.GameMouseListener gameMouseListener
GameControllerImpl
public GameControllerImpl(BisimulationGame controller,
GameView gameView,
GameModel gameModel,
int myRole,
int clientServerRole,
MessagePasser messagePasser)
throws java.rmi.RemoteException,
javax.swing.text.BadLocationException
- 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
javax.swing.text.BadLocationException
setupListeners
private void setupListeners()
prepareGameView
private void prepareGameView()
throws javax.swing.text.BadLocationException
- Throws:
javax.swing.text.BadLocationException
- Should never be thrown
attackerChoseSide
private void attackerChoseSide(int side,
java.lang.String message)
throws javax.swing.text.BadLocationException
- Parameters:
side
- A sidemessage
- A message
- Throws:
javax.swing.text.BadLocationException
- Should never be thrown
attackerStep
private void attackerStep(java.lang.String action,
java.lang.String nodeName,
java.lang.String message)
throws javax.swing.text.BadLocationException
- Parameters:
action
- Attacker's actionnodeName
- Name of to-nodemessage
- A message
- Throws:
javax.swing.text.BadLocationException
- Should never be thrown
defenderStep
private void defenderStep(java.lang.String nodeName)
throws javax.swing.text.BadLocationException
- Parameters:
nodeName
- Name of to-node
- Throws:
javax.swing.text.BadLocationException
- Should never be thrown
resetGame
private void resetGame()
throws javax.swing.text.BadLocationException
- Throws:
javax.swing.text.BadLocationException
- Should never be thrown
displayConfiguration
private void displayConfiguration()
throws javax.swing.text.BadLocationException
- Throws:
javax.swing.text.BadLocationException
- Should never be thrown
updateStatus
public void updateStatus(int messageNumber,
java.lang.String message)
throws java.rmi.RemoteException
- 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
- Throws:
java.rmi.RemoteException
- 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