gecco.communication.server
Class DataInputExchangeHandler

java.lang.Object
  |
  +--gecco.communication.server.DataInputExchangeHandler
All Implemented Interfaces:
Runnable

public class DataInputExchangeHandler
extends Object
implements Runnable

a class that sends messages from the server, in the send queue

Author:
Niklas Hallenfur, Henrik Hägerström, Jon Åslund

Field Summary
private  ClientConnection connection
          Description of the Field
private  DataOutputExchangeHandler DEHOutput
          Description of the Field
private  boolean disconnect
          Description of the Field
private  ClientConnectionHandler i_am_working_for
          Description of the Field
private  Server server
          Description of the Field
 
Constructor Summary
DataInputExchangeHandler(ClientConnection cc, Server se, ClientConnectionHandler cch, DataOutputExchangeHandler outputDEH)
          Constructor for the DataInputExchangeHandler object
 
Method Summary
 void abortGame()
          called when the client says it wants to abort the game or disconnect
private  void acknowledgePingReply()
          Description of the Method
 void getAbortAction()
          gets a message from the client that tells the server that a unit wants to abort an action
 void getActionOnPosition()
          gets a message from the client that tells the server that a unit wants to perform an action with a position as target
 void getActionOnUnit()
          gets a message from the client that tells the server that a unit wants to perform an action with a unit as target
 void getActionOnVoid()
          gets a message from the client that tells the server that a unit wants to perform an action with no target
private  void getStartGame()
          Gets the StartGame attribute of the DataInputExchangeHandler object
 void kill()
          called whenever someone wants this Thread to die
private  void receiveMessage(int leadingInteger)
          Called when there is a message to be received in the InputStream from the client
 void run()
          Main processing method for the DataInputExchangeHandler object
 
Methods inherited from class java.lang.Object
, clone, equals, finalize, getClass, hashCode, notify, notifyAll, registerNatives, toString, wait, wait, wait
 

Field Detail

connection

private ClientConnection connection
Description of the Field

server

private Server server
Description of the Field

i_am_working_for

private ClientConnectionHandler i_am_working_for
Description of the Field

disconnect

private boolean disconnect
Description of the Field

DEHOutput

private DataOutputExchangeHandler DEHOutput
Description of the Field
Constructor Detail

DataInputExchangeHandler

public DataInputExchangeHandler(ClientConnection cc,
                                Server se,
                                ClientConnectionHandler cch,
                                DataOutputExchangeHandler outputDEH)
Constructor for the DataInputExchangeHandler object
Parameters:
cc - Description of Parameter
se - Description of Parameter
cch - Description of Parameter
outputDEH - Description of Parameter
Method Detail

getActionOnVoid

public void getActionOnVoid()
                     throws Exception
gets a message from the client that tells the server that a unit wants to perform an action with no target
Throws:
Exception - Description of Exception

getActionOnUnit

public void getActionOnUnit()
                     throws Exception
gets a message from the client that tells the server that a unit wants to perform an action with a unit as target
Throws:
Exception - Description of Exception

getActionOnPosition

public void getActionOnPosition()
                         throws Exception
gets a message from the client that tells the server that a unit wants to perform an action with a position as target
Throws:
Exception - Description of Exception

getAbortAction

public void getAbortAction()
                    throws Exception
gets a message from the client that tells the server that a unit wants to abort an action
Throws:
Exception - Description of Exception

run

public void run()
Main processing method for the DataInputExchangeHandler object
Specified by:
run in interface Runnable

abortGame

public void abortGame()
called when the client says it wants to abort the game or disconnect

kill

public void kill()
called whenever someone wants this Thread to die

getStartGame

private void getStartGame()
                   throws Exception
Gets the StartGame attribute of the DataInputExchangeHandler object
Throws:
Exception - Description of Exception

receiveMessage

private void receiveMessage(int leadingInteger)
Called when there is a message to be received in the InputStream from the client
Parameters:
leadingInteger - Description of Parameter

acknowledgePingReply

private void acknowledgePingReply()
                           throws Exception
Description of the Method
Throws:
Exception - Description of Exception