JMS Conector demo (OC4J 10g R3)

Class GameEvent

java.lang.Object
  extended byGameEvent
All Implemented Interfaces:
java.io.Serializable

class GameEvent
extends java.lang.Object
implements java.io.Serializable

Class used to carry information back and forth between dealer and players. This class implements java.io.Serializable, which makes it easy to pass instances of this class as javax.jms.ObjectMessages.


Field Summary
static int PING
          This GameEvent type is used to prime communications.
 java.lang.String player
          Name of player who is the subject of this GameEvent.
static int PLAYER_ACCEPTED
          This GameEvent type indicates that the dealer has accepted the player's request to join the game.
static int PLAYER_GOT_VALUE
          This GameEvent type indicates the player's new (or kept) value.
static int PLAYER_JOIN_REQUEST
          This GameEvent type is used when the player would like to join a game.
static int PLAYER_PASSES
          This GameEvent type signifies the player wishes to keep the player's present value.
static int PLAYER_REDRAWS
          This GameEvent type signifies the player wishes to receive a new value.
static int PLAYER_REJECTED
          This GameEvent type indicates that the dealer has rejected the player's request to join the game.
static int TURN_NOTIFICATION
          This GameEvent type indicates the player whose turn it is.
 int type
          Indicates type of GameEvent.
 int value
          Game value received (randomly generated) or kept by player player.
 
Constructor Summary
(package private) GameEvent()
           
 
Method Summary
 java.lang.String toString()
           
 
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, wait, wait, wait
 

Field Detail

PING

public static final int PING
This GameEvent type is used to prime communications. This is needed in order to avoid the possibility of the player missing responses from the dealer. See Player.primeCommunications(MyChannel, MyChannel) for a more detailed discussion of why this is necessary. (The Player initiates a PING. The Dealer acknowledges the reception of PING with another PING.) This GameEvent type is sent both by a player to the dealer and by the dealer to the players.

See Also:
Constant Field Values

PLAYER_JOIN_REQUEST

public static final int PLAYER_JOIN_REQUEST
This GameEvent type is used when the player would like to join a game. This GameEvent type is sent by a player to the dealer.

See Also:
Constant Field Values

PLAYER_REDRAWS

public static final int PLAYER_REDRAWS
This GameEvent type signifies the player wishes to receive a new value. Each player gets an initial value and one turn. During the player's turn, the player may either "redraw" (get a new value) or "pass" (keep the initial value). This GameEvent type is sent by a player to the dealer.

See Also:
Constant Field Values

PLAYER_PASSES

public static final int PLAYER_PASSES
This GameEvent type signifies the player wishes to keep the player's present value. Each player gets an initial value and one turn. During the player's turn, the player may either "redraw" (get a new value) or "pass" (keep the initial value). This GameEvent type is sent by a player to the dealer.

See Also:
Constant Field Values

PLAYER_ACCEPTED

public static final int PLAYER_ACCEPTED
This GameEvent type indicates that the dealer has accepted the player's request to join the game. This GameEvent type is sent by the dealer to the players.

See Also:
Constant Field Values

PLAYER_REJECTED

public static final int PLAYER_REJECTED
This GameEvent type indicates that the dealer has rejected the player's request to join the game. The game starts once three players have joined the game. Players are not allowed to enter after the game has already started, so subsequent join requests are rejected. This GameEvent type is sent by the dealer to the players.

See Also:
Constant Field Values

PLAYER_GOT_VALUE

public static final int PLAYER_GOT_VALUE
This GameEvent type indicates the player's new (or kept) value. This GameEvent is sent once the player redraws or passes. This GameEvent type is sent by the dealer to the players.

See Also:
Constant Field Values

TURN_NOTIFICATION

public static final int TURN_NOTIFICATION
This GameEvent type indicates the player whose turn it is.

See Also:
Constant Field Values

type

public int type
Indicates type of GameEvent. This field is valid for all messages, and is always set to one of the constant integer values defined above.


player

public java.lang.String player
Name of player who is the subject of this GameEvent. This field is valid for all messages except when type == PING. player may be "Dealer" when type == PLAYER_GOT_VALUE.


value

public int value
Game value received (randomly generated) or kept by player player. This field is only valid in a message when type == PLAYER_GOT_VALUE.

Constructor Detail

GameEvent

GameEvent()
Method Detail

toString

public java.lang.String toString()

JMS Conector demo (OC4J 10g R3)

Copyright © 2006, Oracle. All rights reserved.