|
||||||||||
| PREV CLASS NEXT CLASS | FRAMES NO FRAMES | |||||||||
| SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD | |||||||||
java.lang.Object | +--User
A User has a unique id and a hidden
password. The object is invalid if the given id
is already in use or if creating this user would
result in more than MAX_USERS in
the system.
| Field Summary | |
static int |
MAX_USERS
Constant representing the maximum number of valid users. |
| Constructor Summary | |
User(String id,
String password)
Attempts to create a new user with the given id and password. |
|
| Method Summary | |
static int |
getNumUsers()
Returns the total number of valid users in the system. |
boolean |
isValid()
Returns true if and only if this
is a valid user, and false otherwise. |
String |
toString()
Returns the id associated with this user. |
boolean |
verifyPassword(String p)
Returns true if and only if this
is a valid user and the given string p
matches the password with which this user was
created, and false otherwise. |
| Methods inherited from class java.lang.Object |
clone, equals, finalize, getClass, hashCode, notify, notifyAll, wait, wait, wait |
| Field Detail |
public static final int MAX_USERS
| Constructor Detail |
public User(String id,
String password)
id and password. This attempt
fails if the id is already in use or if
creating this user would result in more than
MAX_USERS in the system.
| Method Detail |
public boolean verifyPassword(String p)
true if and only if this
is a valid user and the given string p
matches the password with which this user was
created, and false otherwise.
public boolean isValid()
true if and only if this
is a valid user, and false otherwise.
public String toString()
toString in class Objectpublic static int getNumUsers()
|
||||||||||
| PREV CLASS NEXT CLASS | FRAMES NO FRAMES | |||||||||
| SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD | |||||||||