Internet Chess ToolKit
v0.2.0

ictk.boardgame.chess.net.ics.event
Class ICSEvent

java.lang.Object
  extended byictk.boardgame.chess.net.ics.event.ICSEvent
Direct Known Subclasses:
ICSBoardUpdateEvent, ICSChallengeEvent, ICSGameCreatedEvent, ICSGameNotificationEvent, ICSGameResultEvent, ICSHistoryEvent, ICSMessageEvent, ICSMoveListEvent, ICSPlayerConnectionEvent, ICSQTellEvent, ICSSeekAdEvent, ICSSeekClearEvent, ICSSeekRemoveEvent, ICSUnknownEvent

public abstract class ICSEvent
extends java.lang.Object

A message from the server indicating something happened. All events are timestamped (with the client's receiving time). If Log.debug is true then the original server message is also stored. If Log.debug isn't true you'll save some memory overhead and the native message can be rebuilt from the appropriate parser.

Fake messages are also supported (those issued by bots but intending to emulate the server).


Field Summary
static int AUTO_SALUTE_EVENT
           
static int AVAIL_INFO_EVENT
           
static int BOARD_SAY_EVENT
           
static int BOARD_UPDATE_EVENT
           
static int CHALLENGE_EVENT
           
static int CHANNEL_EVENT
           
static long DEBUG
           
static int GAME_CREATED_EVENT
           
static int GAME_NOTIFICATION_EVENT
           
static int GAME_RESULT_EVENT
           
static int HISTORY_EVENT
           
static int KIBITZ_EVENT
           
static int MATCH_REQUEST_EVENT
           
static int MOVE_LIST_EVENT
           
static int NUM_EVENTS
           
static int PLAYER_CONNECTION_EVENT
           
static int PLAYER_NOTIFICATION_EVENT
           
static int QTELL_EVENT
           
static int SAY_EVENT
           
static int SEEK_AD_EVENT
           
static int SEEK_AD_READABLE_EVENT
           
static int SEEK_CLEAR_EVENT
           
static int SEEK_REMOVE_EVENT
           
static int SEEK_REMOVE_READABLE_EVENT
           
static int SHOUT_EVENT
           
static int TAKEBACK_REQUEST_EVENT
           
static int TELL_EVENT
           
static int TOURNAMENT_CHANNEL_EVENT
           
static int UNKNOWN_EVENT
           
static int USER_DEFINED_EVENT
           
static int WHISPER_EVENT
           
 
Constructor Summary
ICSEvent(ICSProtocolHandler server, int eventType)
           
ICSEvent(int eventType)
           
 
Method Summary
 java.lang.String DEBUG_getOriginal()
          this method returns the original text that was parsed to get the the event.
 ICSEventParser getEventParser()
           
 int getEventType()
          returns the type of the object (for easy casting)
 java.lang.String getMessage()
          returns a non-parseable string associated with this message, or if an error in the parsing as occured setting the message type to UNKNOWN_EVENT then this will contain the entire original event string.
abstract  java.lang.String getReadable()
          returns a readable form of this event.
 ICSProtocolHandler getServer()
          returns the server that originated this message
 java.util.Date getTimestamp()
          this is the moment the event was received from the server.
 boolean isFake()
          is this a QTell in disquise?
 void setEventParser(ICSEventParser parser)
           
 void setEventType(int type)
          sets the type of event this is.
 void setFake(boolean t)
          is this a QTell in disquise?
 void setMessage(java.lang.String mesg)
          sets a non-parseable string associated with this message, or if an error in the parsing as occured setting the message type to UNKNOWN_EVENT then this will contain the entire original event string.
 void setOriginal(java.lang.String s)
          this method stores the original message that was parsed to create this event.
 void setServer(ICSProtocolHandler server)
          sets the server this event originally came from
 void setTimestamp(java.util.Date timestamp)
          sets the timestamp to the value specified.
 java.lang.String toString()
           
 
Methods inherited from class java.lang.Object
equals, getClass, hashCode, notify, notifyAll, wait, wait, wait
 

Field Detail

DEBUG

public static final long DEBUG

UNKNOWN_EVENT

public static final int UNKNOWN_EVENT
See Also:
Constant Field Values

BOARD_UPDATE_EVENT

public static final int BOARD_UPDATE_EVENT
See Also:
Constant Field Values

GAME_CREATED_EVENT

public static final int GAME_CREATED_EVENT
See Also:
Constant Field Values

GAME_RESULT_EVENT

public static final int GAME_RESULT_EVENT
See Also:
Constant Field Values

GAME_NOTIFICATION_EVENT

public static final int GAME_NOTIFICATION_EVENT
See Also:
Constant Field Values

TAKEBACK_REQUEST_EVENT

public static final int TAKEBACK_REQUEST_EVENT
See Also:
Constant Field Values

CHANNEL_EVENT

public static final int CHANNEL_EVENT
See Also:
Constant Field Values

SHOUT_EVENT

public static final int SHOUT_EVENT
See Also:
Constant Field Values

TOURNAMENT_CHANNEL_EVENT

public static final int TOURNAMENT_CHANNEL_EVENT
See Also:
Constant Field Values

TELL_EVENT

public static final int TELL_EVENT
See Also:
Constant Field Values

SAY_EVENT

public static final int SAY_EVENT
See Also:
Constant Field Values

CHALLENGE_EVENT

public static final int CHALLENGE_EVENT
See Also:
Constant Field Values

SEEK_AD_EVENT

public static final int SEEK_AD_EVENT
See Also:
Constant Field Values

SEEK_REMOVE_EVENT

public static final int SEEK_REMOVE_EVENT
See Also:
Constant Field Values

SEEK_AD_READABLE_EVENT

public static final int SEEK_AD_READABLE_EVENT
See Also:
Constant Field Values

SEEK_REMOVE_READABLE_EVENT

public static final int SEEK_REMOVE_READABLE_EVENT
See Also:
Constant Field Values

SEEK_CLEAR_EVENT

public static final int SEEK_CLEAR_EVENT
See Also:
Constant Field Values

KIBITZ_EVENT

public static final int KIBITZ_EVENT
See Also:
Constant Field Values

WHISPER_EVENT

public static final int WHISPER_EVENT
See Also:
Constant Field Values

BOARD_SAY_EVENT

public static final int BOARD_SAY_EVENT
See Also:
Constant Field Values

QTELL_EVENT

public static final int QTELL_EVENT
See Also:
Constant Field Values

AUTO_SALUTE_EVENT

public static final int AUTO_SALUTE_EVENT
See Also:
Constant Field Values

MOVE_LIST_EVENT

public static final int MOVE_LIST_EVENT
See Also:
Constant Field Values

MATCH_REQUEST_EVENT

public static final int MATCH_REQUEST_EVENT
See Also:
Constant Field Values

PLAYER_NOTIFICATION_EVENT

public static final int PLAYER_NOTIFICATION_EVENT
See Also:
Constant Field Values

AVAIL_INFO_EVENT

public static final int AVAIL_INFO_EVENT
See Also:
Constant Field Values

USER_DEFINED_EVENT

public static final int USER_DEFINED_EVENT
See Also:
Constant Field Values

PLAYER_CONNECTION_EVENT

public static final int PLAYER_CONNECTION_EVENT
See Also:
Constant Field Values

HISTORY_EVENT

public static final int HISTORY_EVENT
See Also:
Constant Field Values

NUM_EVENTS

public static final int NUM_EVENTS
See Also:
Constant Field Values
Constructor Detail

ICSEvent

public ICSEvent(ICSProtocolHandler server,
                int eventType)

ICSEvent

public ICSEvent(int eventType)
Method Detail

getServer

public ICSProtocolHandler getServer()
returns the server that originated this message


setServer

public void setServer(ICSProtocolHandler server)
sets the server this event originally came from


getEventType

public int getEventType()
returns the type of the object (for easy casting)


setEventType

public void setEventType(int type)
sets the type of event this is.


getTimestamp

public java.util.Date getTimestamp()
this is the moment the event was received from the server.


setTimestamp

public void setTimestamp(java.util.Date timestamp)
sets the timestamp to the value specified.


getMessage

public java.lang.String getMessage()
returns a non-parseable string associated with this message, or if an error in the parsing as occured setting the message type to UNKNOWN_EVENT then this will contain the entire original event string.


setMessage

public void setMessage(java.lang.String mesg)
sets a non-parseable string associated with this message, or if an error in the parsing as occured setting the message type to UNKNOWN_EVENT then this will contain the entire original event string.


getEventParser

public ICSEventParser getEventParser()

setEventParser

public void setEventParser(ICSEventParser parser)

setFake

public void setFake(boolean t)
is this a QTell in disquise?


isFake

public boolean isFake()
is this a QTell in disquise?


getReadable

public abstract java.lang.String getReadable()
returns a readable form of this event. Typically this is similar to the original text sent by the server, but it does not have to be.


setOriginal

public void setOriginal(java.lang.String s)
this method stores the original message that was parsed to create this event. This only happens if debug mode is on (Log.debug). If not, then no value is stored.


DEBUG_getOriginal

public java.lang.String DEBUG_getOriginal()
this method returns the original text that was parsed to get the the event. This method is not valid if debug mode is not active. If this method is called and Log.debug is not true, then an IllegalStateException will be thrown.


toString

public java.lang.String toString()

Submit a bug or feature
Visit the Website
Internet Chess ToolKit is licensed under the GPL v2 .