?? userlist.java
字號:
package agenda.data;import agenda.Exception.*;import java.util.*;/** * User List class * @author wc */public class UserList extends ArrayList<User>{ /** * Check if the username is already exist * @param uN UserName * @throws agenda.Exception.UserExistException */ public void isUserExist(String uN) throws UserExistException { for(User u:this) if(u.userName.equals(uN)) throw new UserExistException(uN); } /** * Check the username and password * @param uN UserName * @param pw Password * @throws agenda.Exception.InvalidIDorPasswordException */ public void checkUser(String uN, String pw) throws InvalidIDorPasswordException { boolean flag = false; for(User u:this) if(u.userName.equals(uN)&&u.password.equals(pw)) flag = true; if(!flag) throw new InvalidIDorPasswordException(); } /** * Check the username * @param uN UserName * @throws agenda.Exception.InvalidIDorPasswordException */ public void checkUser(String uN) throws InvalidIDorPasswordException { boolean flag = false; for(User u : this) if(u.userName.equals(uN)) flag = true; if(!flag) throw new InvalidIDorPasswordException(); }}
?? 快捷鍵說明
復(fù)制代碼
Ctrl + C
搜索代碼
Ctrl + F
全屏模式
F11
切換主題
Ctrl + Shift + D
顯示快捷鍵
?
增大字號
Ctrl + =
減小字號
Ctrl + -