<commit_before>package seedu.manager.model;

import javafx.collections.FXCollections;
import javafx.collections.ObservableList;
import seedu.manager.model.task.ReadOnlyTask;
import seedu.manager.model.task.Task;
import seedu.manager.model.task.Tag;
import seedu.manager.model.task.UniqueTaskList;
import seedu.manager.model.tag.UniqueTagList;

import java.util.*;
import java.util.stream.Collectors;

/**
 * Wraps all data at the task-manager level
 * Duplicates are not allowed (by .equals comparison)
 */
public class TaskManager implements ReadOnlyTaskManager {

    private final UniqueTaskList tasks;
    private final UniqueTagList tags;

    {
        tasks = new UniqueTaskList();
        tags = new UniqueTagList();
    }

    public TaskManager() {}

    /**
     * Tasks are copied into this taskmanager
     */
    public TaskManager(ReadOnlyTaskManager toBeCopied) {
        this(toBeCopied.getUniqueTaskList());
    }

    /**
     * Tasks are copied into this taskmanager
     */
    public TaskManager(UniqueTaskList tasks) {
        resetData(tasks.getInternalList());
    }

    public static ReadOnlyTaskManager getEmptyTaskManager() {
        return new TaskManager();
    }

//// list overwrite operations

    public ObservableList<Task> getTasks() {
        return tasks.getInternalList();
    }
    
    // @@author A0148042M
    public ObservableList<Tag> getTags() {
//         return tags.getInternalList();
        return getTagsFromTaskList(this.getTasks());
    }
    
    public ObservableList<Tag> getTagsFromTaskList(ObservableList<Task> taskList) {
        ObservableList<Tag> tagList = FXCollections.observableArrayList();
        for(int i = 0;i < taskList.size();i++) {
            if(taskList.get(i).getTag().isPresent()) {<commit_msg>Tag list can work in add command.<commit_after>package seedu.manager.model;

import javafx.collections.FXCollections;
import javafx.collections.ObservableList;
import seedu.manager.model.task.ReadOnlyTask;
import seedu.manager.model.task.Task;
import seedu.manager.model.task.Tag;
import seedu.manager.model.task.UniqueTaskList;
import seedu.manager.model.tag.UniqueTagList;

import java.util.*;
import java.util.stream.Collectors;

/**
 * Wraps all data at the task-manager level
 * Duplicates are not allowed (by .equals comparison)
 */
public class TaskManager implements ReadOnlyTaskManager {

    private final UniqueTaskList tasks;
    private final UniqueTagList tags;

    {
        tasks = new UniqueTaskList();
        tags = new UniqueTagList();
    }

    public TaskManager() {}

    /**
     * Tasks are copied into this taskmanager
     */
    public TaskManager(ReadOnlyTaskManager toBeCopied) {
        this(toBeCopied.getUniqueTaskList());
    }

    /**
     * Tasks are copied into this taskmanager
     */
    public TaskManager(UniqueTaskList tasks) {
        resetData(tasks.getInternalList());
    }

    public static ReadOnlyTaskManager getEmptyTaskManager() {
        return new TaskManager();
    }

//// list overwrite operations

    public ObservableList<Task> getTasks() {
        return tasks.getInternalList();
    }
    
    // @@author A0148042M
    public ObservableList<Tag> getTags() {
        ObservableList<Tag> internalTagList = tags.getInternalList();
        ObservableList<Tag> tagListFromTaskList = getTagsFromTaskList(this.getTasks());
        
        return combineTwoList(internalTagList, tagListFromTaskList);
    }
    
    public ObservableList<Tag> combineTwoList(ObservableList<Tag> internalTagList, ObservableList<Tag> tagListFromTaskList) {
        ObservableList<Tag> combinedTagList = internalTagList;
        for(int i = 0;i < tagListFromTaskList.size();i++) {
            if(!internalTagList.contains(tagListFromTaskList.get(i))) {
                internalTagList.add(tagListFromTaskList.get(i));
            }
        }
        
        return combinedTagList;
    }
    
    public ObservableList<Tag> getTagsFromTaskList(ObservableList<Task> taskList) {
        ObservableList<Tag> tagList = FXCollections.observableArrayList();
        for(int i = 0;i < taskList.size();i++) {
            if(taskList.get(i).getTag().isPresent()) {
{'fraction_non_alphanumeric': 0.10266250899496282, 'fraction_numerical': 0.004077716478771888, 'mean_word_length': 3.246435845213849, 'pattern_counts': {'":': 0, '<': 22, '<?xml version=': 0, '>': 19, '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': '3395487', 'n_tokens_mistral': 1205, 'n_tokens_neox': 1173, 'n_words': 250}