<commit_before>package com.agoda.kakao.delegate

import com.agoda.kakao.intercept.Interceptor

/**
 * Base delegate interface.
 *
 * Provides functionality of aggregating interceptors and invoking them on `check`
 * and `perform` invocations.
 *
 * @see Interceptor
 */
interface Delegate<T, C, P> {
    var interaction: T

    fun viewInterceptor(): Interceptor<T, C, P>?
    fun screenInterceptor(): Interceptor<T, C, P>?
    fun kakaoInterceptor(): Interceptor<T, C, P>?

    fun interceptCheck(assertion: C): Boolean {
        interceptors().forEach { interceptor ->
            interceptor.onAll?.let {
                it.second(interaction)
                if (it.first) return true
            }

            interceptor.onCheck?.let {
                it.second(interaction, assertion)
                if (it.first) return true
            }
        }

        return false
    }

    fun interceptPerform(action: P): Boolean {
        interceptors().forEach { interceptor ->
            interceptor.onAll?.let {
                it.second(interaction)
                if (it.first) return true
            }

            interceptor.onPerform?.let {
                it.second(interaction, action)
                if (it.first) return true
            }
        }

        return false
    }

    private fun interceptors(): List<Interceptor<T, C, P>> = mutableListOf<Interceptor<T, C, P>>().also { list ->
        viewInterceptor()?.let { list.add(it) }
        screenInterceptor()?.let { list.add(it) }
        kakaoInterceptor()?.let { list.add(it) }
    }
}<commit_msg>Remove return type form aggregation function<commit_after>package com.agoda.kakao.delegate

import com.agoda.kakao.intercept.Interceptor

/**
 * Base delegate interface.
 *
 * Provides functionality of aggregating interceptors and invoking them on `check`
 * and `perform` invocations.
 *
 * @see Interceptor
 */
interface Delegate<T, C, P> {
    var interaction: T

    fun viewInterceptor(): Interceptor<T, C, P>?
    fun screenInterceptor(): Interceptor<T, C, P>?
    fun kakaoInterceptor(): Interceptor<T, C, P>?

    fun interceptCheck(assertion: C): Boolean {
        interceptors().forEach { interceptor ->
            interceptor.onAll?.let {
                it.second(interaction)
                if (it.first) return true
            }

            interceptor.onCheck?.let {
                it.second(interaction, assertion)
                if (it.first) return true
            }
        }

        return false
    }

    fun interceptPerform(action: P): Boolean {
        interceptors().forEach { interceptor ->
            interceptor.onAll?.let {
                it.second(interaction)
                if (it.first) return true
            }

            interceptor.onPerform?.let {
                it.second(interaction, action)
                if (it.first) return true
            }
        }

        return false
    }

    private fun interceptors() = mutableListOf<Interceptor<T, C, P>>().also { list ->
        viewInterceptor()?.let { list.add(it) }
        screenInterceptor()?.let { list.add(it) }
        kakaoInterceptor()?.let { list.add(it) }
    }
}
{'fraction_non_alphanumeric': 0.11230623220499841, 'fraction_numerical': 0.0, 'mean_word_length': 1.9690140845070423, 'pattern_counts': {'":': 0, '<': 17, '<?xml version=': 0, '>': 23, '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': '5393429', 'n_tokens_mistral': 934, 'n_tokens_neox': 885, 'n_words': 206}