<commit_before>package org.helioviewer.jhv.plugins.swek.view.filter;

import java.awt.BorderLayout;
import java.awt.Color;
import java.awt.GridBagConstraints;
import java.awt.GridBagLayout;

import javax.swing.JCheckBox;
import javax.swing.JLabel;
import javax.swing.JPanel;
import javax.swing.JSpinner;

import org.helioviewer.jhv.base.conversion.GOESLevel;
import org.helioviewer.jhv.data.cache.SWEKOperand;
import org.helioviewer.jhv.data.event.SWEKEventType;
import org.helioviewer.jhv.data.event.SWEKParam;
import org.helioviewer.jhv.data.event.SWEKParameter;
import org.helioviewer.jhv.plugins.swek.download.FilterManager;
import org.helioviewer.jhv.plugins.swek.view.FilterDialog;

@SuppressWarnings("serial")
public class FilterPanel extends JPanel {

    private final JLabel label;
    private final JSpinner spinner;

    private boolean enabled = false;

    private final SWEKParameter parameter;
    private final SWEKEventType eventType;

    private final FilterDialog filterDialog;
    private final SWEKOperand operand;

    public FilterPanel(SWEKEventType _eventType, SWEKParameter _parameter, JSpinner _spinner, FilterDialog _filterDialog, SWEKOperand _operand) {
        operand = _operand;
        filterDialog = _filterDialog;
        spinner = _spinner;
        parameter = _parameter;
        eventType = _eventType;

        setLayout(new BorderLayout());
        setOpaque(false);
        setBackground(Color.white);

        JCheckBox enableButton = new JCheckBox();
        enableButton.addActionListener(e -> toggleEnabled());

        label = new JLabel(parameter.getParameterDisplayName() + ' ' + operand.getStringRepresentation());

        spinner.setEnabled(enabled);
        label.setEnabled(enabled);

        JPanel p = new JPanel(new GridBagLayout());
        GridBagConstraints c = new GridBagConstraints();
        c.gridx = 0;
        c.gridy = 0;
        c.weightx = 0.5;
        p.add(enableButton, c);
        c.gridx = 1;
        p.add(label, c);
        c.gridx = 2;
        p.add(spinner, c);

        add(p, BorderLayout.CENTER);
    }

    public void removeFilter() {
        FilterManager.removeFilters(eventType);
    }<commit_msg>Reduce<commit_after>package org.helioviewer.jhv.plugins.swek.view.filter;

import java.awt.GridBagConstraints;
import java.awt.GridBagLayout;

import javax.swing.JCheckBox;
import javax.swing.JLabel;
import javax.swing.JPanel;
import javax.swing.JSpinner;

import org.helioviewer.jhv.base.conversion.GOESLevel;
import org.helioviewer.jhv.data.cache.SWEKOperand;
import org.helioviewer.jhv.data.event.SWEKEventType;
import org.helioviewer.jhv.data.event.SWEKParam;
import org.helioviewer.jhv.data.event.SWEKParameter;
import org.helioviewer.jhv.plugins.swek.download.FilterManager;
import org.helioviewer.jhv.plugins.swek.view.FilterDialog;

@SuppressWarnings("serial")
public class FilterPanel extends JPanel {

    private final JLabel label;
    private final JSpinner spinner;

    private boolean enabled = false;

    private final SWEKParameter parameter;
    private final SWEKEventType eventType;

    private final FilterDialog filterDialog;
    private final SWEKOperand operand;

    public FilterPanel(SWEKEventType _eventType, SWEKParameter _parameter, JSpinner _spinner, FilterDialog _filterDialog, SWEKOperand _operand) {
        operand = _operand;
        filterDialog = _filterDialog;
        spinner = _spinner;
        parameter = _parameter;
        eventType = _eventType;

        JCheckBox enableButton = new JCheckBox();
        enableButton.addActionListener(e -> toggleEnabled());

        label = new JLabel(parameter.getParameterDisplayName() + ' ' + operand.getStringRepresentation());

        spinner.setEnabled(enabled);
        label.setEnabled(enabled);

        setLayout(new GridBagLayout());
        GridBagConstraints c = new GridBagConstraints();
        c.gridx = 0;
        c.gridy = 0;
        c.weightx = 0.5;
        add(enableButton, c);
        c.gridx = 1;
        add(label, c);
        c.gridx = 2;
        add(spinner, c);
    }

    public void removeFilter() {
        FilterManager.removeFilters(eventType);
    }
{'fraction_non_alphanumeric': 0.09465317919075145, 'fraction_numerical': 0.002890173410404624, 'mean_word_length': 3.4464668094218416, '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': 2, 'profanity_word_list.json': 0, 'sexual_word_list.json': 0, 'zh_pornsignals.json': 0}}
{'dir': 'git-commits-cleaned', 'id': '538215', 'n_tokens_mistral': 1341, 'n_tokens_neox': 1299, 'n_words': 255}