net.sf.magicproject.network
Class MBigPipe

java.lang.Object
  extended by java.lang.Thread
      extended by net.sf.magicproject.network.MBigPipe
All Implemented Interfaces:
java.lang.Runnable, IdMessages

public class MBigPipe
extends java.lang.Thread
implements IdMessages

Since:
0.3
Author:
Fabrice Daugan

Nested Class Summary
 
Nested classes/interfaces inherited from class java.lang.Thread
java.lang.Thread.State, java.lang.Thread.UncaughtExceptionHandler
 
Field Summary
static MBigPipe instance
          The unique instance
static java.lang.Object LOCK
          Token to split stream for play message and chat message
 MMiniPipe ready
          Semaphore to indicate a ready stream
 
Fields inherited from class java.lang.Thread
MAX_PRIORITY, MIN_PRIORITY, NORM_PRIORITY
 
Fields inherited from interface net.sf.magicproject.network.IdMessages
BEGIN_GAME_DATA, BEGIN_MESSAGE_DATA, CLICK_MANA, COLOR_ANSWER, END_GAME_DATA, END_MESSAGE_DATA, INTEGER_ANSWER, MAX_PLAYERS, MOVE_ORDER_ANSWER, MSG_ANSWER, MSG_CHOICE, MSG_CLICK_ABILITY, MSG_CLICK_ACTION, MSG_CLICK_CARD, MSG_CLICK_MANA, MSG_CLICK_PLAYER, MSG_CLICK_TRIGGERED_CARD, MSG_DISCONNECT, MSG_SKIP, PROPERTY_ANSWER, REPLACEMENT_ANSWER, STR_DISCONNECT, STR_DONE, STR_NEED_ACK, STR_NOPASSWD, STR_OK, STR_PASSWD, STR_WRONGPASSWD, STR_WRONGVERSION, TIME_OUT, TRIGGERED_CARD_CHOICE, ZONE_ANSWER
 
Method Summary
 void run()
          The main loop allowing to mix 2 data types : the first is the data corresponding to player's action, and the second is the message of chat speaking.
 void sendChatMessage(java.lang.String msg)
          send a STRING message to opponent.
 void sendGameMessage(int... msg)
          send a byte sized message to opponent.
 
Methods inherited from class java.lang.Thread
activeCount, checkAccess, countStackFrames, currentThread, destroy, dumpStack, enumerate, getAllStackTraces, getContextClassLoader, getDefaultUncaughtExceptionHandler, getId, getName, getPriority, getStackTrace, getState, 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
equals, getClass, hashCode, notify, notifyAll, wait, wait, wait
 

Field Detail

ready

public MMiniPipe ready
Semaphore to indicate a ready stream


LOCK

public static final java.lang.Object LOCK
Token to split stream for play message and chat message


instance

public static MBigPipe instance
The unique instance

Method Detail

sendGameMessage

public void sendGameMessage(int... msg)
send a byte sized message to opponent. This message si not displayed in the chat window, but is destined to play triggers.

Parameters:
msg - is the message to send

sendChatMessage

public void sendChatMessage(java.lang.String msg)
send a STRING message to opponent. This message will be displayed in the chat window.

Parameters:
msg - is the message to send

run

public void run()
The main loop allowing to mix 2 data types : the first is the data corresponding to player's action, and the second is the message of chat speaking.

Specified by:
run in interface java.lang.Runnable
Overrides:
run in class java.lang.Thread
See Also:
IdMessages.BEGIN_GAME_DATA, IdMessages.BEGIN_MESSAGE_DATA


Copyright © 2003-2007 Magic-Project. All Rights Reserved.