|
||||||||||
PREV CLASS NEXT CLASS | FRAMES NO FRAMES | |||||||||
SUMMARY: INNER | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD |
java.lang.Object | +--gecco.communication.server.ClientAmbassador
The class that implements gecco.server.core.Client, and the only part of the communication package that the server needs to know about
Field Summary | |
private byte[] |
initialMapRGB
Description of the Field |
private Dimension |
mapSize
Description of the Field |
private Vector |
roledefs
Description of the Field |
private Hashtable |
roles
Description of the Field |
private Server |
server
Description of the Field |
Constructor Summary | |
ClientAmbassador(Vector rd,
Server server,
int port)
Initiates the ServerAmbassador, and also starts a Thread that listens for incoming clients |
Method Summary | |
boolean |
acceptRole(String role)
Called by NewClientListener when it wants to check if the role a client wants to join as, is a legal role |
void |
actionCompleted(String role,
int actionHandle,
String unitMessage)
Description of the Method |
void |
actionFailed(String role,
int actionHandle,
String errorMessage)
Description of the Method |
void |
addClient(ClientConnection c)
Called by NewClientListener when it has received a legal join request from a client |
void |
automatonHasState(String role,
int x,
int y,
Color color)
Description of the Method |
void |
automatonInvisible(String role,
int x,
int y)
Description of the Method |
void |
automatonsHasState(String role,
List pointObjects,
List colors)
Description of the Method |
void |
automatonsInvisible(String role,
List pointObjects)
Description of the Method |
void |
connectionLost(String role,
int id)
Description of the Method |
int |
getAvailableId(String role)
Called by NewClientListener when it is about to add a client, and wants to know what id the client should have. |
byte[] |
getMap()
Gets the Map attribute of the ClientAmbassador object |
Dimension |
getMapSize()
Gets the MapSize attribute of the ClientAmbassador object |
int |
getNumberOfClients()
returns the number of clients that are connected as any role |
int |
getNumberOfClients(String role)
returns the number of clients that are connected as 'role' at the moment. |
Map |
getUnitTypeIcons()
Gets the UnitTypeIcons attribute of the ClientAmbassador object |
String |
rolesLeft()
Called by NewClientListener when a client has asked for the available roles. |
void |
unitActionBlocked(String role,
int handle,
ActionDefinition action,
boolean isBlocked)
Description of the Method |
void |
unitDeleted(String role,
int handle)
Description of the Method |
void |
unitInvisible(String role,
int handle)
Description of the Method |
void |
unitMessage(String role,
int unitHandle,
String message)
Description of the Method |
void |
unitMoved(String role,
int handle,
double newX,
double newY)
Description of the Method |
void |
unitPropertyChanged(String role,
int handle,
String key,
String newValue)
Description of the Method |
void |
unitVisible(String role,
int handle,
String name,
String type,
double x,
double y,
Set unblockedActions,
Set blockedActions,
Map properties)
Here follows the implementation of the methods in interface gecco.server.core.Client. |
String |
whoIsConnected()
returns a String with the names of all connected clients |
Methods inherited from class java.lang.Object |
|
Field Detail |
private Hashtable roles
private Vector roledefs
private Server server
private byte[] initialMapRGB
private Dimension mapSize
Constructor Detail |
public ClientAmbassador(Vector rd, Server server, int port)
rd
- A vector containing RoleDefinition objects, used to
create the appropriate number of RoleConnectoions, and to keep track
of what roles are still available to join asserver
- The server from the communication parts point of viewport
- The port at which to listen for incoming connections from
clients.Method Detail |
public int getNumberOfClients(String role)
role
- Description of Parameterpublic int getNumberOfClients()
public int getAvailableId(String role)
role
- Description of Parameterpublic Dimension getMapSize()
public byte[] getMap()
public Map getUnitTypeIcons()
public void addClient(ClientConnection c)
c
- The object that represents the connection to the client to
join.public boolean acceptRole(String role)
role
- Description of Parameterpublic String whoIsConnected()
public String rolesLeft()
public void connectionLost(String role, int id)
role
- Description of Parameterid
- Description of Parameterpublic void unitVisible(String role, int handle, String name, String type, double x, double y, Set unblockedActions, Set blockedActions, Map properties)
unitVisible
in interface Client
role
- Description of Parameterhandle
- Description of Parametername
- Description of Parametertype
- Description of Parameterx
- Description of Parametery
- Description of ParameterunblockedActions
- Description of ParameterblockedActions
- Description of Parameterproperties
- Description of Parameterpublic void unitInvisible(String role, int handle)
unitInvisible
in interface Client
role
- Description of Parameterhandle
- Description of Parameterpublic void unitDeleted(String role, int handle)
unitDeleted
in interface Client
role
- Description of Parameterhandle
- Description of Parameterpublic void unitMoved(String role, int handle, double newX, double newY)
unitMoved
in interface Client
role
- Description of Parameterhandle
- Description of ParameternewX
- Description of ParameternewY
- Description of Parameterpublic void unitPropertyChanged(String role, int handle, String key, String newValue)
unitPropertyChanged
in interface Client
role
- Description of Parameterhandle
- Description of Parameterkey
- Description of ParameternewValue
- Description of Parameterpublic void unitActionBlocked(String role, int handle, ActionDefinition action, boolean isBlocked)
unitActionBlocked
in interface Client
role
- Description of Parameterhandle
- Description of Parameteraction
- Description of ParameterisBlocked
- Description of Parameterpublic void automatonHasState(String role, int x, int y, Color color)
automatonHasState
in interface Client
role
- Description of Parameterx
- Description of Parametery
- Description of Parametercolor
- Description of Parameterpublic void automatonInvisible(String role, int x, int y)
automatonInvisible
in interface Client
role
- Description of Parameterx
- Description of Parametery
- Description of Parameterpublic void actionCompleted(String role, int actionHandle, String unitMessage)
actionCompleted
in interface Client
role
- Description of ParameteractionHandle
- Description of ParameterunitMessage
- Description of Parameterpublic void actionFailed(String role, int actionHandle, String errorMessage)
actionFailed
in interface Client
role
- Description of ParameteractionHandle
- Description of ParametererrorMessage
- Description of Parameterpublic void automatonsHasState(String role, List pointObjects, List colors)
automatonsHasState
in interface Client
role
- Description of ParameterpointObjects
- Description of Parametercolors
- Description of Parameterpublic void automatonsInvisible(String role, List pointObjects)
automatonsInvisible
in interface Client
role
- Description of ParameterpointObjects
- Description of Parameterpublic void unitMessage(String role, int unitHandle, String message)
unitMessage
in interface Client
role
- Description of ParameterunitHandle
- Description of Parametermessage
- Description of Parameter
|
||||||||||
PREV CLASS NEXT CLASS | FRAMES NO FRAMES | |||||||||
SUMMARY: INNER | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD |