<commit_before>package ui.issuecolumn;

import java.util.ArrayList;
import java.util.Arrays;
import java.util.Comparator;
import java.util.List;
import java.util.function.Predicate;
import java.util.stream.Collectors;

import org.apache.logging.log4j.LogManager;
import org.apache.logging.log4j.Logger;

import backend.interfaces.IModel;
import backend.resource.TurboIssue;
import backend.resource.TurboUser;
import filter.ParseException;
import filter.Parser;
import filter.expression.FilterExpression;
import filter.expression.Qualifier;
import javafx.collections.FXCollections;
import javafx.collections.ObservableList;
import javafx.collections.transformation.FilteredList;
import javafx.collections.transformation.SortedList;
import javafx.collections.transformation.TransformationList;
import javafx.geometry.Insets;
import javafx.geometry.Pos;
import javafx.scene.Node;
import javafx.scene.control.Label;
import javafx.scene.layout.HBox;
import ui.UI;
import ui.components.FilterTextField;
import util.events.ColumnClickedEvent;
import util.events.ModelUpdatedEventHandler;

/**
 * An IssueColumn is a Column meant for containing issues. The main additions to
 * Column are filtering functionality and a list of issues to be maintained.
 * The IssueColumn does not specify how the list is to be displayed -- subclasses
 * override methods which determine that.
 */
public abstract class IssueColumn extends Column {

    private static final Logger logger = LogManager.getLogger(IssueColumn.class.getName());

    // Collection-related

    private ObservableList<TurboIssue> issues = FXCollections.observableArrayList();

    // Filter-related

    private TransformationList<TurboIssue, TurboIssue> transformedIssueList = null;
    protected FilterTextField filterTextField;
    private UI ui;

    private FilterExpression currentFilterExpression = Qualifier.EMPTY;
    private Predicate<TurboIssue> predicate = p -> true;
    private Comparator<TurboIssue> comparator = (a, b) -> 0;

    // This controls whether a metadata update will be triggered on the next refresh.
    // It's toggled to false by model updates that are not supposed to trigger updates.
    // It's toggled to true each time a refresh DOES NOT trigger an update.
    private boolean triggerMetadataUpdate = true;

    public IssueColumn(UI ui, IModel model, ColumnControl parentColumnControl, int columnIndex) {
        super(model, parentColumnControl, columnIndex);
        this.ui = ui;
        getChildren().add(createFilterBox());
//      setupIssueColumnDragEvents(model, columnIndex);
        this.setOnMouseClicked(e-> {
            ui.triggerEvent(new ColumnClickedEvent(columnIndex));
            requestFocus();
        });
        focusedProperty().addListener((unused, wasFocused, isFocused) -> {
            if (isFocused) {
                getStyleClass().add("panel-focused");
            } else {
                getStyleClass().remove("panel-focused");
            }
        });
    }

    private final ModelUpdatedEventHandler onModelUpdate = e -> {

        // Update keywords
        List<String> all = new ArrayList<>(Arrays.asList(Qualifier.KEYWORDS));
        all.addAll(e.model.getUsers().stream()
            .map(TurboUser::getLoginName)
            .collect(Collectors.toList()));

        filterTextField.setKeywords(all);<commit_msg>removed redundant code from IssueColumn<commit_after>package ui.issuecolumn;

import java.util.ArrayList;
import java.util.Arrays;
import java.util.Comparator;
import java.util.List;
import java.util.function.Predicate;
import java.util.stream.Collectors;

import org.apache.logging.log4j.LogManager;
import org.apache.logging.log4j.Logger;

import backend.interfaces.IModel;
import backend.resource.TurboIssue;
import backend.resource.TurboUser;
import filter.ParseException;
import filter.Parser;
import filter.expression.FilterExpression;
import filter.expression.Qualifier;
import javafx.collections.FXCollections;
import javafx.collections.ObservableList;
import javafx.collections.transformation.FilteredList;
import javafx.collections.transformation.SortedList;
import javafx.collections.transformation.TransformationList;
import javafx.geometry.Insets;
import javafx.geometry.Pos;
import javafx.scene.Node;
import javafx.scene.control.Label;
import javafx.scene.layout.HBox;
import ui.UI;
import ui.components.FilterTextField;
import util.events.ColumnClickedEvent;
import util.events.ModelUpdatedEventHandler;

/**
 * An IssueColumn is a Column meant for containing issues. The main additions to
 * Column are filtering functionality and a list of issues to be maintained.
 * The IssueColumn does not specify how the list is to be displayed -- subclasses
 * override methods which determine that.
 */
public abstract class IssueColumn extends Column {

    // Collection-related

    private ObservableList<TurboIssue> issues = FXCollections.observableArrayList();

    // Filter-related

    private TransformationList<TurboIssue, TurboIssue> transformedIssueList = null;
    protected FilterTextField filterTextField;
    private UI ui;

    private FilterExpression currentFilterExpression = Qualifier.EMPTY;
    private Predicate<TurboIssue> predicate = p -> true;
    private Comparator<TurboIssue> comparator = (a, b) -> 0;

    // This controls whether a metadata update will be triggered on the next refresh.
    // It's toggled to false by model updates that are not supposed to trigger updates.
    // It's toggled to true each time a refresh DOES NOT trigger an update.
    private boolean triggerMetadataUpdate = true;

    public IssueColumn(UI ui, IModel model, ColumnControl parentColumnControl, int columnIndex) {
        super(model, parentColumnControl, columnIndex);
        this.ui = ui;
        getChildren().add(createFilterBox());
        this.setOnMouseClicked(e-> {
            ui.triggerEvent(new ColumnClickedEvent(columnIndex));
            requestFocus();
        });
        focusedProperty().addListener((unused, wasFocused, isFocused) -> {
            if (isFocused) {
                getStyleClass().add("panel-focused");
            } else {
                getStyleClass().remove("panel-focused");
            }
        });
    }

    private final ModelUpdatedEventHandler onModelUpdate = e -> {

        // Update keywords
        List<String> all = new ArrayList<>(Arrays.asList(Qualifier.KEYWORDS));
        all.addAll(e.model.getUsers().stream()
            .map(TurboUser::getLoginName)
            .collect(Collectors.toList()));

        filterTextField.setKeywords(all);
{'fraction_non_alphanumeric': 0.08996803166387578, 'fraction_numerical': 0.0009133810321205663, 'mean_word_length': 3.8096632503660324, 'pattern_counts': {'":': 0, '<': 15, '<?xml version=': 0, '>': 25, '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': '1206623', 'n_tokens_mistral': 1752, 'n_tokens_neox': 1709, 'n_words': 465}