<commit_before>package programminglife.gui;

import com.google.common.base.Charsets;
import javafx.application.Platform;
import javafx.scene.control.Alert;
import javafx.scene.control.ButtonType;
import javafx.scene.control.DialogPane;
import programminglife.ProgrammingLife;

import java.io.IOException;
import java.net.URL;
import java.util.Optional;

/**
 * A class which contains all the possible alerts we can give to the user.
 */
public final class Alerts {
    private static final double ABOUT_MIN_WIDTH = 500;
    private static final double INSTRUCTIONS_MIN_WIDTH = 800;

    /**
     * Constructor for the Alert.
     */
    private Alerts() {
    }

    /**
     * Alert method used if the alert is an error.
     *
     * @param message String containing the message to be given to the user.
     */
    public static void error(String message) {
        Platform.runLater(() -> {
           Alert a = new Alert(Alert.AlertType.ERROR, message, ButtonType.CLOSE);
           DialogPane pane = a.getDialogPane();
           if (ProgrammingLife.getShowCSS()) {
                pane.getStylesheets().add("/Alerts.css");
           } else {
               pane.getStylesheets().removeAll();
           }
           a.show();
        });
    }

    /**
     * Alert method used if the alert is a warning.
     *
     * @param message String containing the message to be given to the user.
     */
    public static void warning(String message) {
        Platform.runLater(() -> {
            Alert a = new Alert(Alert.AlertType.WARNING, message, ButtonType.CLOSE);
            DialogPane pane = a.getDialogPane();
            if (ProgrammingLife.getShowCSS()) {
                pane.getStylesheets().add("/Alerts.css");
            } else {
                pane.getStylesheets().removeAll();
            }
            a.show();
        });
    }


    /**
     * Alert method used if the alert is informative.
     *
     * @param message String containing the message to be given to the user.
     */
    public static void info(String message) {
        Platform.runLater(() -> {
            Alert a = new Alert(Alert.AlertType.INFORMATION, message, ButtonType.CLOSE);
            DialogPane pane = a.getDialogPane();
            if (ProgrammingLife.getShowCSS()) {
                pane.getStylesheets().add("/Alerts.css");
            } else {
                pane.getStylesheets().removeAll();
            }
            a.show();
        });
    }

    /**
     * Alert method used if the user wants to quit.
     */
    public static void quitAlert() {
        Alert a = new Alert(Alert.AlertType.CONFIRMATION);
        DialogPane pane = a.getDialogPane();
        if (ProgrammingLife.getShowCSS()) {
            pane.getStylesheets().add("/Alerts.css");
        } else {
            pane.getStylesheets().removeAll();
        }
        a.setTitle("Confirm Exit");
        a.setHeaderText("Do you really want to exit?");
        Optional<ButtonType> result = a.showAndWait();
        result.ifPresent(buttonType -> {
            if (buttonType == ButtonType.OK) {<commit_msg>Update exit text<commit_after>package programminglife.gui;

import com.google.common.base.Charsets;
import javafx.application.Platform;
import javafx.scene.control.Alert;
import javafx.scene.control.ButtonType;
import javafx.scene.control.DialogPane;
import programminglife.ProgrammingLife;

import java.io.IOException;
import java.net.URL;
import java.util.Optional;

/**
 * A class which contains all the possible alerts we can give to the user.
 */
public final class Alerts {
    private static final double ABOUT_MIN_WIDTH = 500;
    private static final double INSTRUCTIONS_MIN_WIDTH = 800;

    /**
     * Constructor for the Alert.
     */
    private Alerts() {
    }

    /**
     * Alert method used if the alert is an error.
     *
     * @param message String containing the message to be given to the user.
     */
    public static void error(String message) {
        Platform.runLater(() -> {
           Alert a = new Alert(Alert.AlertType.ERROR, message, ButtonType.CLOSE);
           DialogPane pane = a.getDialogPane();
           if (ProgrammingLife.getShowCSS()) {
                pane.getStylesheets().add("/Alerts.css");
           } else {
               pane.getStylesheets().removeAll();
           }
           a.show();
        });
    }

    /**
     * Alert method used if the alert is a warning.
     *
     * @param message String containing the message to be given to the user.
     */
    public static void warning(String message) {
        Platform.runLater(() -> {
            Alert a = new Alert(Alert.AlertType.WARNING, message, ButtonType.CLOSE);
            DialogPane pane = a.getDialogPane();
            if (ProgrammingLife.getShowCSS()) {
                pane.getStylesheets().add("/Alerts.css");
            } else {
                pane.getStylesheets().removeAll();
            }
            a.show();
        });
    }


    /**
     * Alert method used if the alert is informative.
     *
     * @param message String containing the message to be given to the user.
     */
    public static void info(String message) {
        Platform.runLater(() -> {
            Alert a = new Alert(Alert.AlertType.INFORMATION, message, ButtonType.CLOSE);
            DialogPane pane = a.getDialogPane();
            if (ProgrammingLife.getShowCSS()) {
                pane.getStylesheets().add("/Alerts.css");
            } else {
                pane.getStylesheets().removeAll();
            }
            a.show();
        });
    }

    /**
     * Alert method used if the user wants to quit.
     */
    public static void quitAlert() {
        Alert a = new Alert(Alert.AlertType.CONFIRMATION);
        DialogPane pane = a.getDialogPane();
        if (ProgrammingLife.getShowCSS()) {
            pane.getStylesheets().add("/Alerts.css");
        } else {
            pane.getStylesheets().removeAll();
        }
        a.setTitle("Confirm Exit");
        a.setHeaderText("Exit:");
        a.setContentText("Do you really want to exit?");
        Optional<ButtonType> result = a.showAndWait();
        result.ifPresent(buttonType -> {
            if (buttonType == ButtonType.OK) {
{'fraction_non_alphanumeric': 0.11313163823624074, 'fraction_numerical': 0.0019311232700354038, 'mean_word_length': 2.051055473735886, 'pattern_counts': {'":': 0, '<': 5, '<?xml version=': 0, '>': 13, 'https://': 0, 'lorem ipsum': 0, 'www.': 0, 'xml': 0}, 'pii_count': 0, 'substrings_counts': 0, 'word_list_counts': {'cursed_substrings.json': 0, 'profanity_word_list.json': 0, 'sexual_word_list.json': 0, 'zh_pornsignals.json': 0}}
{'dir': 'git-commits-cleaned', 'id': '3861635', 'n_tokens_mistral': 1772, 'n_tokens_neox': 1683, 'n_words': 445}