Skip to content
Snippets Groups Projects
Commit 7346aa64 authored by Håvard Daleng's avatar Håvard Daleng
Browse files

Added notifyObservers()-method.

parent b78d0c4e
No related branches found
No related tags found
No related merge requests found
......@@ -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);
}
......@@ -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.
*
......
0% Loading or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment