public class ServerInfo
extends java.lang.Object
net.sf.freecol.metaserver
Modifier and Type | Field and Description |
---|---|
private java.lang.String |
address |
private int |
currentlyPlaying |
private int |
gameState |
private boolean |
isGameStarted |
private java.lang.String |
name |
private int |
port |
private int |
slotsAvailable |
private java.lang.String |
version |
Modifier | Constructor and Description |
---|---|
protected |
ServerInfo()
Empty constructor that can be used by subclasses.
|
|
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.
|
Modifier and Type | Method and Description |
---|---|
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(org.w3c.dom.Element element)
Update the server info from an element.
|
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.
|
private java.lang.String name
private java.lang.String address
private int port
private int currentlyPlaying
private int slotsAvailable
private boolean isGameStarted
private java.lang.String version
private int gameState
protected 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)
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.public ServerInfo(org.w3c.dom.Element element)
Element
.element
- The XML DOM Element containing the information that will be
used for the new object.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)
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.public final void update(org.w3c.dom.Element element)
element
- The Element
to update from.public java.lang.String getName()
public java.lang.String getAddress()
public int getPort()
public int getCurrentlyPlaying()
public int getSlotsAvailable()
public java.lang.String getVersion()
FreeCol.getVersion()
public int getGameState()
FreeColServer.getGameState()
public org.w3c.dom.Element toXMLElement(org.w3c.dom.Document document)
document
- The document in which the element should be created.public void readFromXMLElement(org.w3c.dom.Element element)
element
- The XML DOM Element containing information that
should be read by this object.public static java.lang.String getXMLElementTagName()
public java.lang.String toString()
String
representation of this object for debugging purposes.toString
in class java.lang.Object