chatter.java

来自「java3D game engine design of the source 」· Java 代码 · 共 43 行

JAVA
43
字号

// 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 + =
减小字号Ctrl + -
显示快捷键?