?? delete.java
字號:
package agenda.command;import agenda.Exception.*;import agenda.data.*;/** * Delete command * @author wc */public class DELETE implements Command{ String userName; String password; int meetingID; /** * * @param args * @throws agenda.Exception.InvalidCommandException */ public void parse(String[] args) throws InvalidCommandException { if(args.length != 4) throw new InvalidCommandException("delete"); userName = args[1]; password = args[2]; meetingID = Integer.parseInt(args[3]); } /** * * @throws agenda.Exception.InvalidIDorPasswordException * @throws agenda.Exception.NotYourMeetingException */ public void execute() throws InvalidIDorPasswordException, NotYourMeetingException { try{ agenda.data.Data.userList.checkUser(userName, password); for(Meeting m:agenda.data.Data.meetingList) if(m.meetingID == meetingID){ if(!m.creator.equals(userName)) throw new NotYourMeetingException(); else{ agenda.data.Data.meetingList.remove(m); System.out.println("Meeting delete successed.\n"); } break; } } catch(InvalidIDorPasswordException e){ throw e; } catch(Exception ee){ } }}
?? 快捷鍵說明
復(fù)制代碼
Ctrl + C
搜索代碼
Ctrl + F
全屏模式
F11
切換主題
Ctrl + Shift + D
顯示快捷鍵
?
增大字號
Ctrl + =
減小字號
Ctrl + -