<commit_before>package com.sakratt.gus;

import java.awt.BorderLayout;
import java.awt.Dimension;
import java.awt.Font;
import java.awt.Image;
import java.awt.event.WindowAdapter;
import java.awt.event.WindowEvent;
import java.util.Locale;

import javax.swing.JFrame;
import javax.swing.JScrollPane;
import javax.swing.JTextArea;
import javax.swing.border.EmptyBorder;
import javax.swing.text.DefaultCaret;

/**
 * An output frame is a graphical user interface that displays text.
 * 
 * @author <NAME>
 * 
 */
public class OutputFrame {

	private static final String DEFAULT_TITLE = "Output Frame";
	protected static final int DEFAULT_WIDTH = 600;
	protected static final int DEFAULT_HEIGHT = 300;
	private static final Font OUTPUT_AREA_FONT = new Font("Arial", Font.PLAIN, 14);

	final JFrame frame;
	private final JTextArea outputArea;

	/**
	 * Creates a new output frame.
	 */
	public OutputFrame() {
		this(DEFAULT_TITLE);
	}

	/**
	 * @param width the width of the frame
	 * @param height the height of the frame
	 */
	public OutputFrame(int width, int height) {
		this(width, height, DEFAULT_TITLE);
	}

	/**
	 * @param width the width of the frame
	 * @param height the height of the frame
	 * @param title the title of the frame
	 */
	public OutputFrame(int width, int height, String title) {

		// Output area
		outputArea = new JTextArea();
		outputArea.setBorder(new EmptyBorder(5, 5, 5, 5));
		outputArea.setEditable(false);
		outputArea.setLineWrap(true);
		outputArea.setMargin(null);
		outputArea.setWrapStyleWord(true);
		DefaultCaret caret = (DefaultCaret) outputArea.getCaret();
		caret.setUpdatePolicy(DefaultCaret.ALWAYS_UPDATE);

		// Output area scroll pane
		final JScrollPane scrollPane = new JScrollPane();
		scrollPane.setBorder(null);
		scrollPane.setHorizontalScrollBarPolicy(JScrollPane.HORIZONTAL_SCROLLBAR_NEVER);
		scrollPane.setViewportView(outputArea);

		// Create the frame
		frame = new JFrame();
		frame.addWindowListener(new WindowAdapter() {
			@Override
			public void windowClosing(WindowEvent evt) {
				close();
			}
		});
		frame.setDefaultCloseOperation(JFrame.DO_NOTHING_ON_CLOSE);
		frame.setLayout(new BorderLayout());
		frame.add(scrollPane, BorderLayout.CENTER);

		// Initialize
		setOutputFont(OUTPUT_AREA_FONT);
		setSize(width, height);
		setTitle(title);
		frame.setVisible(true);

	}

	/**
	 * @param title the title of the frame
	 */
	public OutputFrame(String title) {
		this(DEFAULT_WIDTH, DEFAULT_HEIGHT, title);
	}

	/**
	 * Clears the output area.
	 */
	public final void clearOutput() {
		outputArea.setText(null);
	}

	/**
	 * Closes the window.
	 */
	public void close() {
		frame.dispose();
	}

	/**
	 * Prints the given object to the output area.
	 * 
	 * @param o the object
	 */
	public void print(Object o) {
		outputArea.append(o.toString());
	}

	/**
	 * Prints a formatted string using the given locale, format string and arguments to the output
	 * area.
	 * 
	 * @param locale the locale
	 * @param format the format
	 * @param args the arguments
	 */
	public void printf(Locale locale, String format, Object... args) {
		printf(locale, String.format(format, args));<commit_msg>Added option to get the text in the output area<commit_after>package com.sakratt.gus;

import java.awt.BorderLayout;
import java.awt.Dimension;
import java.awt.Font;
import java.awt.Image;
import java.awt.event.WindowAdapter;
import java.awt.event.WindowEvent;
import java.util.Locale;

import javax.swing.JFrame;
import javax.swing.JScrollPane;
import javax.swing.JTextArea;
import javax.swing.border.EmptyBorder;
import javax.swing.text.DefaultCaret;

/**
 * An output frame is a graphical user interface that displays text.
 * 
 * @author <NAME>
 * 
 */
public class OutputFrame {

	private static final String DEFAULT_TITLE = "Output Frame";
	protected static final int DEFAULT_WIDTH = 600;
	protected static final int DEFAULT_HEIGHT = 300;
	private static final Font OUTPUT_AREA_FONT = new Font("Arial", Font.PLAIN, 14);

	final JFrame frame;
	private final JTextArea outputArea;

	/**
	 * Creates a new output frame.
	 */
	public OutputFrame() {
		this(DEFAULT_TITLE);
	}

	/**
	 * @param width the width of the frame
	 * @param height the height of the frame
	 */
	public OutputFrame(int width, int height) {
		this(width, height, DEFAULT_TITLE);
	}

	/**
	 * @param width the width of the frame
	 * @param height the height of the frame
	 * @param title the title of the frame
	 */
	public OutputFrame(int width, int height, String title) {

		// Output area
		outputArea = new JTextArea();
		outputArea.setBorder(new EmptyBorder(5, 5, 5, 5));
		outputArea.setEditable(false);
		outputArea.setLineWrap(true);
		outputArea.setMargin(null);
		outputArea.setWrapStyleWord(true);
		DefaultCaret caret = (DefaultCaret) outputArea.getCaret();
		caret.setUpdatePolicy(DefaultCaret.ALWAYS_UPDATE);

		// Output area scroll pane
		final JScrollPane scrollPane = new JScrollPane();
		scrollPane.setBorder(null);
		scrollPane.setHorizontalScrollBarPolicy(JScrollPane.HORIZONTAL_SCROLLBAR_NEVER);
		scrollPane.setViewportView(outputArea);

		// Create the frame
		frame = new JFrame();
		frame.addWindowListener(new WindowAdapter() {
			@Override
			public void windowClosing(WindowEvent evt) {
				close();
			}
		});
		frame.setDefaultCloseOperation(JFrame.DO_NOTHING_ON_CLOSE);
		frame.setLayout(new BorderLayout());
		frame.add(scrollPane, BorderLayout.CENTER);

		// Initialize
		setOutputFont(OUTPUT_AREA_FONT);
		setSize(width, height);
		setTitle(title);
		frame.setVisible(true);

	}

	/**
	 * @param title the title of the frame
	 */
	public OutputFrame(String title) {
		this(DEFAULT_WIDTH, DEFAULT_HEIGHT, title);
	}

	/**
	 * Clears the output area.
	 */
	public final void clearOutput() {
		outputArea.setText(null);
	}

	/**
	 * Closes the window.
	 */
	public void close() {
		frame.dispose();
	}

	/**
	 * @return the text currently in the output area
	 */
	public String getOutputText() {
		return outputArea.getText();
	}

	/**
	 * Prints the given object to the output area.
	 * 
	 * @param o the object
	 */
	public void print(Object o) {
		outputArea.append(o.toString());
	}

	/**
	 * Prints a formatted string using the given locale, format string and arguments to the output
	 * area.
	 * 
	 * @param locale the locale
	 * @param format the format
	 * @param args the arguments
	 */
	public void printf(Locale locale, String format, Object... args) {
		printf(locale, String.format(format, args));
{'fraction_non_alphanumeric': 0.10889712696941613, 'fraction_numerical': 0.0037071362372567192, 'mean_word_length': 4.023273855702095, 'pattern_counts': {'":': 0, '<': 5, '<?xml version=': 0, '>': 5, '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': '5757165', 'n_tokens_mistral': 2208, 'n_tokens_neox': 1985, 'n_words': 573}