<commit_before>package control;

import java.awt.*;
import java.io.*;
import java.util.*;

import javax.swing.*;
import javax.swing.event.*;

import model.*;
import view.*;

/**
 * Test class.
 * @author cryingshadow
 */
public class Main {

    /**
     * @param args Ignored.
     */
    public static void main(final String[] args) {
        final JFrame frame = new JFrame("SnakeTest");
        final JPanel content = new JPanel(new FlowLayout());
        final JPanel statsAndControls = new JPanel();
        statsAndControls.setLayout(new GridBagLayout());
        final JScrollPane scroll = new JScrollPane(content);
        scroll.setPreferredSize(new Dimension(1300, 1020));
        frame.getContentPane().add(scroll);
        final Settings settings = new Settings();
        final Maze maze = new Maze(settings);
        final Competition competition = new Competition();
        final Snakes snakes = new Snakes();
        final SnakeControls snakeControls = new SnakeControls();
        final CompetitionControl control = new CompetitionControl(settings, maze, snakes, snakeControls, competition);
        final MazeDisplay mazeDisplay = new MazeDisplay(maze, settings);
        final SnakesDisplay snakesDisplay = new SnakesDisplay(snakes);
        final SettingsDisplay settingsDisplay = new SettingsDisplay(settings, competition, control);
        final CompetitionDisplay competitionDisplay = new CompetitionDisplay(competition, snakeControls, control);
        final GridBagConstraints c = new GridBagConstraints();
        c.gridx = 0;
        c.gridy = 0;
        c.fill = GridBagConstraints.HORIZONTAL;
        c.weightx = 1.0;
        statsAndControls.add(snakesDisplay, c);
        c.gridy = 1;
        statsAndControls.add(settingsDisplay, c);
        c.gridy = 2;
        statsAndControls.add(competitionDisplay, c);
        content.add(mazeDisplay);
        content.add(statsAndControls);
        settings.addChangeListener(
            new ChangeListener() {

                @Override
                public void stateChanged(final ChangeEvent e) {
                    frame.validate();
                }

            }
        );
        frame.setDefaultCloseOperation(WindowConstants.EXIT_ON_CLOSE);
        if (args.length > 0) {
            Main.preload(args[0], settings, control);
        }
        frame.pack();
        frame.setVisible(true);
    }

    /**<commit_msg>keep control panel in viewport when changing the zoom<commit_after>package control;

import java.awt.*;
import java.io.*;
import java.util.*;

import javax.swing.*;
import javax.swing.event.*;

import model.*;
import view.*;

/**
 * Test class.
 * @author cryingshadow
 */
public class Main {

    /**
     * @param args Ignored.
     */
    public static void main(final String[] args) {
        final JFrame frame = new JFrame("SnakeTest");
        final JPanel content = new JPanel(new FlowLayout());
        final JPanel statsAndControls = new JPanel();
        statsAndControls.setLayout(new GridBagLayout());
        final JScrollPane scroll = new JScrollPane(content);
        frame.getContentPane().add(scroll);
        final Settings settings = new Settings();
        final Maze maze = new Maze(settings);
        final Competition competition = new Competition();
        final Snakes snakes = new Snakes();
        final SnakeControls snakeControls = new SnakeControls();
        final CompetitionControl control = new CompetitionControl(settings, maze, snakes, snakeControls, competition);
        final MazeDisplay mazeDisplay = new MazeDisplay(maze, settings);
        final SnakesDisplay snakesDisplay = new SnakesDisplay(snakes);
        final SettingsDisplay settingsDisplay = new SettingsDisplay(settings, competition, control);
        final CompetitionDisplay competitionDisplay = new CompetitionDisplay(competition, snakeControls, control);
        final GridBagConstraints c = new GridBagConstraints();
        c.gridx = 0;
        c.gridy = 0;
        c.fill = GridBagConstraints.HORIZONTAL;
        c.weightx = 1.0;
        statsAndControls.add(snakesDisplay, c);
        c.gridy = 1;
        statsAndControls.add(settingsDisplay, c);
        c.gridy = 2;
        statsAndControls.add(competitionDisplay, c);
        content.add(mazeDisplay);
        content.add(statsAndControls);
        settings.addChangeListener(
            new ChangeListener() {

                @Override
                public void stateChanged(final ChangeEvent e) {
                    frame.validate();
                    content.scrollRectToVisible(statsAndControls.getBounds());
                }

            }
        );
        frame.setDefaultCloseOperation(WindowConstants.EXIT_ON_CLOSE);
        if (args.length > 0) {
            Main.preload(args[0], settings, control);
        }
        frame.pack();
        frame.setVisible(true);
    }

    /**
{'fraction_non_alphanumeric': 0.09776134729924009, 'fraction_numerical': 0.004929143561306223, 'mean_word_length': 2.5547445255474455, 'pattern_counts': {'":': 0, '<': 3, '<?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': '5769463', 'n_tokens_mistral': 1291, 'n_tokens_neox': 1234, 'n_words': 330}