src/gui/model/SidePane.java
private synchronized void runModel() {
        try {
            int runs = Integer.valueOf(iterations.getText());
            for (int i = 0; i < runs; i++) {
                model.doIteration();
                if (realTimeUpdates.isSelected()) {
                    Platform.runLater(this::updateUI);
                    wait();
                } else if (worker.isInterrupted()) {
                    break;
                }
            }
        } catch (InterruptedException e) {
            // e.printStackTrace();
        } finally {
            // clean up from the correct thread when we are done
            Platform.runLater(() -> {
                stepButton.setDisable(false);
                iterations.setDisable(false);
                realTimeUpdates.setDisable(false);
                runButton.setText("Run");
                updateUI();
            });
        }
    }
/**
     * This is a callback used in the model thread and is
     * never called directly. If real time updates are 
     * enabled, this releases the lock after every iteration
     * and waits for the scheduled updateUI task to notify it.
     */
This is a callback used in the model thread and is
never called directly. If real time updates are
enabled, this releases the lock after every iteration
and waits for the scheduled updateUI task to notify it.
This is a callback used in the model thread and is never called directly . If real time updates are enabled this releases the lock after every iteration and waits for the scheduled updateUI task to notify it .
private synchronized void runModel() {
        try {
            int runs = Integer.valueOf(iterations.getText());
            for (int i = 0; i < runs; i++) {
                model.doIteration();
                if (realTimeUpdates.isSelected()) {
                    Platform.runLater(this::updateUI);
                    wait();
                } else if (worker.isInterrupted()) {
                    break;
                }
            }
        } catch (InterruptedException e) {
        } finally {
            Platform.runLater(() -> {
                stepButton.setDisable(false);
                iterations.setDisable(false);
                realTimeUpdates.setDisable(false);
                runButton.setText("Run");
                updateUI();
            });
        }
    }
private synchronized void runModel ( ) { try { int runs = Integer . valueOf ( iterations . getText ( ) ) ; for ( int i = 0 ; i < runs ; i ++ ) { model . doIteration ( ) ; if ( realTimeUpdates . isSelected ( ) ) { Platform . runLater ( this :: updateUI ) ; wait ( ) ; } else if ( worker . isInterrupted ( ) ) { break ; } } } catch ( InterruptedException e ) { } finally { Platform . runLater ( ( ) -> { stepButton . setDisable ( false ) ; iterations . setDisable ( false ) ; realTimeUpdates . setDisable ( false ) ; runButton . setText ( "Run" ) ; updateUI ( ) ; } ) ; } }
This is a callback used in the model thread and is
 never called directly.
This is a callback used in the model thread and is never called directly .
// e.printStackTrace(); // clean up from the correct thread when we are done