Class GameEvent

java.lang.Object
java.util.EventObject
be.belegkarnil.game.board.tak.event.GameEvent
All Implemented Interfaces:
Serializable

public class GameEvent extends EventObject
This event is used to notify interested parties that the game state is changed during a Game.
Author:
Belegkarnil
See Also:
  • Field Details

    • NO_WINNER

      public static Player NO_WINNER
      is a static constant with null value meaning that there are not yet a winner
    • winner

      public final Player winner
      is the {link @Player} who win the Game or NO_WINNER
    • firstPlayer

      public final Player firstPlayer
      is the first {link @Player} when the game will start
    • secondPlayer

      public final Player secondPlayer
      is the second/other/opponent {link @Player} when the game will start
    • game

      public final Game game
      is the {link @Game} related to this event (i.e. the Game that generates the event)
  • Constructor Details

    • GameEvent

      public GameEvent(Game game, Player firstPlayer, Player secondPlayer)
      Constructor that does not define a winner (NO_WINNER), designed for begin events.
      Parameters:
      game - the game related to the event, it's the source of the event
      firstPlayer - is the first player to play when the game will start
      secondPlayer - is the second/other/opponent player to play when the game will start
      Throws:
      IllegalArgumentException - if source is null
    • GameEvent

      public GameEvent(Game game, Player firstPlayer, Player secondPlayer, Player winner)
      Constructor requires a winner (NO_WINNER), designed for end events.
      Parameters:
      game - the game related to the event, it's the source of the event
      firstPlayer - is the first player to play when the game will start
      secondPlayer - is the second/other/opponent player to play when the game will start
      winner - is the player (first/second) who win the Game or NO_WINNER
      Throws:
      IllegalArgumentException - if source is null