diff --git a/src/main/java/edu/ntnu/stud/chaosgame/controller/ChaosGameObserver.java b/src/main/java/edu/ntnu/stud/chaosgame/controller/ChaosGameObserver.java index 54c05bca66c3270dc206b48ce5f2c9126f1a1354..c21cf7441a897d58d495d7096eb12b7102b9b6e8 100644 --- a/src/main/java/edu/ntnu/stud/chaosgame/controller/ChaosGameObserver.java +++ b/src/main/java/edu/ntnu/stud/chaosgame/controller/ChaosGameObserver.java @@ -6,7 +6,7 @@ import edu.ntnu.stud.chaosgame.model.game.ChaosGameDescription; /** * Observer interface for monitoring changes to the active - * + * TODO: Do we want to have separate update methods for the canvas and description or just one for the whole game? (likely the latter) */ public interface ChaosGameObserver { // TODO: Create interface @@ -16,12 +16,14 @@ public interface ChaosGameObserver { * * @param canvas the canvas. */ - void updateCanvas(ChaosCanvas canvas); + //void updateCanvas(ChaosCanvas canvas); /** * Perform update of the ChaosGameDescription. * * @param description the description. */ - void updateDescription(ChaosGameDescription description); + //void updateDescription(ChaosGameDescription description); + + void update(ChaosGame game); } diff --git a/src/main/java/edu/ntnu/stud/chaosgame/model/game/ChaosGame.java b/src/main/java/edu/ntnu/stud/chaosgame/model/game/ChaosGame.java index 26352bf9d4e5fd7843e2a489d312a87fe9985f0a..f253bc2d1936c18a0f375a86dda8b242c9b462b0 100644 --- a/src/main/java/edu/ntnu/stud/chaosgame/model/game/ChaosGame.java +++ b/src/main/java/edu/ntnu/stud/chaosgame/model/game/ChaosGame.java @@ -71,6 +71,15 @@ public class ChaosGame { this.observers.addAll(Arrays.asList(observers)); } + /** + * Notify the observers that a change has occurred in the chaos game. + */ + public void notifyObservers() { + for (ChaosGameObserver observer : this.observers) { + observer.update(this); + } + } + /** * Get the canvas of this chaos game. *