<commit_before>package nl.utwente.group10.ui;

import javafx.application.Application;
import javafx.application.Platform;
import javafx.fxml.FXMLLoader;
import javafx.scene.Node;
import javafx.scene.Scene;
import javafx.scene.control.CheckBox;
import javafx.scene.layout.BorderPane;
import javafx.scene.layout.FlowPane;
import javafx.stage.Stage;
import nl.utwente.ewi.caes.tactilefx.debug.DebugParent;
import nl.utwente.ewi.caes.tactilefx.fxml.TactileBuilderFactory;
import nl.utwente.group10.haskell.catalog.Entry;
import nl.utwente.group10.haskell.catalog.HaskellCatalog;
import nl.utwente.group10.ui.components.Connection;
import nl.utwente.group10.ui.components.DisplayBlock;
import nl.utwente.group10.ui.components.FunctionBlock;
import nl.utwente.group10.ui.components.ValueBlock;

public class Main extends Application {
	private DebugParent debug;
	private CustomUIPane tactilePane;

	@Override
	public void start(Stage stage) throws Exception {
		BorderPane root = new BorderPane();

		tactilePane = FXMLLoader.load(this.getClass().getResource("/ui/Main.fxml"), null, new TactileBuilderFactory());

		HaskellCatalog catalog = new HaskellCatalog();

		Entry plus = catalog.getEntry("(+)");
		FunctionBlock plusBlock = new FunctionBlock(plus.getName(), plus.getType(), tactilePane);
		tactilePane.getChildren().add(plusBlock);

		Entry id = catalog.getEntry("id");
		FunctionBlock idBlock = new FunctionBlock(id.getName(), id.getType(), tactilePane);
		tactilePane.getChildren().add(idBlock);

		Entry pi = catalog.getEntry("pi");
		FunctionBlock piBlock = new FunctionBlock(pi.getName(), pi.getType(), tactilePane);
		tactilePane.getChildren().add(piBlock);

		tactilePane.getChildren().add(new ValueBlock("6.0"));
		tactilePane.getChildren().add(new DisplayBlock());
		
		Connection connection = new Connection(idBlock, idBlock.getOutputAnchor(), plusBlock, plusBlock.getInputs()[0]);
		tactilePane.getChildren().add(connection);

		// Init Control Pane
		FlowPane controlLayout = new FlowPane();
		CheckBox enableDebug = new CheckBox("Enable Debug Mode");
		enableDebug.setSelected(false);
		controlLayout.getChildren().add(enableDebug);

		root.setCenter(tactilePane);
		root.setBottom(controlLayout);

		// Init Debug
		debug = new DebugParent(root);
		debug.overlayVisibleProperty().bindBidirectional(
				enableDebug.selectedProperty());
		debug.registerTactilePane(tactilePane);

		Scene scene = new Scene(debug);
		stage.setOnCloseRequest(event -> Platform.exit());
		stage.setScene(scene);
		stage.show();

		// Invalidate
		invalidate();
	}

	/** Re-evaluate all displays. */
	private void invalidate() {
		for (Node node : tactilePane.getChildren()) {
			if (node instanceof DisplayBlock) {<commit_msg>Nuke entire process on close request<commit_after>package nl.utwente.group10.ui;

import javafx.application.Application;
import javafx.application.Platform;
import javafx.fxml.FXMLLoader;
import javafx.scene.Node;
import javafx.scene.Scene;
import javafx.scene.control.CheckBox;
import javafx.scene.layout.BorderPane;
import javafx.scene.layout.FlowPane;
import javafx.stage.Stage;
import nl.utwente.ewi.caes.tactilefx.debug.DebugParent;
import nl.utwente.ewi.caes.tactilefx.fxml.TactileBuilderFactory;
import nl.utwente.group10.haskell.catalog.Entry;
import nl.utwente.group10.haskell.catalog.HaskellCatalog;
import nl.utwente.group10.ui.components.Connection;
import nl.utwente.group10.ui.components.DisplayBlock;
import nl.utwente.group10.ui.components.FunctionBlock;
import nl.utwente.group10.ui.components.ValueBlock;

public class Main extends Application {
	private DebugParent debug;
	private CustomUIPane tactilePane;

	@Override
	public void start(Stage stage) throws Exception {
		BorderPane root = new BorderPane();

		tactilePane = FXMLLoader.load(this.getClass().getResource("/ui/Main.fxml"), null, new TactileBuilderFactory());

		HaskellCatalog catalog = new HaskellCatalog();

		Entry plus = catalog.getEntry("(+)");
		FunctionBlock plusBlock = new FunctionBlock(plus.getName(), plus.getType(), tactilePane);
		tactilePane.getChildren().add(plusBlock);

		Entry id = catalog.getEntry("id");
		FunctionBlock idBlock = new FunctionBlock(id.getName(), id.getType(), tactilePane);
		tactilePane.getChildren().add(idBlock);

		Entry pi = catalog.getEntry("pi");
		FunctionBlock piBlock = new FunctionBlock(pi.getName(), pi.getType(), tactilePane);
		tactilePane.getChildren().add(piBlock);

		tactilePane.getChildren().add(new ValueBlock("6.0"));
		tactilePane.getChildren().add(new DisplayBlock());
		
		Connection connection = new Connection(idBlock, idBlock.getOutputAnchor(), plusBlock, plusBlock.getInputs()[0]);
		tactilePane.getChildren().add(connection);

		// Init Control Pane
		FlowPane controlLayout = new FlowPane();
		CheckBox enableDebug = new CheckBox("Enable Debug Mode");
		enableDebug.setSelected(false);
		controlLayout.getChildren().add(enableDebug);

		root.setCenter(tactilePane);
		root.setBottom(controlLayout);

		// Init Debug
		debug = new DebugParent(root);
		debug.overlayVisibleProperty().bindBidirectional(
				enableDebug.selectedProperty());
		debug.registerTactilePane(tactilePane);

		Scene scene = new Scene(debug);
		stage.setOnCloseRequest(event -> System.exit(0));
		stage.setScene(scene);
		stage.show();

		// Invalidate
		invalidate();
	}

	/** Re-evaluate all displays. */
	private void invalidate() {
		for (Node node : tactilePane.getChildren()) {
			if (node instanceof DisplayBlock) {
{'fraction_non_alphanumeric': 0.12586900841566045, 'fraction_numerical': 0.006403219904866447, 'mean_word_length': 5.699754901960785, 'pattern_counts': {'":': 0, '<': 3, '<?xml version=': 0, '>': 5, 'https://': 0, 'lorem ipsum': 0, 'www.': 0, 'xml': 6}, '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': '4548890', 'n_tokens_mistral': 1812, 'n_tokens_neox': 1706, 'n_words': 321}