Class TurnEvent

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

public class TurnEvent 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_ACTION

      public static final Action NO_ACTION
      is the static constant that represents there are no action (null)
    • current

      public final Player current
      is the first {link @Player} when the turn will start, the event is related to this player
    • opponent

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

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

      public final int turn
      is the identifier (counter) of the related turn.
    • action

      public final Action action
      is the chosen {#link Action}, what the current Player's strategy plays
    • game

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

    • TurnEvent

      public TurnEvent(Game game, Player current, Player opponent, int round, int turn)
      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
      current - is the current player related to this event
      opponent - is the second/other/opponent player
      round - is the round identifier related to the event
      turn - is the turn identifier related to the event
      Throws:
      IllegalArgumentException - if source is null
    • TurnEvent

      public TurnEvent(Game game, Player current, Player opponent, int round, int turn, Action action)
      Constructor requires an action (NO_ACTION), designed for end events.
      Parameters:
      game - the game related to the event, it's the source of the event
      current - is the current player related to this event
      opponent - is the second/other/opponent player
      round - is the round identifier related to the event
      turn - is the turn identifier related to the event
      action - is the action taken by the current player or NO_ACTION
      Throws:
      IllegalArgumentException - if source is null