<commit_before>package guitests.guihandles;

import java.util.HashSet;
import java.util.List;
import java.util.stream.Collectors;

import guitests.GuiRobot;
import javafx.scene.Node;
import javafx.scene.control.Labeled;
import javafx.scene.layout.Region;
import javafx.stage.Stage;
import seedu.address.model.tag.UniqueTagList;
import seedu.address.model.task.ReadOnlyTask;

/**
 * Provides a handle to a task card in the task list panel.
 */
public class TaskCardHandle extends GuiHandle {
    private static final String NAME_FIELD_ID = "#name";
    private static final String DEADLINE_FIELD_ID = "#deadline";
    private static final String DESCRIPTION_FIELD_ID = "#description";
    private static final String ID_FIELD_ID = "#id";
    private static final String TAGS_FIELD_ID = "#tags";

    private Node node;

    public TaskCardHandle(GuiRobot guiRobot, Stage primaryStage, Node node) {
        super(guiRobot, primaryStage, null);
        this.node = node;
    }

    protected String getTextFromLabel(String fieldId) {
        return getTextFromLabel(fieldId, node);
    }

    public String getName() {
        return getTextFromLabel(NAME_FIELD_ID);
    }

    public String getDeadline() {
        return getTextFromLabel(DEADLINE_FIELD_ID);
    }

    public String getDescription() {
        return getTextFromLabel(DESCRIPTION_FIELD_ID);
    }

    public String getID() {
        return getTextFromLabel(ID_FIELD_ID);
    }

    public List<String> getTags() {
        return getTags(getTagsContainer());
    }

    private List<String> getTags(Region tagsContainer) {
        return tagsContainer
                .getChildrenUnmodifiable()
                .stream()
                .map(node -> ((Labeled) node).getText())
                .collect(Collectors.toList());
    }

    private List<String> getTags(UniqueTagList tags) {
        return tags
                .asObservableList()
                .stream()
                .map(tag -> tag.tagName)
                .collect(Collectors.toList());
    }

    private Region getTagsContainer() {
        return guiRobot.from(node).lookup(TAGS_FIELD_ID).query();
    }

    public boolean isSameTask(ReadOnlyTask task) {
        /*System.out.println(getID() + task.getID().toString());
        System.out.println(getName() + task.getName().toString());
        System.out.println(getDeadline() + task.getDeadline().toString());
        System.out.println(getDescription() + task.getDescription().toString());
        System.out.println(getTags());
        System.out.println(getTags(task.getTags()));*/
        return getName().equals(task.getName().toString())
                && getDeadline().equals(task.getDeadline().toString())
                && getDescription().equals(task.getDescription().toString())
                && getID().equals(task.getID().toString())
                && compareStringListOrderInsensitive(getTags(), getTags(task.getTags()));
    }

    @Override
    public boolean equals(Object obj) {
        if (obj instanceof TaskCardHandle) {
            TaskCardHandle handle = (TaskCardHandle) obj;
            return getName().equals(handle.getName())
                    && getDeadline().equals(handle.getDeadline())
                    && getDescription().equals(handle.getDescription())
                    && getID().equals(handle.getID())
                    && compareStringListOrderInsensitive(getTags(), getTags(handle.getTags()));
        }
        return super.equals(obj);
    }

    public boolean compareStringListOrderInsensitive(List<String> list1, List<String> list2) {
        return list1 == list2 || new HashSet<>(list1).equals(new HashSet<>(list2));
    }

    @Override
    public String toString() {
        return getName() + " " + getID();
    }
}<commit_msg>Fix tags compare in equals method in TaskCardHandle<commit_after>package guitests.guihandles;

import java.util.HashSet;
import java.util.List;
import java.util.stream.Collectors;

import guitests.GuiRobot;
import javafx.scene.Node;
import javafx.scene.control.Labeled;
import javafx.scene.layout.Region;
import javafx.stage.Stage;
import seedu.address.model.tag.UniqueTagList;
import seedu.address.model.task.ReadOnlyTask;

/**
 * Provides a handle to a task card in the task list panel.
 */
public class TaskCardHandle extends GuiHandle {
    private static final String NAME_FIELD_ID = "#name";
    private static final String DEADLINE_FIELD_ID = "#deadline";
    private static final String DESCRIPTION_FIELD_ID = "#description";
    private static final String ID_FIELD_ID = "#id";
    private static final String TAGS_FIELD_ID = "#tags";

    private Node node;

    public TaskCardHandle(GuiRobot guiRobot, Stage primaryStage, Node node) {
        super(guiRobot, primaryStage, null);
        this.node = node;
    }

    protected String getTextFromLabel(String fieldId) {
        return getTextFromLabel(fieldId, node);
    }

    public String getName() {
        return getTextFromLabel(NAME_FIELD_ID);
    }

    public String getDeadline() {
        return getTextFromLabel(DEADLINE_FIELD_ID);
    }

    public String getDescription() {
        return getTextFromLabel(DESCRIPTION_FIELD_ID);
    }

    public String getID() {
        return getTextFromLabel(ID_FIELD_ID);
    }

    public List<String> getTags() {
        return getTags(getTagsContainer());
    }

    private List<String> getTags(Region tagsContainer) {
        return tagsContainer
                .getChildrenUnmodifiable()
                .stream()
                .map(node -> ((Labeled) node).getText())
                .collect(Collectors.toList());
    }

    private List<String> getTags(UniqueTagList tags) {
        return tags
                .asObservableList()
                .stream()
                .map(tag -> tag.tagName)
                .collect(Collectors.toList());
    }

    private Region getTagsContainer() {
        return guiRobot.from(node).lookup(TAGS_FIELD_ID).query();
    }

    public boolean isSameTask(ReadOnlyTask task) {
        /*System.out.println(getID() + task.getID().toString());
        System.out.println(getName() + task.getName().toString());
        System.out.println(getDeadline() + task.getDeadline().toString());
        System.out.println(getDescription() + task.getDescription().toString());
        System.out.println(getTags());
        System.out.println(getTags(task.getTags()));*/
        return getName().equals(task.getName().toString())
                && getDeadline().equals(task.getDeadline().toString())
                && getDescription().equals(task.getDescription().toString())
                && getID().equals(task.getID().toString())
                && compareStringListOrderInsensitive(getTags(), getTags(task.getTags()));
    }

    @Override
    public boolean equals(Object obj) {
        if (obj instanceof TaskCardHandle) {
            TaskCardHandle handle = (TaskCardHandle) obj;
            return getName().equals(handle.getName())
                    && getDeadline().equals(handle.getDeadline())
                    && getDescription().equals(handle.getDescription())
                    && getID().equals(handle.getID())
                    && compareStringListOrderInsensitive(getTags(), handle.getTags());
        }
        return super.equals(obj);
    }

    public boolean compareStringListOrderInsensitive(List<String> list1, List<String> list2) {
        return list1 == list2 || new HashSet<>(list1).equals(new HashSet<>(list2));
    }

    @Override
    public String toString() {
        return getName() + " " + getID();
    }
}
{'fraction_non_alphanumeric': 0.1204374752931875, 'fraction_numerical': 0.0015812359994729214, 'mean_word_length': 2.757425742574257, 'pattern_counts': {'":': 0, '<': 17, '<?xml version=': 0, '>': 21, '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': '5826929', 'n_tokens_mistral': 2119, 'n_tokens_neox': 2057, 'n_words': 419}