INNER CODE UNIT · Kotlin

IndexedMatcher

ReVanced/revanced-patcher · patcher/src/commonMain/kotlin/app/revanced/patcher/Matching.kt:783

class IndexedMatcher<T> : Matcher<T, IndexedMatcherPredicate<T>>() {
    val indices: List<Int>
        field = mutableListOf()

    private var lastMatchedIndex = -1
    private var currentIndex = -1
    private var nextIndex: Int? = null

    override fun invoke(haystack: Iterable<T>): Boolean {
        // Ensure list for indexed access.
        val hay = haystack as? List<T> ?: haystack.toList()

        indices.clear()
        this@IndexedMatcher.lastMatchedIndex = -1
        currentIndex = -1

        data class Frame(
            val patternIndex: Int,

View source record →

📰 Research Paper
Loading…
⏳ Fetching content…