com.vadeen.neat.gui.controller.VisualizeController Maven / Gradle / Ivy
Go to download
Show more of this group Show more artifacts with this name
Show all versions of neat-gui Show documentation
Show all versions of neat-gui Show documentation
GUI implemenation for com.vadeen.neat.
The newest version!
package com.vadeen.neat.gui.controller;
import com.vadeen.neat.Neat;
import com.vadeen.neat.gui.visualization.VisualPanel;
import com.vadeen.neat.gui.visualization.VisualizationRunner;
import com.vadeen.neat.gui.visualization.Visualizer;
public class VisualizeController {
private final Visualizer visualizer;
private final VisualPanel visualPanel;
private final VisualizationRunner visualizationRunner;
private Neat neat;
public VisualizeController(Visualizer visualizer, VisualPanel visualPanel, Neat neat) {
this.visualizer = visualizer;
this.visualPanel = visualPanel;
this.visualizationRunner = new VisualizationRunner(visualizer, visualPanel);
this.neat = neat;
}
public void setNeat(Neat neat) {
this.neat = neat;
}
public void start() {
if (visualizer == null) {
System.err.println("No visualizer defined.");
return;
}
this.visualizationRunner.run(neat.getGeneration());
}
public void stop() {
visualizationRunner.stop();
}
}