de.tabacha.cgo
Class GameEvent

java.lang.Object
  extended byjava.util.EventObject
      extended byde.tabacha.cgo.GameEvent
All Implemented Interfaces:
java.io.Serializable

public class GameEvent
extends java.util.EventObject

Holds information about a change in the game. Possible changes are:


$Id: GameEvent.java,v 1.7 2004/12/23 21:42:43 mk Exp $

Version:
$Revision: 1.7 $
See Also:
GameListener, Serialized Form
Threadsafe?
true Immutable

Field Summary
 
Fields inherited from class java.util.EventObject
source
 
Constructor Summary
GameEvent(Game game, boolean direction)
          Constructor.
GameEvent(Game game, boolean playerDirection, Move move)
          Called when a move has been performed.
GameEvent(Game game, boolean direction, Move move, java.lang.String message)
          Constructor.
 
Method Summary
 boolean getDirection()
          Meaning of return value depends.
 Game getGame()
          Returns the game where this event evolved.
 java.lang.String getMessage()
          Returns the key for the locale resource bundle for textual information about the event.
 Move getMove()
          For hasMoved : Returns the move that has just been performed.
 
Methods inherited from class java.util.EventObject
getSource, toString
 
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, wait, wait, wait
 

Constructor Detail

GameEvent

public GameEvent(Game game,
                 boolean direction)
Constructor.

Parameters:
direction - Meaning depends on the type of event.
See Also:
getDirection(), GameListener

GameEvent

public GameEvent(Game game,
                 boolean playerDirection,
                 Move move)
Called when a move has been performed.

Parameters:
playerDirection - Direction of the player that made the move
move - The move that has been performed.

GameEvent

public GameEvent(Game game,
                 boolean direction,
                 Move move,
                 java.lang.String message)
Constructor.

Parameters:
direction - Meaning depends on the type of event.
move - The last move. May be null if information is not useful.
message - A short text with more information.
See Also:
getDirection(), GameListener
Method Detail

getGame

public Game getGame()
Returns the game where this event evolved.


getMessage

public java.lang.String getMessage()
Returns the key for the locale resource bundle for textual information about the event.


getDirection

public boolean getDirection()
Meaning of return value depends.

Returns:
Constants.UP or Constants.DOWN

getMove

public Move getMove()
For hasMoved : Returns the move that has just been performed. For gameAborted: Returns the erronous move.