?? userlist.java
字號(hào):
/*
* Created on 2004-9-21
*
* To change the template for this generated file go to
* Window>Preferences>Java>Code Generation>Code and Comments
*/
package oa.sys;
import oa.data.*;
import java.util.*;
/**
****************************************************
*類(lèi)名稱(chēng): UserList<br>
*類(lèi)功能: 用戶(hù)列表操作<br>
*創(chuàng)建: 白偉明 2004年9月23日<br>
****************************************************
* To change the template for this generated type comment go to
* Window>Preferences>Java>Code Generation>Code and Comments
*/
public class UserList {
private Vector container;
private static UserList instance=new UserList();
/***************************************************
*函數(shù)名稱(chēng):UserList()<br>
*函數(shù)功能:利用private調(diào)用構(gòu)造函數(shù),
* 防止被外界產(chǎn)生新的instance對(duì)象<br>
*返回值: 無(wú)<br>
*參數(shù)說(shuō)明:無(wú)<br>
*最后修改:白偉明
* 2004年8月13日
****************************************************/
private UserList(){
container=new Vector();
}
/***************************************************
*函數(shù)名稱(chēng):getInstance()<br>
*函數(shù)功能:外界使用新的instance對(duì)象<br>
*返回值: UserList<br>
*參數(shù)說(shuō)明:無(wú)<br>
*最后修改:白偉明
* 2004年8月13日
****************************************************/
public static UserList getInstance(){
return instance;
}
/***************************************************
*函數(shù)名稱(chēng):addUser()<br>
*函數(shù)功能:增加用戶(hù)列表<br>
*返回值: void<br>
*參數(shù)說(shuō)明:user<br>
*最后修改:白偉明
* 2004年8月13日
****************************************************/
public void addUser (Eminfo user){
if(user!=null){
container.addElement(user);
}
}
/***************************************************
*函數(shù)名稱(chēng):getList()<br>
*函數(shù)功能:獲取用戶(hù)列表<br>
*返回值: Vector<br>
*參數(shù)說(shuō)明:無(wú)<br>
*最后修改:白偉明
* 2004年8月13日
****************************************************/
public Vector getList(){
return container;
}
/***************************************************
*函數(shù)名稱(chēng):removeUser()<br>
*函數(shù)功能:移除用戶(hù)列表<br>
*返回值: int id 用戶(hù)列表中不存在輸入id<br>
*參數(shù)說(shuō)明:id<br>
*最后修改:白偉明
* 2004年8月13日
****************************************************/
public int removeUser(int id){
for(int i=0;i<container.size();i++){
Eminfo user=(Eminfo)container.elementAt(i);
if(user.getId()==id){
container.removeElementAt(i);
}
}
return id;
}
}
?? 快捷鍵說(shuō)明
復(fù)制代碼
Ctrl + C
搜索代碼
Ctrl + F
全屏模式
F11
切換主題
Ctrl + Shift + D
顯示快捷鍵
?
增大字號(hào)
Ctrl + =
減小字號(hào)
Ctrl + -