feud.clientserver
Class ServerEntry

java.lang.Object
  extended byfeud.clientserver.ServerEntry
All Implemented Interfaces:
java.lang.Comparable

public class ServerEntry
extends java.lang.Object
implements java.lang.Comparable

A ServerEntry is a simple wrapper class for server related information. It's mainly used by the ServerBrowser.


Field Summary
 int TIMEOUT
          Default timeout for this entry.
 
Constructor Summary
ServerEntry(java.lang.String name, java.net.InetAddress addr, int port, int clients)
          Creates a new ServerEntry
 
Method Summary
 int compareTo(java.lang.Object obj)
           
 boolean equals(java.lang.Object obj)
           
 java.net.InetAddress getAddress()
          Returns the server's address.
 int getClientCount()
          Returns the number of clients that the server has.
 java.lang.String getName()
          Returns the name of the server.
 int getPort()
          Returns the port on which the server is running.
 int hashCode()
           
 boolean isConnected()
          Do we have an connection to the server of this entry?
 boolean isOld()
          Is the server entry "old"?
 void setClientCount(int cnt)
          Sets the number of clients.
 void setConnected(boolean con)
          Sets this entry to "connected".
 void touch()
          "Touches" this entry, i.e. isOld will return false after doing this.
 
Methods inherited from class java.lang.Object
clone, finalize, getClass, notify, notifyAll, toString, wait, wait, wait
 

Field Detail

TIMEOUT

public final int TIMEOUT
Default timeout for this entry. If the entry hasn't been touched for this long, it will be regarded as old.

See Also:
Constant Field Values
Constructor Detail

ServerEntry

public ServerEntry(java.lang.String name,
                   java.net.InetAddress addr,
                   int port,
                   int clients)
Creates a new ServerEntry

Parameters:
name - the name of the server. This is not the address but any name like "Peter's server" or something.
addr - the address of the server
port - the port of the server
clients - the number of clients currently connected to that server
Method Detail

getName

public java.lang.String getName()
Returns the name of the server.

Returns:
String the name

getAddress

public java.net.InetAddress getAddress()
Returns the server's address.

Returns:
InetAddress the address

setConnected

public void setConnected(boolean con)
Sets this entry to "connected".

Parameters:
con - boolean do we have an connection to this server or not?

isConnected

public boolean isConnected()
Do we have an connection to the server of this entry?

Returns:
boolean do we?

getPort

public int getPort()
Returns the port on which the server is running.

Returns:
int the port

getClientCount

public int getClientCount()
Returns the number of clients that the server has.

Returns:
int the number of clients

setClientCount

public void setClientCount(int cnt)
Sets the number of clients.

Parameters:
cnt - the client count

touch

public void touch()
"Touches" this entry, i.e. isOld will return false after doing this.


isOld

public boolean isOld()
Is the server entry "old"?

Returns:
boolean is it?

equals

public boolean equals(java.lang.Object obj)

hashCode

public int hashCode()

compareTo

public int compareTo(java.lang.Object obj)
Specified by:
compareTo in interface java.lang.Comparable