Class RoundEvent

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

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

    • NO_REASON

      public static final Game.WinningReason NO_REASON
      is a static constant with null value meaning that there are not yet a reason
    • startPlayer

      public final Player startPlayer
      is the first {link @Player} when the round will start
    • opponent

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

      public final Player winner
      is the {link @Player} who win the current round during the Game or GameEvent.NO_WINNER
    • reason

      public final Game.WinningReason reason
      Defined only if winner is defined, this is the reason why the winner wins
    • round

      public final int round
      is the identifier (counter) of the related round.
    • game

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

    • RoundEvent

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

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