📄 friendinfomodel.java
字号:
/* * FriendInfoModel.java * * Created on 2005年12月20日, 下午7:37 * * To change this template, choose Tools | Options and locate the template under * the Source Creation and Management node. Right-click the template and choose * Open. You can then make changes to the template in the Source Editor. */package javaicqproj;/** * * @author hurysa */import java.util.*;public class FriendInfoModel extends Observable{ private String myname;//我的昵称 private int myudpport;//我的udp发送端口号 private int friendnum=0;//friend number //以下是好友基本信息变量,比如呢称,ip地址等 private Vector icqno=new Vector(); private Vector nickname=new Vector(); private Vector status=new Vector(); private Vector ip=new Vector(); private Vector info=new Vector(); private Vector pic=new Vector(); private Vector sex=new Vector(); private Vector email=new Vector(); private Vector place=new Vector(); private Vector sendport=new Vector(); /** Creates a new instance of FriendInfoModel */ public FriendInfoModel() { this.clearFriendInfo(); } public void setMyName(String myname){ this.myname=myname; this.setChanged(); this.notifyObservers(); } public void setMyUdpPort(int myudpport){ this.myudpport=myudpport; } public void addFriendInfo(String icqno,String nickname,String status,String ip, String info,String pic,String sex,String email,String place,int sendport){ this.icqno.add(icqno); this.nickname.add(nickname); this.status.add(status); this.ip.add(ip); this.info.add(info); this.pic.add(pic); this.sex.add(sex); this.email.add(email); this.place.add(place); this.sendport.add(sendport); this.friendnum++; } public void deleteFriendInfo(int index){ this.icqno.removeElementAt(index); this.nickname.removeElementAt(index); this.status.removeElementAt(index); this.ip.removeElementAt(index); this.info.removeElementAt(index); this.pic.removeElementAt(index); this.sex.removeElementAt(index); this.email.removeElementAt(index); this.place.removeElementAt(index); this.sendport.removeElementAt(index); this.friendnum--; this.setChanged(); this.notifyObservers(); } public void clearFriendInfo(){ this.myname=null; this.myudpport=0; this.friendnum=0; this.icqno.removeAllElements(); this.nickname.removeAllElements(); this.status.removeAllElements(); this.ip.removeAllElements(); this.info.removeAllElements(); this.pic.removeAllElements(); this.sex.removeAllElements(); this.email.removeAllElements(); this.place.removeAllElements(); this.sendport.removeAllElements(); } public String getMyName(){ return this.myname; } public int getMyUdpPort(){ return this.myudpport; } public int getFriendNum(){ return this.friendnum; } public Vector getFriendNames(){ return this.nickname; } public Vector getFriendIcqno(){ return this.icqno; } public Vector getFriendStatus(){ return this.status; } public Vector getFriendIp(){ return this.ip; } public Vector getFriendPic(){ return this.pic; } public Vector getFriendSendport(){ return this.sendport; }}
⌨️ 快捷键说明
复制代码
Ctrl + C
搜索代码
Ctrl + F
全屏模式
F11
切换主题
Ctrl + Shift + D
显示快捷键
?
增大字号
Ctrl + =
减小字号
Ctrl + -