Class RoundEvent
java.lang.Object
java.util.EventObject
be.belegkarnil.game.board.tak.event.RoundEvent
- All Implemented Interfaces:
Serializable
This event is used to notify interested parties that the turn state is changed during a
Game.- Author:
- Belegkarnil
- See Also:
-
Field Summary
FieldsModifier and TypeFieldDescriptionfinal Gameis the {link @Game} related to this event (i.e.static final Game.WinningReasonis a static constant with null value meaning that there are not yet a reasonfinal Playeris the second/other/opponent {link @Player} when the round will startfinal Game.WinningReasonDefined only if winner is defined, this is the reason why the winner winsfinal intis the identifier (counter) of the related round.final Playeris the first {link @Player} when the round will startfinal Playeris the {link @Player} who win the current round during theGameorGameEvent.NO_WINNERFields inherited from class java.util.EventObject
source -
Constructor Summary
ConstructorsConstructorDescriptionRoundEvent(Game game, Player startPlayer, Player opponent, int round) Constructor that does not define a winner (GameEvent.NO_WINNER), designed for begin events.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. -
Method Summary
Methods inherited from class java.util.EventObject
getSource, toString
-
Field Details
-
NO_REASON
is a static constant with null value meaning that there are not yet a reason -
startPlayer
is the first {link @Player} when the round will start -
opponent
is the second/other/opponent {link @Player} when the round will start -
winner
is the {link @Player} who win the current round during theGameorGameEvent.NO_WINNER -
reason
Defined only if winner is defined, this is the reason why the winner wins -
round
public final int roundis the identifier (counter) of the related round. -
game
is the {link @Game} related to this event (i.e. theGamethat generates the event)
-
-
Constructor Details
-
RoundEvent
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 eventstartPlayer- is the first player to play when the round will startopponent- is the second/other/opponent player to play when the round will startround- 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 eventstartPlayer- is the first player to play when the round will startopponent- is the second/other/opponent player to play when the round will startround- is the round identifier related to the eventwinner- is the player (first/second) who win theGameorGameEvent.NO_WINNERreason- is reason why the player wins- Throws:
IllegalArgumentException- if source is null
-