I'm creating a simulation for displaying an automated Maze Solver, in which there is little user input.
The MVC architecture is used and is implemented in Java. The View is to receive and draw data from the Model, through the Controller.
As it stands, I have two options available to update the Model logic and in turn update the View:
- Controller implements Runnable
- Controller creates a thread:
Thread runControl = new Thread(this); runControl.start();
- Thread can then execute run() in Controller, which updates the Model logic and pass through the new data to the View
This isn't my preferred method, however, as I'd sooner have the Model running it's own logic. I would prefer:
- Model implements Runnable
- Model contains all logic in run()
- Controller creates a Thread for the Model and executes the model
I'm lost at this point. The Model can then update it's own logic accordingly, but then whilst the Model Thread is running, how can the Controller be notified of changes in the Model data and in turn retrieve that data (that is still being manipulated/updated) to then notify the View?
Many thanks.

New Topic/Question
Reply



MultiQuote




|