Docjar: A Java Source and Docuemnt Enginecom.*    java.*    javax.*    org.*    all    new    plug-in

Quick Search    Search Deep

com.ciphermod.cipherchat
Class ChatGroup  view ChatGroup download ChatGroup.java

java.lang.Object
  extended byjava.lang.Thread
      extended bycom.ciphermod.cipherchat.ChatGroup
All Implemented Interfaces:
com.ciphercore.InterProcessObject, java.lang.Runnable

public class ChatGroup
extends java.lang.Thread
implements com.ciphercore.InterProcessObject


Nested Class Summary
 
Nested classes inherited from class java.lang.Thread
java.lang.Thread.UncaughtExceptionHandler
 
Field Summary
private  java.util.Vector _messageIds
           
private  java.lang.Object _messageModLock
           
private  java.util.Hashtable _messages
           
private  boolean _stopRequested
           
private  java.util.Vector _users
           
static int EXPIRE_INCREMENT
          Number of messages below SIZE_TARGET to trim to.
static int SIZE_TARGET
          Approximate number of messages to buffer.
 
Fields inherited from class java.lang.Thread
MAX_PRIORITY, MIN_PRIORITY, NORM_PRIORITY
 
Constructor Summary
ChatGroup()
           
 
Method Summary
 void addMessage(java.lang.String message)
           
protected  void addUser(java.lang.String userName)
           
protected  void clearMessages(int fromIndex, int toIndex)
          Clears messages from fromIndex (inclusive) to toIndex (exclusive).
protected  void expireMessages()
          This expires messages on a numerical basis, by simply trimming the front of the buffer to make the vector size equal to MESSAGE_BUFFER_SIZE_TARGET.
protected  int getExpireIncrement()
           
protected  java.util.Vector getMessageIds()
           
protected  java.lang.Object getMessageModLock()
           
 java.util.Vector getMessages(java.lang.String sinceMessageId)
          Returns a Vector of strings.
protected  java.util.Hashtable getMessagesHash()
           
protected  int getSizeTarget()
           
protected  java.util.Vector getUsers()
           
protected  java.lang.String incrementId()
           
 void pleaseStop()
           
protected  void removeUser(java.lang.String userName)
           
 void run()
          The method of Thread that will be run if there is no Runnable object associated with the Thread.
protected  void setMessageIds(java.util.Vector messageIds)
           
 
Methods inherited from class java.lang.Thread
activeCount, checkAccess, countStackFrames, currentThread, destroy, dumpStack, enumerate, getContextClassLoader, getDefaultUncaughtExceptionHandler, getId, getName, getPriority, getThreadGroup, getUncaughtExceptionHandler, holdsLock, interrupt, interrupted, isAlive, isDaemon, isInterrupted, join, join, join, resume, setContextClassLoader, setDaemon, setDefaultUncaughtExceptionHandler, setName, setPriority, setUncaughtExceptionHandler, sleep, sleep, start, stop, stop, suspend, toString, yield
 
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, wait, wait, wait
 

Field Detail

SIZE_TARGET

public static final int SIZE_TARGET
Approximate number of messages to buffer.

See Also:
Constant Field Values

EXPIRE_INCREMENT

public static final int EXPIRE_INCREMENT
Number of messages below SIZE_TARGET to trim to.

See Also:
Constant Field Values

_stopRequested

private boolean _stopRequested

_messageIds

private java.util.Vector _messageIds

_messages

private java.util.Hashtable _messages

_messageModLock

private java.lang.Object _messageModLock

_users

private java.util.Vector _users
Constructor Detail

ChatGroup

public ChatGroup()
Method Detail

run

public void run()
Description copied from class: java.lang.Thread
The method of Thread that will be run if there is no Runnable object associated with the Thread. Thread's implementation does nothing at all.

Specified by:
run in interface java.lang.Runnable

pleaseStop

public void pleaseStop()

getMessages

public java.util.Vector getMessages(java.lang.String sinceMessageId)
Returns a Vector of strings. NOTE: The first element of the Vector is the messageId of the last message returned.


addMessage

public void addMessage(java.lang.String message)

incrementId

protected java.lang.String incrementId()

expireMessages

protected void expireMessages()
This expires messages on a numerical basis, by simply trimming the front of the buffer to make the vector size equal to MESSAGE_BUFFER_SIZE_TARGET.


clearMessages

protected void clearMessages(int fromIndex,
                             int toIndex)
Clears messages from fromIndex (inclusive) to toIndex (exclusive).


setMessageIds

protected void setMessageIds(java.util.Vector messageIds)

addUser

protected void addUser(java.lang.String userName)

removeUser

protected void removeUser(java.lang.String userName)

getMessageIds

protected java.util.Vector getMessageIds()

getMessagesHash

protected java.util.Hashtable getMessagesHash()

getMessageModLock

protected java.lang.Object getMessageModLock()

getSizeTarget

protected int getSizeTarget()

getExpireIncrement

protected int getExpireIncrement()

getUsers

protected java.util.Vector getUsers()