gecco.client
Class TestServer

java.lang.Object
  |
  +--gecco.client.TestServer
All Implemented Interfaces:
Server

public class TestServer
extends Object
implements Server

This a test implementation of a server. It is very ugly and should only be used for testing purposes.

Author:
Andreas Enblom

Inner Class Summary
 class TestServer.TestThread
          Description of the Class
 
Field Summary
(package private)  long actionId
          Description of the Field
(package private)  Client client
          Description of the Field
(package private)  Image map
          Description of the Field
(package private)  int numOfPieces
          Description of the Field
(package private)  Position[] positions
          Description of the Field
(package private)  TestServer.TestThread serverThread
          Description of the Field
(package private)  boolean[] shouldRest
          Description of the Field
(package private)  Dimension size
          Description of the Field
(package private)  Hashtable stateMap
          Description of the Field
 
Constructor Summary
TestServer(Client c)
          Constructor for the TestServer object
 
Method Summary
 void abortAction(long actionId)
          Description of the Method
 boolean connect(String host, int port)
          Description of the Method
 void disconnect()
          Description of the Method
 long doAction(int pieceHandle, Action a)
          Description of the Method
 StringTokenizer getAvailableRoles()
          Gets the AvailableRoles attribute of the TestServer object
 Image getMap()
          Gets the Map attribute of the TestServer object
 Dimension getMapSize()
          Gets the MapSize attribute of the TestServer object
 Point getMapUpperLeft()
          Gets the MapUpperLeft attribute of the TestServer object
 boolean joinAsRole(String role)
          Description of the Method
 void startGame()
          Description of the Method
 
Methods inherited from class java.lang.Object
, clone, equals, finalize, getClass, hashCode, notify, notifyAll, registerNatives, toString, wait, wait, wait
 

Field Detail

actionId

long actionId
Description of the Field

client

Client client
Description of the Field

numOfPieces

final int numOfPieces
Description of the Field

positions

Position[] positions
Description of the Field

shouldRest

boolean[] shouldRest
Description of the Field

stateMap

Hashtable stateMap
Description of the Field

serverThread

TestServer.TestThread serverThread
Description of the Field

size

Dimension size
Description of the Field

map

Image map
Description of the Field
Constructor Detail

TestServer

public TestServer(Client c)
Constructor for the TestServer object
Parameters:
c - Description of Parameter
Method Detail

getAvailableRoles

public StringTokenizer getAvailableRoles()
Gets the AvailableRoles attribute of the TestServer object
Specified by:
getAvailableRoles in interface Server
Returns:
The AvailableRoles value

getMapUpperLeft

public Point getMapUpperLeft()
Gets the MapUpperLeft attribute of the TestServer object
Specified by:
getMapUpperLeft in interface Server
Returns:
The MapUpperLeft value

getMapSize

public Dimension getMapSize()
Gets the MapSize attribute of the TestServer object
Specified by:
getMapSize in interface Server
Returns:
The MapSize value

getMap

public Image getMap()
Gets the Map attribute of the TestServer object
Specified by:
getMap in interface Server
Returns:
The Map value

connect

public boolean connect(String host,
                       int port)
Description of the Method
Specified by:
connect in interface Server
Parameters:
host - Description of Parameter
port - Description of Parameter
Returns:
Description of the Returned Value

disconnect

public void disconnect()
Description of the Method
Specified by:
disconnect in interface Server

joinAsRole

public boolean joinAsRole(String role)
Description of the Method
Specified by:
joinAsRole in interface Server
Parameters:
role - Description of Parameter
Returns:
Description of the Returned Value

startGame

public void startGame()
Description of the Method
Specified by:
startGame in interface Server

doAction

public long doAction(int pieceHandle,
                     Action a)
Description of the Method
Specified by:
doAction in interface Server
Parameters:
pieceHandle - Description of Parameter
a - Description of Parameter
Returns:
Description of the Returned Value

abortAction

public void abortAction(long actionId)
Description of the Method
Specified by:
abortAction in interface Server
Parameters:
actionId - Description of Parameter