Package edu.ntnu.idi.idatt.observer
Interface BoardGameSubject
- All Known Implementing Classes:
BoardGame
,LadderBoardGame
,LudoBoardGame
public interface BoardGameSubject
BoardGameSubject interface
This interface defines the methods for a board game subject in the observer pattern.
-
Method Summary
Modifier and TypeMethodDescriptionvoid
addObserver
(BoardGameObserver observer) Adds an observer to the subject.void
notifyCurrentPlayerChanged
(Player player) Notifies the observers that the current player has changed.void
notifyGameFinished
(Player winner) Notifies the observers that the game has finished.void
notifyRoundNumberIncremented
(int roundNumber) Notifies the observers that the round number has incremented.void
removeObserver
(BoardGameObserver observer) Removes an observer from the subject.
-
Method Details
-
addObserver
Adds an observer to the subject.- Parameters:
observer
- the observer to add
-
removeObserver
Removes an observer from the subject.- Parameters:
observer
- the observer to remove
-
notifyRoundNumberIncremented
void notifyRoundNumberIncremented(int roundNumber) Notifies the observers that the round number has incremented.- Parameters:
roundNumber
- the new round number
-
notifyCurrentPlayerChanged
Notifies the observers that the current player has changed.- Parameters:
player
- the new current player
-
notifyGameFinished
Notifies the observers that the game has finished.- Parameters:
winner
- the winner of the game
-