<commit_before>package ui.issuepanel;

import backend.resource.*;
import filter.expression.FilterExpression;
import filter.expression.Qualifier;
import github.TurboIssueEvent;
import javafx.geometry.Insets;
import javafx.geometry.Pos;
import javafx.scene.Node;
import javafx.scene.control.Label;
import javafx.scene.image.Image;
import javafx.scene.image.ImageView;
import javafx.scene.layout.FlowPane;
import javafx.scene.layout.HBox;
import javafx.scene.layout.VBox;
import org.eclipse.egit.github.core.Comment;
import ui.issuecolumn.IssueColumn;
import util.Utility;

import java.time.LocalDateTime;
import java.time.temporal.ChronoUnit;
import java.util.HashSet;
import java.util.List;
import java.util.stream.Collectors;

public class IssuePanelCard extends VBox {

    private static final String OCTICON_PULL_REQUEST = "\uf009";
    private static final int CARD_WIDTH = 350;
    private static final String OCTICON_COMMENT = "\uf02b";

    /**
     * A card that is constructed with an issue as argument. Its components
     * are bound to the issue's fields and will update automatically.
     */

    private final TurboIssue issue;
    private final Model model;
    private FlowPane issueDetails = new FlowPane();
    private IssueColumn parentPanel;
    private final HashSet<Integer> issuesWithNewComments;

    public IssuePanelCard(Model model, TurboIssue issue, IssueColumn parentPanel, HashSet<Integer>
        issuesWithNewComments) {
        this.model = model;
        this.issue = issue;
        this.parentPanel = parentPanel;
        this.issuesWithNewComments = issuesWithNewComments;
        setup();
    }

    private void setup() {
        Label issueTitle = new Label("#" + issue.getId() + " " + issue.getTitle());
        issueTitle.setMaxWidth(CARD_WIDTH);
        issueTitle.setWrapText(true);
        issueTitle.getStyleClass().add("issue-panel-name");

        if (issue.isCurrentlyRead()) {
            issueTitle.getStyleClass().add("issue-panel-name-read");
        }

        if (!issue.isOpen()) {
            issueTitle.getStyleClass().add("issue-panel-closed");
        }

        setupIssueDetailsBox();

        setPadding(new Insets(0, 0, 3, 0));
        setSpacing(1);

        getChildren().addAll(issueTitle, issueDetails);

        if (parentPanel.getCurrentFilterExpression().getQualifierNames().contains(Qualifier.UPDATED)) {
            getChildren().add(getEventDisplay(issue,
                getUpdateFilterHours(parentPanel.getCurrentFilterExpression())));
        }
    }

    /**
     * Creates a JavaFX node containing a graphical display of this issue's events.
     * @param withinHours the number of hours to bound the returned events by
     * @return the node
     */
    public Node getEventDisplay(TurboIssue issue, final int withinHours) {
        final LocalDateTime now = LocalDateTime.now();

        List<TurboIssueEvent> eventsWithinDuration = issue.getMetadata().getEvents().stream()
            .filter(event -> {
                LocalDateTime eventTime = Utility.longToLocalDateTime(event.getDate().getTime());
                int hours = Utility.safeLongToInt(eventTime.until(now, ChronoUnit.HOURS));
                return hours < withinHours;
            })<commit_msg>Made getEventDisplay private<commit_after>package ui.issuepanel;

import backend.resource.*;
import filter.expression.FilterExpression;
import filter.expression.Qualifier;
import github.TurboIssueEvent;
import javafx.geometry.Insets;
import javafx.geometry.Pos;
import javafx.scene.Node;
import javafx.scene.control.Label;
import javafx.scene.image.Image;
import javafx.scene.image.ImageView;
import javafx.scene.layout.FlowPane;
import javafx.scene.layout.HBox;
import javafx.scene.layout.VBox;
import org.eclipse.egit.github.core.Comment;
import ui.issuecolumn.IssueColumn;
import util.Utility;

import java.time.LocalDateTime;
import java.time.temporal.ChronoUnit;
import java.util.HashSet;
import java.util.List;
import java.util.stream.Collectors;

public class IssuePanelCard extends VBox {

    private static final String OCTICON_PULL_REQUEST = "\uf009";
    private static final int CARD_WIDTH = 350;
    private static final String OCTICON_COMMENT = "\uf02b";

    /**
     * A card that is constructed with an issue as argument. Its components
     * are bound to the issue's fields and will update automatically.
     */

    private final TurboIssue issue;
    private final Model model;
    private FlowPane issueDetails = new FlowPane();
    private IssueColumn parentPanel;
    private final HashSet<Integer> issuesWithNewComments;

    public IssuePanelCard(Model model, TurboIssue issue, IssueColumn parentPanel, HashSet<Integer>
        issuesWithNewComments) {
        this.model = model;
        this.issue = issue;
        this.parentPanel = parentPanel;
        this.issuesWithNewComments = issuesWithNewComments;
        setup();
    }

    private void setup() {
        Label issueTitle = new Label("#" + issue.getId() + " " + issue.getTitle());
        issueTitle.setMaxWidth(CARD_WIDTH);
        issueTitle.setWrapText(true);
        issueTitle.getStyleClass().add("issue-panel-name");

        if (issue.isCurrentlyRead()) {
            issueTitle.getStyleClass().add("issue-panel-name-read");
        }

        if (!issue.isOpen()) {
            issueTitle.getStyleClass().add("issue-panel-closed");
        }

        setupIssueDetailsBox();

        setPadding(new Insets(0, 0, 3, 0));
        setSpacing(1);

        getChildren().addAll(issueTitle, issueDetails);

        if (parentPanel.getCurrentFilterExpression().getQualifierNames().contains(Qualifier.UPDATED)) {
            getChildren().add(getEventDisplay(issue,
                getUpdateFilterHours(parentPanel.getCurrentFilterExpression())));
        }
    }

    /**
     * Creates a JavaFX node containing a graphical display of this issue's events.
     * @param withinHours the number of hours to bound the returned events by
     * @return the node
     */
    private Node getEventDisplay(TurboIssue issue, final int withinHours) {
        final LocalDateTime now = LocalDateTime.now();

        List<TurboIssueEvent> eventsWithinDuration = issue.getMetadata().getEvents().stream()
            .filter(event -> {
                LocalDateTime eventTime = Utility.longToLocalDateTime(event.getDate().getTime());
                int hours = Utility.safeLongToInt(eventTime.until(now, ChronoUnit.HOURS));
                return hours < withinHours;
            })
{'fraction_non_alphanumeric': 0.10018438844499078, 'fraction_numerical': 0.003995082974800246, 'mean_word_length': 3.240390879478827, 'pattern_counts': {'":': 0, '<': 11, '<?xml version=': 0, '>': 11, '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': '7051658', 'n_tokens_mistral': 1848, 'n_tokens_neox': 1752, 'n_words': 422}