org.jogre.common
Class UserList

java.lang.Object
  |
  +--org.jogre.common.UserList
All Implemented Interfaces:
ITransmittable

public class UserList
extends Object
implements ITransmittable

Transmittable user list data object. Contains the a HashMap of users.

Version:
Alpha 0.1
Author:
Bob Marks

Field Summary
static String USER_LIST
           
protected  HashMap userlist
          List of users.
 
Constructor Summary
UserList()
          Default constructor of a UserList object.
UserList(String inString)
          Constructor which reads a user list from a String.
 
Method Summary
 void addUser(String username, int rating)
          Creates a new User using a username and a rating and adds to the HashMap.
 boolean containsUser(String username)
          Return true if the user list contains this user.
 String flatten()
          Flatten the current list of logged on users.
 Vector getUsers()
          Returns a list of all the users.
 void removeUser(String username)
          Remove user from the list.
 int size()
          Return the number of users.
 
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
 

Field Detail

USER_LIST

public static final String USER_LIST

userlist

protected HashMap userlist
List of users.
Constructor Detail

UserList

public UserList()
Default constructor of a UserList object.

UserList

public UserList(String inString)
         throws TransmissionException
Constructor which reads a user list from a String.
Parameters:
inString -  
Throws:
TransmissionException - Thrown if there is a problem in transmission.
Method Detail

addUser

public void addUser(String username,
                    int rating)
Creates a new User using a username and a rating and adds to the HashMap.
Parameters:
username - Username of User.
rating - Rating of this user.

removeUser

public void removeUser(String username)
Remove user from the list.
Parameters:
username -  

containsUser

public boolean containsUser(String username)
Return true if the user list contains this user.
Parameters:
username - Username to check for in the list.
Returns:
True if list contains the username as a key.

getUsers

public Vector getUsers()
Returns a list of all the users.
Returns:
List of users as Strings in a Vector.

flatten

public String flatten()
Flatten the current list of logged on users.
Specified by:
flatten in interface ITransmittable
See Also:
ITransmittable.flatten()

size

public int size()
Return the number of users.
Returns:
Number of users (between 0 and GameProperties.getMaxNumOfUsers()).