|
||||||||||
PREV CLASS NEXT CLASS | FRAMES NO FRAMES | |||||||||
SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD |
java.lang.Objectorg.dartra.framework.GameEvent
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.
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 |
public static final int GAME_STARTED
A game event of this type is signaled when the darts game has started.
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.
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.
public static final int PLAYER_CHANGED
A game event of this type is signaled when the current player of a darts game has 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.
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.
Constructor Detail |
public GameEvent(Game game, int type, java.lang.String message)
Create a new game event.
game
- The source for this event.type
- The type of event.message
- An informative message describing the event.public GameEvent(Game game, int type, java.lang.String message, java.lang.Object info)
Create a new game event.
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 |
public Game getGame()
Get the game that signaled this event. This is the source object for the event.
public int getType()
Get the type of this event.
public java.lang.String getMessage()
Get the event message.
public java.lang.Object getInfo()
Get the info object attached to this event, or null if no additional information is available.
public void signal()
Signal a game event to all interested parties, that is, game event listeners known to the source object.
public java.lang.String toString()
|
||||||||||
PREV CLASS NEXT CLASS | FRAMES NO FRAMES | |||||||||
SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD |