net.sf.freecol.common
Class ServerInfo

java.lang.Object
  extended by net.sf.freecol.common.ServerInfo
Direct Known Subclasses:
MetaItem

public class ServerInfo
extends java.lang.Object

Contains information about a single server. This information is normally retrived from a meta-server.

See Also:
net.sf.freecol.metaserver

Constructor Summary
ServerInfo(org.w3c.dom.Element element)
          Creates an object from the given Element.
ServerInfo(java.lang.String name, java.lang.String address, int port, int slotsAvailable, int currentlyPlaying, boolean isGameStarted, java.lang.String version, int gameState)
          Creates a new object with the given information.
 
Method Summary
 java.lang.String getAddress()
          Returns the IP-address.
 int getCurrentlyPlaying()
          Returns the number of currently active (connected and not dead) players.
 int getGameState()
          Gets the current state of the game.
 java.lang.String getName()
          Returns the name of the server that is beeing represented by this object.
 int getPort()
          Returns the port in which clients may connect.
 int getSlotsAvailable()
          Returns the number of players that may connect.
 java.lang.String getVersion()
          Returns the FreeCol version of the server.
static java.lang.String getXMLElementTagName()
          Gets the tag name of the root element representing this object.
 void readFromXMLElement(org.w3c.dom.Element element)
          Reads attributes from the given element.
 java.lang.String toString()
          Returns a String representation of this object for debugging purposes.
 org.w3c.dom.Element toXMLElement(org.w3c.dom.Document document)
          Creates an XML-representation of this object.
 void update(java.lang.String name, java.lang.String address, int port, int slotsAvailable, int currentlyPlaying, boolean isGameStarted, java.lang.String version, int gameState)
          Updates the object with the given information.
 
Methods inherited from class java.lang.Object
equals, getClass, hashCode, notify, notifyAll, wait, wait, wait
 

Constructor Detail

ServerInfo

public ServerInfo(java.lang.String name,
                  java.lang.String address,
                  int port,
                  int slotsAvailable,
                  int currentlyPlaying,
                  boolean isGameStarted,
                  java.lang.String version,
                  int gameState)
Creates a new object with the given information.

Parameters:
name - The name of the server.
address - The IP-address of the server.
port - The port number in which clients may connect.
slotsAvailable - Number of players that may conncet.
currentlyPlaying - Number of players that are currently connected.
isGameStarted - true if the game has started.
version - The version of the server.
gameState - The current state of the game.

ServerInfo

public ServerInfo(org.w3c.dom.Element element)
Creates an object from the given Element.

Parameters:
element - The XML DOM Element containing the information that will be used for the new object.
Method Detail

update

public void update(java.lang.String name,
                   java.lang.String address,
                   int port,
                   int slotsAvailable,
                   int currentlyPlaying,
                   boolean isGameStarted,
                   java.lang.String version,
                   int gameState)
Updates the object with the given information.

Parameters:
name - The name of the server.
address - The IP-address of the server.
port - The port number in which clients may connect.
slotsAvailable - Number of players that may conncet.
currentlyPlaying - Number of players that are currently connected.
isGameStarted - true if the game has started.
version - The version of the server.
gameState - The current state of the game.

getName

public java.lang.String getName()
Returns the name of the server that is beeing represented by this object.

Returns:
The name.

getAddress

public java.lang.String getAddress()
Returns the IP-address.

Returns:
The IP-address of the server.

getPort

public int getPort()
Returns the port in which clients may connect.

Returns:
The port.

getCurrentlyPlaying

public int getCurrentlyPlaying()
Returns the number of currently active (connected and not dead) players.

Returns:
The number of players.

getSlotsAvailable

public int getSlotsAvailable()
Returns the number of players that may connect.

Returns:
The number of slots available on the server.

getVersion

public java.lang.String getVersion()
Returns the FreeCol version of the server.

Returns:
The version.
See Also:
FreeCol.getVersion()

getGameState

public int getGameState()
Gets the current state of the game.

Returns:
The current state of the game.
See Also:
FreeColServer.getGameState()

toXMLElement

public org.w3c.dom.Element toXMLElement(org.w3c.dom.Document document)
Creates an XML-representation of this object.

Parameters:
document - The document in which the element should be created.
Returns:
The XML DOM Element representing this object.

readFromXMLElement

public void readFromXMLElement(org.w3c.dom.Element element)
Reads attributes from the given element.

Parameters:
element - The XML DOM Element containing information that should be read by this object.

getXMLElementTagName

public static java.lang.String getXMLElementTagName()
Gets the tag name of the root element representing this object.

Returns:
"metaItem".

toString

public java.lang.String toString()
Returns a String representation of this object for debugging purposes.

Overrides:
toString in class java.lang.Object