agentland.games.boggle
Class BoggleServerAgent
java.lang.Object
|
+--java.rmi.server.RemoteObject
|
+--java.rmi.server.RemoteServer
|
+--java.rmi.server.UnicastRemoteObject
|
+--metaglue.AgentAgent
|
+--agentland.util.GoodAgent
|
+--agentland.resource.ManagedAgent
|
+--agentland.games.boggle.BoggleAgent
|
+--agentland.games.boggle.BoggleServerAgent
- All Implemented Interfaces:
- Agent, Boggle, BoggleServer, Good, Managed, MetagluePrimitives, Remote, Serializable, Spy
- public class BoggleServerAgent
- extends BoggleAgent
- implements BoggleServer
A BoggleServerAgent
is the working part of the of the
GuiBoggleServerAgent
. It allows the GameMaster to view the state
of a game, including who is currently connected to that server.
- See Also:
BoggleAgent
,
BoggleServer
, Serialized Form
Constructor Summary |
BoggleServerAgent()
Creates a new BoggleServerAgent and allows
BoggleClient s to connect to it. |
Method Summary |
boolean |
addClient(AgentID client)
Adds the BoggleClient specified to the list of clients
connected to the game that this server is currently hosting. |
Collection |
clients()
Provides a Collection view of the clients currently connected
to this server. |
Board |
getBoard()
Provides the GUI access to the current state of the board. |
boolean |
removeClient(AgentID client)
Removes the BoggleClient specified from the list of clients
connected to the game that this server is currently hosting. |
int |
timeLeft()
Returns the time remaining in the current round of the game as
perceived by the server. |
void |
updateGui()
Sends notification to the GUI that some state of the game has changed
that effects the screen appearance. |
Methods inherited from class agentland.resource.ManagedAgent |
connect, getAlert, getNeed, isAvailable, isAvailable, reliesOn, reliesOn, replace, replace, request, request, request, requestAgent, requestAgent, resources, resourcesByAgentID, setNeed, tiedTo, yank, yank, yank |
Methods inherited from class agentland.util.GoodAgent |
addSpy, addSpy, alert, alertString, beep, error, getHistory, getHistoryElement, getPersistentMap, log, notify, removeSpy, removeSpy, resetHistory, safeRely, safeRely, safeRely, setNiceLogName, tell |
Methods inherited from class metaglue.AgentAgent |
addMonitor, alive, defrost, defrostAll, defrostBoolean, defrostInt, defrostString, fixAttribute, fixAttribute, freeze, freeze, freeze, freezeAll, freezeVar, getAgentID, getAttribute, getCatalog, getCatalogID, getDesignation, getFrozenVariables, getLogLevel, getMetaglueAgent, getMetaglueAgentID, getOccupation, getProperties, getSociety, log, log, lookupClass, obtainMetaglueAgent, obtainMetaglueAgent, obtainMetaglueAgentByName, reliesOn, reliesOnSynch, removeFrozen, replaceExceptionHandler, setFreezeName, setLogLevel, setLogName, shutdown, startAgent, startAgentOn, startAgentOn, startup, status, tiedTo, tiedTo, tiedTo, tiedTo, tieToDesignation, whereAreYou |
Methods inherited from interface agentland.util.Spy |
tell |
BoggleServerAgent
public BoggleServerAgent()
throws RemoteException
- Creates a new
BoggleServerAgent
and allows
BoggleClient
s to connect to it.
- Throws:
RemoteException
- if an error occurs
getBoard
public Board getBoard()
- Provides the GUI access to the current state of the board. This
method in conjunction with other observers can provide all
information as to the state of the whole game.
- Specified by:
getBoard
in interface Boggle
- Returns:
- a copy of
Board
that the server is hosting
for this game.
timeLeft
public int timeLeft()
- Returns the time remaining in the current round of the game as
perceived by the server. This is the correct time remaining
measured in milliseconds.
- Specified by:
timeLeft
in interface Boggle
- Returns:
- number of milliseconds remaining in this round
updateGui
public void updateGui()
- Sends notification to the GUI that some state of the game has changed
that effects the screen appearance. Actual updating is handled in the
appropriate
GuiMaker
.
clients
public Collection clients()
throws RemoteException
- Provides a
Collection
view of the clients currently connected
to this server. The entries in the return value are AgentID
s.
- Specified by:
clients
in interface BoggleServer
- Returns:
- a
Collection
of AgentID
s. - Throws:
RemoteException
- if an error occurs
addClient
public boolean addClient(AgentID client)
throws RemoteException
- Adds the
BoggleClient
specified to the list of clients
connected to the game that this server is currently hosting.
- Specified by:
addClient
in interface BoggleServer
- Parameters:
client
- AgentID
of client to add.- Returns:
true
if successful.- Throws:
RemoteException
- if an error occurs
removeClient
public boolean removeClient(AgentID client)
throws RemoteException
- Removes the
BoggleClient
specified from the list of clients
connected to the game that this server is currently hosting.
- Specified by:
removeClient
in interface BoggleServer
- Parameters:
client
- AgentID
of client to remove.- Returns:
true
if successful- Throws:
RemoteException
- if an error occurs