blather.model
Class UserDB

java.lang.Object
  extended by blather.model.UserDB
All Implemented Interfaces:
java.io.Serializable

public class UserDB
extends java.lang.Object
implements java.io.Serializable

The UserDB maintains a database of users. That is, it provides a mapping from user names to BlatherUserInterface references.

See Also:
Serialized Form

Field Summary
static long serialVersionUID
           
 
Constructor Summary
UserDB()
           
 
Method Summary
 void addUser(BlatherUserInterface b)
          Adds the given user to the user database.
 BlatherUserInterface getUser(java.lang.String username)
          Returns the user with the given username.
 java.lang.String[] listUserNames()
          Returns an array of all user names in the system.
 boolean userExists(java.lang.String username)
          Returns true if the user with the given name exists.
 
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
 

Field Detail

serialVersionUID

public static final long serialVersionUID
See Also:
Constant Field Values
Constructor Detail

UserDB

public UserDB()
Method Detail

addUser

public void addUser(BlatherUserInterface b)
Adds the given user to the user database.

Parameters:
b - a reference to an instance of a class implementing BlatherUserInterface

getUser

public BlatherUserInterface getUser(java.lang.String username)
Returns the user with the given username. Precondition: the user with the given name exists.

Parameters:
username - a username
Returns:
a reference to an instance of a class implementing BlatherUserInterface

userExists

public boolean userExists(java.lang.String username)
Returns true if the user with the given name exists.

Parameters:
username - a username
Returns:
true if the user with the name username exists, false otherwise.

listUserNames

public java.lang.String[] listUserNames()
Returns an array of all user names in the system.

Returns:
an array of all user names in the system.