<commit_before>/*
 * Copyright (c) 2019 toastkidjp.
 * All rights reserved. This program and the accompanying materials
 * are made available under the terms of the Eclipse Public License v1.0
 * which accompany this distribution.
 * The Eclipse Public License is available at http://www.eclipse.org/legal/epl-v10.html.
 */
package jp.toastkid.todo.view.board

import jp.toastkid.lib.ContentViewModel
import jp.toastkid.todo.model.TodoTask

/**
 * @author toastkidjp
 */
class TaskClearUseCase(
        private val tasks: MutableList<TodoTask>,
        private val contentViewModel: ContentViewModel,
        private val taskAddingUseCase: TaskAddingUseCase?,
        private val clearBoard: () -> Unit
) {
    operator fun invoke() {
        val keep = mutableListOf<TodoTask>().also {
            it.addAll(tasks)
        }
        tasks.clear()
        clearBoard()
        contentViewModel
                .snackWithAction("Clear all tasks.", "Undo") {
                    keep.forEach { taskAddingUseCase?.invoke(it) }
                }
    }
}<commit_msg>refactor #853 Delete useless classes.<commit_after>/*
 * Copyright (c) 2019 toastkidjp.
 * All rights reserved. This program and the accompanying materials
 * are made available under the terms of the Eclipse Public License v1.0
 * which accompany this distribution.
 * The Eclipse Public License is available at http://www.eclipse.org/legal/epl-v10.html.
 */
package jp.toastkid.todo.view.board

import jp.toastkid.lib.ContentViewModel
import jp.toastkid.todo.model.TodoTask

/**
 * @author toastkidjp
 */
class TaskClearUseCase(
        private val tasks: MutableList<TodoTask>,
        private val contentViewModel: ContentViewModel,
        private val clearBoard: () -> Unit
) {
    operator fun invoke() {
        tasks.clear()
        clearBoard()
        contentViewModel.snackShort("Clear all tasks.")
    }
}
{'fraction_non_alphanumeric': 0.09579563597658329, 'fraction_numerical': 0.010111761575306013, 'mean_word_length': 2.9248434237995826, 'pattern_counts': {'":': 0, '<': 6, '<?xml version=': 0, '>': 8, 'https://': 0, 'lorem ipsum': 0, 'www.': 2, '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': '4740661', 'n_tokens_mistral': 567, 'n_tokens_neox': 521, 'n_words': 152}