<commit_before>package com.health.gui;

import java.awt.BorderLayout;
import java.awt.Color;
import java.awt.FlowLayout;
import java.awt.event.ActionEvent;
import java.awt.event.ActionListener;
import java.io.IOException;
import java.util.ArrayList;

import javax.swing.BorderFactory;
import javax.swing.JButton;
import javax.swing.JPanel;
import javax.swing.JTextArea;
import javax.swing.JTextField;
import javax.swing.border.EmptyBorder;
import javax.xml.parsers.ParserConfigurationException;

import org.xml.sax.SAXException;

import com.health.Table;
import com.health.control.InputData;
import com.health.control.ControlModule;
import com.health.input.Input;
import com.health.input.InputException;

/**
 * class creates and fills the panel for scripting.
 *
 * @author Daan
 */
public class ScriptPanel extends JPanel {

	private static JTextArea scriptArea;

	/**
	 * function creates and fill the panel.
	 */
	public ScriptPanel() {

		this.setLayout(new BorderLayout());

		JPanel panel = new JPanel(new BorderLayout());

		scriptArea = new JTextArea(2, 1);
		scriptArea.setBorder(BorderFactory.createLineBorder(Color.black));

		panel.add(scriptArea, BorderLayout.CENTER);

		JButton startAnalasisButton = new JButton("Start Analysis");
		startAnalasisButton.addActionListener(new ListenForStartAnalysis());

		JPanel southPanel = new JPanel(new FlowLayout(FlowLayout.RIGHT));
		southPanel.add(startAnalasisButton);
		panel.add(southPanel, BorderLayout.SOUTH);

		JTextField textAbove = new JTextField("Script: ");
		textAbove.setEditable(false);
		textAbove.setDisabledTextColor(Color.black);

		panel.add(textAbove, BorderLayout.NORTH);
		panel.setBorder(new EmptyBorder(10, 80, 10, 80));

		this.add(panel, BorderLayout.CENTER);

	}

	/**
	 * get the script area component.
	 *
	 * @return scriptArea the component of the scriptarea.
	 */
	public static JTextArea getScriptArea() {
		return scriptArea;
	}

	/**
	 * handle start analysis button.
	 *
	 * @author daan
	 *
	 */
	private class ListenForStartAnalysis implements ActionListener {

		/**
		 * Makes inputData array and calls the control module.
		 *
		 * @param e
		 */
		public void actionPerformed(final ActionEvent e) {
			ArrayList<FileListingRow> files = FileListing.getFileListingRows();
			Table parsedData = new Table(null);

			for (int i = 0; i < files.size(); i++) {
				String xmlFormat = files.get(i).getXmlFormat()
						.getSelectedItem().toString();
				String fileString = files.get(i).getFileString();
				xmlFormat = GUImain.PATHTOXMLFORMATS + xmlFormat + ".xml";

				System.out.println(xmlFormat + " " + fileString);

				try {
          parsedData = Input.readTable(fileString,xmlFormat);
        } catch (IOException | ParserConfigurationException | SAXException | InputException e1) {
          System.out.println("Error: Something went wrong parsing the config and data!");
          e1.printStackTrace();
        }
			}

			String script = ScriptPanel.getScriptArea().getText();

			ControlModule control = new ControlModule(parsedData, script);
			String output = control.startAnalysis();
		}

	}
}<commit_msg>displayout call<commit_after>package com.health.gui;

import java.awt.BorderLayout;
import java.awt.Color;
import java.awt.FlowLayout;
import java.awt.event.ActionEvent;
import java.awt.event.ActionListener;
import java.io.IOException;
import java.util.ArrayList;

import javax.swing.BorderFactory;
import javax.swing.JButton;
import javax.swing.JPanel;
import javax.swing.JTextArea;
import javax.swing.JTextField;
import javax.swing.border.EmptyBorder;
import javax.xml.parsers.ParserConfigurationException;

import org.xml.sax.SAXException;

import com.health.Table;
import com.health.control.InputData;
import com.health.control.ControlModule;
import com.health.input.Input;
import com.health.input.InputException;

/**
 * class creates and fills the panel for scripting.
 *
 * @author Daan
 */
public class ScriptPanel extends JPanel {

	private static JTextArea scriptArea;

	/**
	 * function creates and fill the panel.
	 */
	public ScriptPanel() {

		this.setLayout(new BorderLayout());

		JPanel panel = new JPanel(new BorderLayout());

		scriptArea = new JTextArea(2, 1);
		scriptArea.setBorder(BorderFactory.createLineBorder(Color.black));

		panel.add(scriptArea, BorderLayout.CENTER);

		JButton startAnalasisButton = new JButton("Start Analysis");
		startAnalasisButton.addActionListener(new ListenForStartAnalysis());

		JPanel southPanel = new JPanel(new FlowLayout(FlowLayout.RIGHT));
		southPanel.add(startAnalasisButton);
		panel.add(southPanel, BorderLayout.SOUTH);

		JTextField textAbove = new JTextField("Script: ");
		textAbove.setEditable(false);
		textAbove.setDisabledTextColor(Color.black);

		panel.add(textAbove, BorderLayout.NORTH);
		panel.setBorder(new EmptyBorder(10, 80, 10, 80));

		this.add(panel, BorderLayout.CENTER);

	}

	/**
	 * get the script area component.
	 *
	 * @return scriptArea the component of the scriptarea.
	 */
	public static JTextArea getScriptArea() {
		return scriptArea;
	}

	/**
	 * handle start analysis button.
	 *
	 * @author daan
	 *
	 */
	private class ListenForStartAnalysis implements ActionListener {

		/**
		 * Makes inputData array and calls the control module.
		 *
		 * @param e
		 */
		public void actionPerformed(final ActionEvent e) {
			ArrayList<FileListingRow> files = FileListing.getFileListingRows();
			Table parsedData = new Table(null);

			for (int i = 0; i < files.size(); i++) {
				String xmlFormat = files.get(i).getXmlFormat()
						.getSelectedItem().toString();
				String fileString = files.get(i).getFileString();
				xmlFormat = GUImain.PATHTOXMLFORMATS + xmlFormat + ".xml";

				System.out.println(xmlFormat + " " + fileString);

				try {
          parsedData = Input.readTable(fileString,xmlFormat);
        } catch (IOException | ParserConfigurationException | SAXException | InputException e1) {
          System.out.println("Error: Something went wrong parsing the config and data!");
          e1.printStackTrace();
        }
			}

			String script = ScriptPanel.getScriptArea().getText();

			ControlModule control = new ControlModule(parsedData, script);
			String output = control.startAnalysis();
			
			OutputDataPanel.displayData(output);
			
		}

	}
}
{'fraction_non_alphanumeric': 0.11160714285714286, 'fraction_numerical': 0.004145408163265306, 'mean_word_length': 4.2406015037593985, 'pattern_counts': {'":': 0, '<': 7, '<?xml version=': 0, '>': 5, 'https://': 0, 'lorem ipsum': 0, 'www.': 0, 'xml': 16}, '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': '6883750', 'n_tokens_mistral': 2064, 'n_tokens_neox': 1814, 'n_words': 430}