📄 chatter.java
字号:
// Chatter.java
// Andrew Davison, June 2003 (dandrew@ratree.psu.ac.th)
/* Store information about a single client:
the user's name, their UID, and the current number
of messages read from the chat messages list
The UID is a random integer between 0 and ID_MAX.
*/
public class Chatter
{
private static final int ID_MAX = 1024;
private String userName;
private int uid;
private int msgsIndex;
public Chatter(String nm)
{ userName = nm;
uid = (int) Math.round( Math.random()* ID_MAX);
msgsIndex = 0;
}
public String getUserName()
{ return userName; }
public int getUID()
{ return uid; }
public int getMsgsIndex()
{ return msgsIndex; }
public void setMsgsIndex(int newIndex)
{ msgsIndex = newIndex; }
public boolean matches(String nm, int id)
{ return (userName.equals(nm) && (uid == id)); }
} // end of Chatter class
⌨️ 快捷键说明
复制代码
Ctrl + C
搜索代码
Ctrl + F
全屏模式
F11
切换主题
Ctrl + Shift + D
显示快捷键
?
增大字号
Ctrl + =
减小字号
Ctrl + -