from task import Task

class TaskManager:
    def __init__(self):
        self.tasks = []

    def add_task(self, task_text):
        self.tasks.append(Task(task_text))

    def remove_all_tasks(self):
        self.tasks.clear()

    def remove_task(self, task_id):
        counter = 0
        for task in self.tasks:
            if task.task_id == int(task_id):
                self.tasks.pop(counter)
                break
            counter += 1

    def print_tasks(self):
        for task in self.tasks:
            print(task.task_id, task.task_text, [comment for comment in task.comments])

    def add_task_comment(self, task_id, comment_text):
        for task in self.tasks:
            if task.task_id == int(task_id):
                task.comments.append(comment_text)
                break

    def search(self, filter):
        return [task for task in self.tasks if task.match(filter)]

    def find_task_by_id(self, task_id):
        for task in self.tasks:
            if task.task_id == task_id:
                return task
        return None

from task import Task

class TaskManager:
    def __init__(self):
        self.tasks = []

    def add_task(self, task_text):
        self.tasks.append(Task(task_text))

    def remove_all_tasks(self):
        self.tasks.clear()

    def remove_task(self, task_id):
        counter = 0
        for task in self.tasks:
            if task.task_id == int(task_id):
                self.tasks.pop(counter)
                break
            counter += 1

    def print_tasks(self):
        for task in self.tasks:
            print(task.task_id, task.task_text, [comment for comment in task.comments])

    def add_task_comment(self, task_id, comment_text):
        for task in self.tasks:
            if task.task_id == int(task_id):
                task.comments.append(comment_text)
                break

    def search(self, filter):
        return [task for task in self.tasks if task.match(filter)]

    def find_task_by_id(self, task_id):
        for task in self.tasks:
            if task.task_id == task_id:
                return task
        return None
