[go: up one dir, main page]

Menu

[r11]: / keeping / USR.java  Maximize  Restore  History

Download this file

61 lines (60 with data), 1.6 kB

 1
 2
 3
 4
 5
 6
 7
 8
 9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
package keeping;
/***
Stores static information about users: just their name and password.
Does not include the manager.
*/
import database.*;
abstract public class USR
// Please change this class from abstract to final.
{
/***
Loads the list of users from file.
*/
USR()
{
// not implemented
// remember to delte empty user names.
}
/***
Get some waitron's names.
@return All user names which have not yet been deleted.
*/
abstract String[] list() ;
/***
Delte the specified user.
@param index Which user to delete. >= 0
*/
abstract void delete(int index) ; // Just set user name to "", then call db.delete().
/***
Adds a newly created user to the database.
@param userName This may contain spaces.
@param password String of digits.
@throws IllegalArgumentException if the password does not match the criteria specified in {@link change
}
Or if the userName parameter is empty.
*/
abstract void add(String userName, String password);
/***
Create a random password.
@return Some characters.
*/
static String generate()
{
return "123";
}
/***
Change password.
@param index the position of the user in the list() array.
@param newPassword Must comply with rules below:
@throws IllegalArgumentException If newPassword is not three characters long, or if it does not consist entirely of digits, or if it is in use by another user!
*/
abstract void change(int index, String newPassword);
/***
Have a quick look at a user's current password.
<p>
Naughty, naughty!
@param index User offset.
@return The user's password.
*/
abstract String peek(int index);
}