<commit_before>package framework.editors;

import java.awt.event.ActionEvent;
import java.awt.event.ActionListener;
import javax.swing.JFrame;
import javax.swing.JPanel;
import javax.swing.BoxLayout;
import javax.swing.JButton;
import javax.swing.JComponent;
import java.util.Observable;
import java.util.Observer;

import framework.Player;

/**
 * Abstract class to support the main window of the application.
 *
 * It is aimed to create all the necessary components for the Player.
 */
public abstract class Editor extends JFrame implements Observer {
    /**
     * Create an Editor object.
     * @param  pl   the associated Player
     * @param  name the name to give to the window
     */
    public Editor(Player pl, String name) {
        super(name);
        player = pl;

        setDefaultCloseOperation(JFrame.EXIT_ON_CLOSE);
        getContentPane().setLayout(new BoxLayout(
            this.getContentPane(),
            BoxLayout.Y_AXIS));

        // Top panel
        JPanel topPanel     = new JPanel();
        JButton playAllButton  = new JButton("Play all");
        playAllButton.addActionListener(new ActionListener() {
            public void actionPerformed(ActionEvent e) {
                player.playAll();
            }
        });
        topPanel.add(playAllButton);

        add(topPanel);
        add(createCentralComponent());

        pack();
        setVisible(true);
    }

    public void update(Observable o, Object arg) {
        if(o == player) {

        }
    }

    /**
     * Create the central component of the editor.
     * @return the central component newly created
     */
    public abstract JComponent createCentralComponent();

    protected Player player;
}<commit_msg>The prototyper is filled through the fillPrototyper method in Editor.<commit_after>package framework.editors;

import java.awt.event.ActionEvent;
import java.awt.event.ActionListener;
import javax.swing.JFrame;
import javax.swing.JPanel;
import javax.swing.BoxLayout;
import javax.swing.JButton;
import javax.swing.JComponent;
import java.util.Observable;
import java.util.Observer;

import framework.Player;
import framework.generators.*;

/**
 * Abstract class to support the main window of the application.
 *
 * It is aimed to create all the necessary components for the Player.
 */
public abstract class Editor extends JFrame implements Observer {
    /**
     * Create an Editor object.
     * @param  pl   the associated Player
     * @param  name the name to give to the window
     */
    public Editor(Player pl, String name) {
        super(name);
        player = pl;

        fillPrototyper();

        setDefaultCloseOperation(JFrame.EXIT_ON_CLOSE);
        getContentPane().setLayout(new BoxLayout(
            this.getContentPane(),
            BoxLayout.Y_AXIS));

        // Top panel
        JPanel topPanel     = new JPanel();
        JButton playAllButton  = new JButton("Play all");
        playAllButton.addActionListener(new ActionListener() {
            public void actionPerformed(ActionEvent e) {
                player.playAll();
            }
        });
        topPanel.add(playAllButton);

        add(topPanel);
        add(createCentralComponent());

        pack();
        setVisible(true);
    }

    public void update(Observable o, Object arg) {
        if(o == player) {

        }
    }

    /**
     * Create the central component of the editor.
     * @return the central component newly created
     */
    public abstract JComponent createCentralComponent();

    protected void fillPrototyper() {
        // Add basic generators to the prototyper
        GeneratorPrototyper.addGenerator(new SineGenerator());
        GeneratorPrototyper.addGenerator(new SquareGenerator());
        GeneratorPrototyper.addGenerator(new SawtoothGenerator());
        GeneratorPrototyper.addGenerator(new TriangleGenerator());
    }

    protected Player player;
}
{'fraction_non_alphanumeric': 0.08939974457215837, 'fraction_numerical': 0.0, 'mean_word_length': 2.6394052044609664, 'pattern_counts': {'":': 0, '<': 3, '<?xml version=': 0, '>': 3, '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': '2619585', 'n_tokens_mistral': 1055, 'n_tokens_neox': 1024, 'n_words': 297}