cz.cuni.pogamut.server
Class UTServerInfoSnapshot

java.lang.Object
  extended by cz.cuni.pogamut.server.UTServerInfoSnapshot
All Implemented Interfaces:
java.io.Serializable, java.lang.Cloneable

public class UTServerInfoSnapshot
extends java.lang.Object
implements java.io.Serializable, java.lang.Cloneable

WARNING ... clone() produce shallow copy!

See Also:
Serialized Form

Field Summary
protected  boolean automaticallyReconnect
          Whether to automatically reconnect to the server if down.
protected  int autoReconnectMillis
          How often we should try the reconnect.
protected  java.util.List<Agent> bots
          List of bots all bots, that were or are connected to server.
protected  java.net.URI gamebotsBotsURI
          Server URI where we want to connect to.
protected  java.net.URI gamebotsControlConnectionURI
          Server URI where we want to connect to.
protected  GameInfo gameInfo
          Here are stored all the info about the server we need to know and manage.
protected  java.util.Map<java.lang.String,Item> inventory
          List of inventory that is available in the map and can be added to the bot's inventory.
protected  java.util.List<Item> items
          Current list of items in the map.
protected  java.util.List<UTMap> maps
          Current list of maps available on server.
protected  java.lang.String name
          Name of the server.
protected  java.util.List<NavPoint> navPoints
          Current list of navpoints in the map.
protected  boolean pingPong
          Whether to test actively the connection for being alive.
protected  java.util.Set<Player> players
          Current list of all players walking in the world of UT.
protected  int pongTimeoutMillis
          How long we should wait for PONG message before assuming the communication as dead.
protected  boolean serverOpened
          Does this server allow connection of new bots?
protected  java.net.URI serverRemoteParserURI
          URI of remote parser associated with this UT server.
protected  Flag<UTServerState> serverStateFlag
          This is class where we maintiain the state of the server, e.g.
 
Constructor Summary
UTServerInfoSnapshot()
          Calls pseudoconstructor.
 
Method Summary
 java.lang.Object clone()
           
 int getAutoReconnectMillis()
           
 java.util.List<Agent> getBots()
           
 java.net.URI getGamebotsBotsURI()
           
 java.net.URI getGamebotsControlConnectionURI()
           
 GameInfo getGameInfo()
           
 java.util.Map<java.lang.String,Item> getInventory()
           
 java.util.List<Item> getItems()
           
 java.util.List<UTMap> getMaps()
           
 java.lang.String getName()
           
 java.util.List<NavPoint> getNavPoints()
           
 java.util.Set<Player> getPlayers()
           
 int getPongTimeoutMillis()
           
 java.net.URI getServerRemoteParserURI()
           
 UTServerState getServerState()
           
 Flag<UTServerState> getServerStateFlag()
           
protected  void init()
          Pseudoconstructor called after deserialization.
 boolean isAutomaticallyReconnect()
           
 boolean isPingPong()
           
 boolean isServerOpened()
           
private  void readObject(java.io.ObjectInputStream in)
          Deserialization...
private  void writeObject(java.io.ObjectOutputStream out)
          Serialization...
 
Methods inherited from class java.lang.Object
equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
 

Field Detail

serverStateFlag

protected transient Flag<UTServerState> serverStateFlag
This is class where we maintiain the state of the server, e.g. running / initializing, etc... you may hook up a listener to the flag.


pingPong

protected boolean pingPong
Whether to test actively the connection for being alive.


pongTimeoutMillis

protected int pongTimeoutMillis
How long we should wait for PONG message before assuming the communication as dead.


automaticallyReconnect

protected boolean automaticallyReconnect
Whether to automatically reconnect to the server if down.


autoReconnectMillis

protected int autoReconnectMillis
How often we should try the reconnect.


gamebotsControlConnectionURI

protected java.net.URI gamebotsControlConnectionURI
Server URI where we want to connect to.


gamebotsBotsURI

protected java.net.URI gamebotsBotsURI
Server URI where we want to connect to.


serverRemoteParserURI

protected java.net.URI serverRemoteParserURI
URI of remote parser associated with this UT server.


serverOpened

protected boolean serverOpened
Does this server allow connection of new bots? It isn't necesarry to check this flag. It is just polite to do so. It's not checked anywhere in this class, but you should use it before calling connectBot(). It's because of Experiments. When experiment is started on the server, this flag is set to false and only experiment should connect the bots into it.


name

protected java.lang.String name
Name of the server.


bots

protected transient java.util.List<Agent> bots
List of bots all bots, that were or are connected to server.


gameInfo

protected transient GameInfo gameInfo
Here are stored all the info about the server we need to know and manage. PARAMETERS OF THE SERVER - VALID IFF ... getServerState() == UTServerState.RUNNING || PAUSED


navPoints

protected transient java.util.List<NavPoint> navPoints
Current list of navpoints in the map. Initialized in the first call of getNavPoints() that might take some time (because we wait for info to arrive), next calls are non-blocking (if you don't reconnect).


items

protected transient java.util.List<Item> items
Current list of items in the map. Initialized in the first call of getItems() that might take some time (because we wait for info to arrive), next calls are non-blocking (if you don't reconnect).


maps

protected transient java.util.List<UTMap> maps
Current list of maps available on server. Initialized when UTServerConnection connects to GB.


players

protected transient java.util.Set<Player> players
Current list of all players walking in the world of UT. Initialized when UTServerConnection connects to GB and maintained by messages PLAYER_JOIN, PLAYER_LEFT.


inventory

protected transient java.util.Map<java.lang.String,Item> inventory
List of inventory that is available in the map and can be added to the bot's inventory.

Constructor Detail

UTServerInfoSnapshot

public UTServerInfoSnapshot()
Calls pseudoconstructor.

Method Detail

readObject

private void readObject(java.io.ObjectInputStream in)
                 throws java.io.IOException,
                        java.lang.ClassNotFoundException
Deserialization...

Parameters:
in -
Throws:
java.io.IOException
java.lang.ClassNotFoundException

writeObject

private void writeObject(java.io.ObjectOutputStream out)
                  throws java.io.IOException
Serialization...

Parameters:
out -
Throws:
java.io.IOException

init

protected void init()
Pseudoconstructor called after deserialization.


isAutomaticallyReconnect

public boolean isAutomaticallyReconnect()

getAutoReconnectMillis

public int getAutoReconnectMillis()

getBots

public java.util.List<Agent> getBots()

getGameInfo

public GameInfo getGameInfo()

getItems

public java.util.List<Item> getItems()

getMaps

public java.util.List<UTMap> getMaps()

getName

public java.lang.String getName()

getNavPoints

public java.util.List<NavPoint> getNavPoints()

isPingPong

public boolean isPingPong()

getPlayers

public java.util.Set<Player> getPlayers()

getPongTimeoutMillis

public int getPongTimeoutMillis()

isServerOpened

public boolean isServerOpened()

getServerRemoteParserURI

public java.net.URI getServerRemoteParserURI()

getGamebotsControlConnectionURI

public java.net.URI getGamebotsControlConnectionURI()

getGamebotsBotsURI

public java.net.URI getGamebotsBotsURI()

clone

public java.lang.Object clone()
Overrides:
clone in class java.lang.Object

getServerStateFlag

public Flag<UTServerState> getServerStateFlag()

getServerState

public UTServerState getServerState()

getInventory

public java.util.Map<java.lang.String,Item> getInventory()