All Downloads are FREE. Search and download functionalities are using the official Maven repository.

com.vadeen.neat.gui.controller.VisualizeController Maven / Gradle / Ivy

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();
    }
}




© 2015 - 2024 Weber Informatics LLC | Privacy Policy