package de.wwwu.awolf.view.services;

import de.wwwu.awolf.presenter.Presenter;
import de.wwwu.awolf.presenter.algorithms.Algorithm;
import javafx.concurrent.Service;
import javafx.concurrent.Task;

public class ButtonClickService extends Service<String> {

    private Algorithm.Type type;

    public ButtonClickService(Algorithm.Type type) {
        this.type = type;
    }

    @Override
    protected Task<String> createTask() {

        return new Task<String>() {
            @Override
            protected String call() throws Exception {
                Presenter.getInstance().executeAlgorithmByType(type);
                return "done";
            }
        };
    }
}
