org.dartra.framework
Class GameEvent

java.lang.Object
  extended byorg.dartra.framework.GameEvent

public class GameEvent
extends java.lang.Object

Object representing a game event. Game event objects carry game related information from a game to interested listeners.

A game event can carry arbitrary data using the info property.

GameEvent objects have reference semantics.

Note that this class does not subclass the java.util.EventObject class because that class is not present in J2ME CLDC 1.1 / MIDP 2.0.

Author:
Erwin Vervaet

Field Summary
static int GAME_ENDED
          A game event of this type is signaled when the darts game has ended, that is: a winner has been selected.
static int GAME_STARTED
          A game event of this type is signaled when the darts game has started.
static int ILLEGAL_THROW
          A game event of this type is signaled when the last hit registered with the game resulted in an illegal throw, for instance a bust.
static int MATCH_GAME_CHANGED
          A game event of this type is signaled when the current game of a darts match has changed.
static int PLAYER_CHANGED
          A game event of this type is signaled when the current player of a darts game has changed.
static int SCORE_CHANGED
          A game event of this type is signaled when the score for any of the players of a darts game has changed.
 
Constructor Summary
GameEvent(Game game, int type, java.lang.String message)
          Create a new game event.
GameEvent(Game game, int type, java.lang.String message, java.lang.Object info)
          Create a new game event.
 
Method Summary
 Game getGame()
          Get the game that signaled this event.
 java.lang.Object getInfo()
          Get the info object attached to this event, or null if no additional information is available.
 java.lang.String getMessage()
          Get the event message.
 int getType()
          Get the type of this event.
 void signal()
          Signal a game event to all interested parties, that is, game event listeners known to the source object.
 java.lang.String toString()
           
 
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, wait, wait, wait
 

Field Detail

GAME_STARTED

public static final int GAME_STARTED

A game event of this type is signaled when the darts game has started.

See Also:
Constant Field Values

GAME_ENDED

public static final int GAME_ENDED

A game event of this type is signaled when the darts game has ended, that is: a winner has been selected.

See Also:
Constant Field Values

MATCH_GAME_CHANGED

public static final int MATCH_GAME_CHANGED

A game event of this type is signaled when the current game of a darts match has changed. This event is only signaled by matches, not by single games.

See Also:
Constant Field Values

PLAYER_CHANGED

public static final int PLAYER_CHANGED

A game event of this type is signaled when the current player of a darts game has changed.

See Also:
Constant Field Values

SCORE_CHANGED

public static final int SCORE_CHANGED

A game event of this type is signaled when the score for any of the players of a darts game has changed.

See Also:
Constant Field Values

ILLEGAL_THROW

public static final int ILLEGAL_THROW

A game event of this type is signaled when the last hit registered with the game resulted in an illegal throw, for instance a bust.

See Also:
Constant Field Values
Constructor Detail

GameEvent

public GameEvent(Game game,
                 int type,
                 java.lang.String message)

Create a new game event.

Parameters:
game - The source for this event.
type - The type of event.
message - An informative message describing the event.

GameEvent

public GameEvent(Game game,
                 int type,
                 java.lang.String message,
                 java.lang.Object info)

Create a new game event.

Parameters:
game - The source for this event.
type - The type of event.
message - An informative message describing the event.
info - Any object carrying additional event related info.
Method Detail

getGame

public Game getGame()

Get the game that signaled this event. This is the source object for the event.


getType

public int getType()

Get the type of this event.


getMessage

public java.lang.String getMessage()

Get the event message.


getInfo

public java.lang.Object getInfo()

Get the info object attached to this event, or null if no additional information is available.


signal

public void signal()

Signal a game event to all interested parties, that is, game event listeners known to the source object.


toString

public java.lang.String toString()