cider.common.processes
Class TypingEvent

java.lang.Object
  extended by cider.common.processes.TypingEvent
All Implemented Interfaces:
java.io.Serializable

public class TypingEvent
extends java.lang.Object
implements java.io.Serializable

TypingEvents are what make up the history of SourceDocuments. TypingEvents can represent insertions, overwrites backspaces and locking or unlocking. Each typing event happens at a certain time, and has an owner. They may also belong to certain locking groups, which means that only users are a member of that group are allowed to interfere with what happens at this position.

Author:
Lawrence
See Also:
Serialized Form

Field Summary
 int length
           
 java.lang.String lockingGroup
           
 TypingEventMode mode
           
 java.lang.String owner
           
 int position
           
static int radix
           
 java.lang.String text
           
 long time
           
 
Constructor Summary
TypingEvent(long time, TypingEventMode mode, int position, int length, java.lang.String text, java.lang.String owner, java.lang.String lockingGroup)
           
TypingEvent(java.lang.String str)
          This typing event is specified by a string that was created by the pack method
TypingEvent(TypingEvent typingEvent, long time, int position, java.lang.String text)
          This typing event will be the same except for the time and text.
TypingEvent(TypingEvent typingEvent, long time, int position, TypingEventMode mode)
          This typing event will be the same except for the time, position and mode.
 
Method Summary
 boolean existsIn(TypingEvent[] tes)
           
 java.util.ArrayList<TypingEvent> explode()
          if this typing event represents text of more than one character, the explode method can be used to split it up into a list of typing events, one for each character.
 java.lang.String pack()
          creates a string which represents this typing event and can be unpacked by the contructor which takes a string as its artgument.
 void setLockingGroup(java.lang.String lockingGroup)
           
 java.lang.String toString()
           
 
Methods inherited from class java.lang.Object
equals, getClass, hashCode, notify, notifyAll, wait, wait, wait
 

Field Detail

radix

public static final int radix
See Also:
Constant Field Values

lockingGroup

public java.lang.String lockingGroup

mode

public final TypingEventMode mode

time

public final long time

position

public final int position

length

public final int length

text

public final java.lang.String text

owner

public final java.lang.String owner
Constructor Detail

TypingEvent

public TypingEvent(long time,
                   TypingEventMode mode,
                   int position,
                   int length,
                   java.lang.String text,
                   java.lang.String owner,
                   java.lang.String lockingGroup)
Parameters:
time -
mode -
position -
length -
text -
owner -
lockingGroup -

TypingEvent

public TypingEvent(java.lang.String str)
This typing event is specified by a string that was created by the pack method

Parameters:
str -

TypingEvent

public TypingEvent(TypingEvent typingEvent,
                   long time,
                   int position,
                   java.lang.String text)
This typing event will be the same except for the time and text.

Parameters:
typingEvent -
time -
text -

TypingEvent

public TypingEvent(TypingEvent typingEvent,
                   long time,
                   int position,
                   TypingEventMode mode)
This typing event will be the same except for the time, position and mode.

Parameters:
typingEvent -
time -
position -
mode -
Method Detail

existsIn

public boolean existsIn(TypingEvent[] tes)
Parameters:
tes -
Returns:
true if this typing event exists in the array tes TODO: look into finding a more efficient alternative.

explode

public java.util.ArrayList<TypingEvent> explode()
if this typing event represents text of more than one character, the explode method can be used to split it up into a list of typing events, one for each character. Each typing event will have a different time, the first event has the same time as this event. The time increments by one long integer for every event in the list.

Returns:
the array list of typing events

pack

public java.lang.String pack()
creates a string which represents this typing event and can be unpacked by the contructor which takes a string as its artgument.

Returns:

setLockingGroup

public void setLockingGroup(java.lang.String lockingGroup)
Parameters:
lockingGroup -

toString

public java.lang.String toString()
Overrides:
toString in class java.lang.Object