package nl.tudelft.hyperion.plugin.metric

/**
 * Represents an element as the result of an /api/v1/metrics API call.
 * Contains the aggregated log counts over the specified interval, i.e.
 * an interval of 60 represents the logs that happened in the last minute.
 */
data class APIMetricsResult(
    val interval: Int,
    /**
     * A mapping of version to a List of Metrics (all metrics relative to this version).
     * The version is represented by a String.
     */
    val versions: Map<String, List<APIMetric>>
)

/**
 * Represents the response from an /api/v1/metrics/period API call.
 *
 * @param T signifies if this is project wide or file specific bin metrics.
 * @property interval the time in seconds between each [APIBinMetricsResult].
 * @property results a list of metrics for each interval which contains a map
 *  of versions and corresponding line metrics.
 */
data class APIBinMetricsResponse<T : BaseAPIMetric>(
    val interval: Int,
    val results: List<APIBinMetricsResult<T>>
) {
    fun filterVersion(version: String, lineNumber: Int) =
        results.map { it.filterVersion(version, lineNumber) }
}

/**
 * Represents an element as the result of an /api/v1/metrics/period API call.
 * The API call returns a list of bins where each bin is the aggregated log
 * counts starting from the given start time.
 *
 * @param T signifies if this is project wide or file specific bin metrics.
 * @property startTime unix epoch time in seconds of the starting time of this
 *  bin.
 * @property versions map of version identifier with metrics.
 */
data class APIBinMetricsResult<T : BaseAPIMetric>(
    val startTime: Int,
    val versions: MutableMap<String, List<T>>
) {
    fun filterVersion(version: String, lineNumber: Int) {
        if (version in versions) {
            versions[version] = versions[version]?.filter { it.line == lineNumber }!!
        }
    }
}

/**
 * The base class for all metrics.
 *
 * @property line the log line for which this metrics was triggered.
 * @property severity the log severity of this log line.
 * @property count the number of times this line has been triggered.
 */
sealed class BaseAPIMetric(
    open val line: Int,
    open val severity: String,
    open val count: Int
)

/**
 * Represents a single grouped metric of a (project, file, line, version,
 * severity) tuple. Contains the line for which it was triggered, the
 * severity of the log and the amount of times that specific log was
 * triggered.
 */
data class APIMetric(
    override val line: Int,
    override val severity: String,
    override val count: Int
) : BaseAPIMetric(line, severity, count)

/**
 * Represents a single grouped metric of a (project, file, line, version,
 * severity) tuple. Contains the line for which it was triggered, the
 * severity of the log and the amount of times that specific log was
 * triggered.
 */
data class FileAPIMetric(
    override val line: Int,
    override val severity: String,
    override val count: Int,
    val file: String
) : BaseAPIMetric(line, severity, count)

Compiled from "APIMetric.kt"
public final class nl.tudelft.hyperion.plugin.metric.APIMetric extends nl.tudelft.hyperion.plugin.metric.BaseAPIMetric {
  private final int line;

  private final java.lang.String severity;

  private final int count;

  public nl.tudelft.hyperion.plugin.metric.APIMetric(int, java.lang.String, int);
    Code:
       0: aload_2
       1: ldc           #9                  // String severity
       3: invokestatic  #15                 // Method kotlin/jvm/internal/Intrinsics.checkNotNullParameter:(Ljava/lang/Object;Ljava/lang/String;)V
       6: aload_0
       7: iload_1
       8: aload_2
       9: iload_3
      10: aconst_null
      11: invokespecial #18                 // Method nl/tudelft/hyperion/plugin/metric/BaseAPIMetric."<init>":(ILjava/lang/String;ILkotlin/jvm/internal/DefaultConstructorMarker;)V
      14: aload_0
      15: iload_1
      16: putfield      #22                 // Field line:I
      19: aload_0
      20: aload_2
      21: putfield      #25                 // Field severity:Ljava/lang/String;
      24: aload_0
      25: iload_3
      26: putfield      #28                 // Field count:I
      29: return

  public int getLine();
    Code:
       0: aload_0
       1: getfield      #22                 // Field line:I
       4: ireturn

  public java.lang.String getSeverity();
    Code:
       0: aload_0
       1: getfield      #25                 // Field severity:Ljava/lang/String;
       4: areturn

  public int getCount();
    Code:
       0: aload_0
       1: getfield      #28                 // Field count:I
       4: ireturn

  public final int component1();
    Code:
       0: aload_0
       1: getfield      #22                 // Field line:I
       4: ireturn

  public final java.lang.String component2();
    Code:
       0: aload_0
       1: getfield      #25                 // Field severity:Ljava/lang/String;
       4: areturn

  public final int component3();
    Code:
       0: aload_0
       1: getfield      #28                 // Field count:I
       4: ireturn

  public final nl.tudelft.hyperion.plugin.metric.APIMetric copy(int, java.lang.String, int);
    Code:
       0: aload_2
       1: ldc           #9                  // String severity
       3: invokestatic  #15                 // Method kotlin/jvm/internal/Intrinsics.checkNotNullParameter:(Ljava/lang/Object;Ljava/lang/String;)V
       6: new           #2                  // class nl/tudelft/hyperion/plugin/metric/APIMetric
       9: dup
      10: iload_1
      11: aload_2
      12: iload_3
      13: invokespecial #42                 // Method "<init>":(ILjava/lang/String;I)V
      16: areturn

  public static nl.tudelft.hyperion.plugin.metric.APIMetric copy$default(nl.tudelft.hyperion.plugin.metric.APIMetric, int, java.lang.String, int, int, java.lang.Object);
    Code:
       0: iload         4
       2: iconst_1
       3: iand
       4: ifeq          12
       7: aload_0
       8: getfield      #22                 // Field line:I
      11: istore_1
      12: iload         4
      14: iconst_2
      15: iand
      16: ifeq          24
      19: aload_0
      20: getfield      #25                 // Field severity:Ljava/lang/String;
      23: astore_2
      24: iload         4
      26: iconst_4
      27: iand
      28: ifeq          36
      31: aload_0
      32: getfield      #28                 // Field count:I
      35: istore_3
      36: aload_0
      37: iload_1
      38: aload_2
      39: iload_3
      40: invokevirtual #46                 // Method copy:(ILjava/lang/String;I)Lnl/tudelft/hyperion/plugin/metric/APIMetric;
      43: areturn

  public java.lang.String toString();
    Code:
       0: new           #49                 // class java/lang/StringBuilder
       3: dup
       4: invokespecial #52                 // Method java/lang/StringBuilder."<init>":()V
       7: ldc           #54                 // String APIMetric(line=
       9: invokevirtual #58                 // Method java/lang/StringBuilder.append:(Ljava/lang/String;)Ljava/lang/StringBuilder;
      12: aload_0
      13: getfield      #22                 // Field line:I
      16: invokevirtual #61                 // Method java/lang/StringBuilder.append:(I)Ljava/lang/StringBuilder;
      19: ldc           #63                 // String , severity=
      21: invokevirtual #58                 // Method java/lang/StringBuilder.append:(Ljava/lang/String;)Ljava/lang/StringBuilder;
      24: aload_0
      25: getfield      #25                 // Field severity:Ljava/lang/String;
      28: invokevirtual #58                 // Method java/lang/StringBuilder.append:(Ljava/lang/String;)Ljava/lang/StringBuilder;
      31: ldc           #65                 // String , count=
      33: invokevirtual #58                 // Method java/lang/StringBuilder.append:(Ljava/lang/String;)Ljava/lang/StringBuilder;
      36: aload_0
      37: getfield      #28                 // Field count:I
      40: invokevirtual #61                 // Method java/lang/StringBuilder.append:(I)Ljava/lang/StringBuilder;
      43: bipush        41
      45: invokevirtual #68                 // Method java/lang/StringBuilder.append:(C)Ljava/lang/StringBuilder;
      48: invokevirtual #70                 // Method java/lang/StringBuilder.toString:()Ljava/lang/String;
      51: areturn

  public int hashCode();
    Code:
       0: aload_0
       1: getfield      #22                 // Field line:I
       4: invokestatic  #76                 // Method java/lang/Integer.hashCode:(I)I
       7: istore_1
       8: iload_1
       9: bipush        31
      11: imul
      12: aload_0
      13: getfield      #25                 // Field severity:Ljava/lang/String;
      16: invokevirtual #80                 // Method java/lang/String.hashCode:()I
      19: iadd
      20: istore_1
      21: iload_1
      22: bipush        31
      24: imul
      25: aload_0
      26: getfield      #28                 // Field count:I
      29: invokestatic  #76                 // Method java/lang/Integer.hashCode:(I)I
      32: iadd
      33: istore_1
      34: iload_1
      35: ireturn

  public boolean equals(java.lang.Object);
    Code:
       0: aload_0
       1: aload_1
       2: if_acmpne     7
       5: iconst_1
       6: ireturn
       7: aload_1
       8: instanceof    #2                  // class nl/tudelft/hyperion/plugin/metric/APIMetric
      11: ifne          16
      14: iconst_0
      15: ireturn
      16: aload_1
      17: checkcast     #2                  // class nl/tudelft/hyperion/plugin/metric/APIMetric
      20: astore_2
      21: aload_0
      22: getfield      #22                 // Field line:I
      25: aload_2
      26: getfield      #22                 // Field line:I
      29: if_icmpeq     34
      32: iconst_0
      33: ireturn
      34: aload_0
      35: getfield      #25                 // Field severity:Ljava/lang/String;
      38: aload_2
      39: getfield      #25                 // Field severity:Ljava/lang/String;
      42: invokestatic  #88                 // Method kotlin/jvm/internal/Intrinsics.areEqual:(Ljava/lang/Object;Ljava/lang/Object;)Z
      45: ifne          50
      48: iconst_0
      49: ireturn
      50: aload_0
      51: getfield      #28                 // Field count:I
      54: aload_2
      55: getfield      #28                 // Field count:I
      58: if_icmpeq     63
      61: iconst_0
      62: ireturn
      63: iconst_1
      64: ireturn
}


package com.seanshubin.condorcet.backend.domain

import kotlin.math.max
import kotlin.random.Random

data class Ranking(val candidateName: String, val rank: Int?) {
    companion object {
        fun List<Ranking>.prefers(a: String, b: String): Boolean =
            rankingFor(a) < rankingFor(b)

        private fun List<Ranking>.rankingFor(candiateName: String): Int =
            find { ranking -> ranking.candidateName == candiateName }?.rank ?: Int.MAX_VALUE

        fun List<Ranking>.listToString() =
            joinToString(" ") { (candidateName, rank) -> "$rank $candidateName" }

        fun List<Ranking>.voterBiasedOrdering(random: Random): List<Ranking> {
            val rankAscending = Comparator<Ranking> { o1, o2 ->
                val rank1 = o1?.rank ?: Int.MAX_VALUE
                val rank2 = o2?.rank ?: Int.MAX_VALUE
                rank1.compareTo(rank2)
            }
            val grouped = groupBy { it.rank }
            val groupedValues = grouped.values
            val shuffled = groupedValues.flatMap { it.shuffled(random) }
            val sorted = shuffled.sortedWith(rankAscending)
            return sorted
        }

        fun List<Ranking>.addMissingCandidates(allCandidates: List<String>): List<Ranking> {
            val existingCandidates = this.map { it.candidateName }
            val isMissing = { candidate: String -> !existingCandidates.contains(candidate) }
            val missingCandidates = allCandidates.filter(isMissing)
            val newRankings = missingCandidates.map { Ranking(it, null) }
            return this + newRankings
        }

        fun List<Ranking>.normalizeRankingsReplaceNulls(): List<Ranking> {
            val distinctOrderedRanks = this.mapNotNull { it.rank }.distinct().sorted()
            val normalized = (1..distinctOrderedRanks.size)
            val newRankMap = distinctOrderedRanks.zip(normalized).toMap()
            val lastRank = distinctOrderedRanks.size + 1
            val result = map { (name, rank) ->
                val newRank = newRankMap[rank] ?: lastRank
                Ranking(name, newRank)
            }
            return result
        }

        fun List<Ranking>.normalizeRankingsKeepNulls(): List<Ranking> {
            val distinctOrderedRanks = this.mapNotNull { it.rank }.distinct().sorted()
            val normalized = (1..distinctOrderedRanks.size)
            val newRankMap = distinctOrderedRanks.zip(normalized).toMap()
            val result = map { (name, rank) ->
                val newRank = newRankMap[rank]
                Ranking(name, newRank)
            }
            return result
        }

        fun List<Ranking>.effectiveRankings(candidateNames: List<String>): List<Ranking> =
            addMissingCandidates(candidateNames).normalizeRankingsReplaceNulls()

        fun List<Ranking>.matchOrderToCandidates(candidateNames: List<String>): List<Ranking> {
            val byCandidate = this.associateBy { it.candidateName }
            return candidateNames.map { byCandidate.getValue(it) }
        }

        object RankingListComparator : Comparator<List<Ranking>> {
            override fun compare(firstRankingList: List<Ranking>, secondRankingList: List<Ranking>): Int {
                val firstRankList = firstRankingList.mapNotNull { it.rank }
                val secondRankList = secondRankingList.mapNotNull { it.rank }
                return RankListComparator.compare(firstRankList, secondRankList)
            }
        }

        object RankListComparator : Comparator<List<Int>> {
            override fun compare(firstList: List<Int>, secondList: List<Int>): Int {
                val maxSize = max(firstList.size, secondList.size)
                var compareResult = 0
                var index = 0
                while (index < maxSize) {
                    val firstValue = firstList[index]
                    val secondValue = secondList[index]
                    compareResult = RankComparator.compare(firstValue, secondValue)
                    if (compareResult != 0) break
                    index++
                }
                return compareResult
            }
        }

        object RankComparator : Comparator<Int> {
            override fun compare(first: Int, second: Int): Int = first.compareTo(second)
        }
    }
}

Compiled from "Ranking.kt"
public final class com.seanshubin.condorcet.backend.domain.Ranking$Companion {
  private com.seanshubin.condorcet.backend.domain.Ranking$Companion();
    Code:
       0: aload_0
       1: invokespecial #8                  // Method java/lang/Object."<init>":()V
       4: return

  public final boolean prefers(java.util.List<com.seanshubin.condorcet.backend.domain.Ranking>, java.lang.String, java.lang.String);
    Code:
       0: aload_1
       1: ldc           #16                 // String <this>
       3: invokestatic  #22                 // Method kotlin/jvm/internal/Intrinsics.checkNotNullParameter:(Ljava/lang/Object;Ljava/lang/String;)V
       6: aload_2
       7: ldc           #24                 // String a
       9: invokestatic  #22                 // Method kotlin/jvm/internal/Intrinsics.checkNotNullParameter:(Ljava/lang/Object;Ljava/lang/String;)V
      12: aload_3
      13: ldc           #26                 // String b
      15: invokestatic  #22                 // Method kotlin/jvm/internal/Intrinsics.checkNotNullParameter:(Ljava/lang/Object;Ljava/lang/String;)V
      18: aload_0
      19: aload_1
      20: aload_2
      21: invokespecial #30                 // Method rankingFor:(Ljava/util/List;Ljava/lang/String;)I
      24: aload_0
      25: aload_1
      26: aload_3
      27: invokespecial #30                 // Method rankingFor:(Ljava/util/List;Ljava/lang/String;)I
      30: if_icmpge     37
      33: iconst_1
      34: goto          38
      37: iconst_0
      38: ireturn

  private final int rankingFor(java.util.List<com.seanshubin.condorcet.backend.domain.Ranking>, java.lang.String);
    Code:
       0: aload_1
       1: checkcast     #36                 // class java/lang/Iterable
       4: astore_3
       5: aload_3
       6: invokeinterface #40,  1           // InterfaceMethod java/lang/Iterable.iterator:()Ljava/util/Iterator;
      11: astore        4
      13: aload         4
      15: invokeinterface #46,  1           // InterfaceMethod java/util/Iterator.hasNext:()Z
      20: ifeq          59
      23: aload         4
      25: invokeinterface #50,  1           // InterfaceMethod java/util/Iterator.next:()Ljava/lang/Object;
      30: astore        5
      32: aload         5
      34: checkcast     #52                 // class com/seanshubin/condorcet/backend/domain/Ranking
      37: astore        6
      39: iconst_0
      40: istore        7
      42: aload         6
      44: invokevirtual #56                 // Method com/seanshubin/condorcet/backend/domain/Ranking.getCandidateName:()Ljava/lang/String;
      47: aload_2
      48: invokestatic  #60                 // Method kotlin/jvm/internal/Intrinsics.areEqual:(Ljava/lang/Object;Ljava/lang/Object;)Z
      51: ifeq          13
      54: aload         5
      56: goto          60
      59: aconst_null
      60: checkcast     #52                 // class com/seanshubin/condorcet/backend/domain/Ranking
      63: dup
      64: ifnull        80
      67: invokevirtual #64                 // Method com/seanshubin/condorcet/backend/domain/Ranking.getRank:()Ljava/lang/Integer;
      70: dup
      71: ifnull        80
      74: invokevirtual #70                 // Method java/lang/Integer.intValue:()I
      77: goto          83
      80: pop
      81: ldc           #71                 // int 2147483647
      83: ireturn

  public final java.lang.String listToString(java.util.List<com.seanshubin.condorcet.backend.domain.Ranking>);
    Code:
       0: aload_1
       1: ldc           #16                 // String <this>
       3: invokestatic  #22                 // Method kotlin/jvm/internal/Intrinsics.checkNotNullParameter:(Ljava/lang/Object;Ljava/lang/String;)V
       6: aload_1
       7: checkcast     #36                 // class java/lang/Iterable
      10: ldc           #82                 // String
      12: checkcast     #84                 // class java/lang/CharSequence
      15: aconst_null
      16: aconst_null
      17: iconst_0
      18: aconst_null
      19: invokedynamic #103,  0            // InvokeDynamic #0:invoke:()Lkotlin/jvm/functions/Function1;
      24: bipush        30
      26: aconst_null
      27: invokestatic  #109                // Method kotlin/collections/CollectionsKt.joinToString$default:(Ljava/lang/Iterable;Ljava/lang/CharSequence;Ljava/lang/CharSequence;Ljava/lang/CharSequence;ILjava/lang/CharSequence;Lkotlin/jvm/functions/Function1;ILjava/lang/Object;)Ljava/lang/String;
      30: areturn

  public final java.util.List<com.seanshubin.condorcet.backend.domain.Ranking> voterBiasedOrdering(java.util.List<com.seanshubin.condorcet.backend.domain.Ranking>, kotlin.random.Random);
    Code:
       0: aload_1
       1: ldc           #16                 // String <this>
       3: invokestatic  #22                 // Method kotlin/jvm/internal/Intrinsics.checkNotNullParameter:(Ljava/lang/Object;Ljava/lang/String;)V
       6: aload_2
       7: ldc           #115                // String random
       9: invokestatic  #22                 // Method kotlin/jvm/internal/Intrinsics.checkNotNullParameter:(Ljava/lang/Object;Ljava/lang/String;)V
      12: invokedynamic #127,  0            // InvokeDynamic #1:compare:()Ljava/util/Comparator;
      17: astore_3
      18: aload_1
      19: checkcast     #36                 // class java/lang/Iterable
      22: astore        5
      24: iconst_0
      25: istore        6
      27: aload         5
      29: astore        7
      31: new           #129                // class java/util/LinkedHashMap
      34: dup
      35: invokespecial #130                // Method java/util/LinkedHashMap."<init>":()V
      38: checkcast     #132                // class java/util/Map
      41: astore        8
      43: iconst_0
      44: istore        9
      46: aload         7
      48: invokeinterface #40,  1           // InterfaceMethod java/lang/Iterable.iterator:()Ljava/util/Iterator;
      53: astore        10
      55: aload         10
      57: invokeinterface #46,  1           // InterfaceMethod java/util/Iterator.hasNext:()Z
      62: ifeq          167
      65: aload         10
      67: invokeinterface #50,  1           // InterfaceMethod java/util/Iterator.next:()Ljava/lang/Object;
      72: astore        11
      74: aload         11
      76: checkcast     #52                 // class com/seanshubin/condorcet/backend/domain/Ranking
      79: astore        12
      81: iconst_0
      82: istore        13
      84: aload         12
      86: invokevirtual #64                 // Method com/seanshubin/condorcet/backend/domain/Ranking.getRank:()Ljava/lang/Integer;
      89: astore        14
      91: aload         8
      93: astore        15
      95: iconst_0
      96: istore        16
      98: aload         15
     100: aload         14
     102: invokeinterface #135,  2          // InterfaceMethod java/util/Map.get:(Ljava/lang/Object;)Ljava/lang/Object;
     107: astore        17
     109: aload         17
     111: ifnonnull     146
     114: iconst_0
     115: istore        18
     117: new           #137                // class java/util/ArrayList
     120: dup
     121: invokespecial #138                // Method java/util/ArrayList."<init>":()V
     124: checkcast     #140                // class java/util/List
     127: astore        18
     129: aload         15
     131: aload         14
     133: aload         18
     135: invokeinterface #144,  3          // InterfaceMethod java/util/Map.put:(Ljava/lang/Object;Ljava/lang/Object;)Ljava/lang/Object;
     140: pop
     141: aload         18
     143: goto          148
     146: aload         17
     148: nop
     149: checkcast     #140                // class java/util/List
     152: astore        12
     154: aload         12
     156: aload         11
     158: invokeinterface #148,  2          // InterfaceMethod java/util/List.add:(Ljava/lang/Object;)Z
     163: pop
     164: goto          55
     167: aload         8
     169: nop
     170: astore        4
     172: aload         4
     174: invokeinterface #152,  1          // InterfaceMethod java/util/Map.values:()Ljava/util/Collection;
     179: astore        5
     181: aload         5
     183: checkcast     #36                 // class java/lang/Iterable
     186: astore        7
     188: iconst_0
     189: istore        8
     191: aload         7
     193: astore        9
     195: new           #137                // class java/util/ArrayList
     198: dup
     199: invokespecial #138                // Method java/util/ArrayList."<init>":()V
     202: checkcast     #154                // class java/util/Collection
     205: astore        10
     207: iconst_0
     208: istore        11
     210: aload         9
     212: invokeinterface #40,  1           // InterfaceMethod java/lang/Iterable.iterator:()Ljava/util/Iterator;
     217: astore        12
     219: aload         12
     221: invokeinterface #46,  1           // InterfaceMethod java/util/Iterator.hasNext:()Z
     226: ifeq          273
     229: aload         12
     231: invokeinterface #50,  1           // InterfaceMethod java/util/Iterator.next:()Ljava/lang/Object;
     236: astore        13
     238: aload         13
     240: checkcast     #140                // class java/util/List
     243: astore        14
     245: iconst_0
     246: istore        15
     248: aload         14
     250: checkcast     #36                 // class java/lang/Iterable
     253: aload_2
     254: invokestatic  #158                // Method kotlin/collections/CollectionsKt.shuffled:(Ljava/lang/Iterable;Lkotlin/random/Random;)Ljava/util/List;
     257: checkcast     #36                 // class java/lang/Iterable
     260: astore        14
     262: aload         10
     264: aload         14
     266: invokestatic  #162                // Method kotlin/collections/CollectionsKt.addAll:(Ljava/util/Collection;Ljava/lang/Iterable;)Z
     269: pop
     270: goto          219
     273: aload         10
     275: checkcast     #140                // class java/util/List
     278: nop
     279: astore        6
     281: aload         6
     283: checkcast     #36                 // class java/lang/Iterable
     286: aload_3
     287: invokestatic  #166                // Method kotlin/collections/CollectionsKt.sortedWith:(Ljava/lang/Iterable;Ljava/util/Comparator;)Ljava/util/List;
     290: astore        7
     292: aload         7
     294: areturn

  public final java.util.List<com.seanshubin.condorcet.backend.domain.Ranking> addMissingCandidates(java.util.List<com.seanshubin.condorcet.backend.domain.Ranking>, java.util.List<java.lang.String>);
    Code:
       0: aload_1
       1: ldc           #16                 // String <this>
       3: invokestatic  #22                 // Method kotlin/jvm/internal/Intrinsics.checkNotNullParameter:(Ljava/lang/Object;Ljava/lang/String;)V
       6: aload_2
       7: ldc           #206                // String allCandidates
       9: invokestatic  #22                 // Method kotlin/jvm/internal/Intrinsics.checkNotNullParameter:(Ljava/lang/Object;Ljava/lang/String;)V
      12: aload_1
      13: checkcast     #36                 // class java/lang/Iterable
      16: astore        4
      18: iconst_0
      19: istore        5
      21: aload         4
      23: astore        6
      25: new           #137                // class java/util/ArrayList
      28: dup
      29: aload         4
      31: bipush        10
      33: invokestatic  #210                // Method kotlin/collections/CollectionsKt.collectionSizeOrDefault:(Ljava/lang/Iterable;I)I
      36: invokespecial #213                // Method java/util/ArrayList."<init>":(I)V
      39: checkcast     #154                // class java/util/Collection
      42: astore        7
      44: iconst_0
      45: istore        8
      47: aload         6
      49: invokeinterface #40,  1           // InterfaceMethod java/lang/Iterable.iterator:()Ljava/util/Iterator;
      54: astore        9
      56: aload         9
      58: invokeinterface #46,  1           // InterfaceMethod java/util/Iterator.hasNext:()Z
      63: ifeq          106
      66: aload         9
      68: invokeinterface #50,  1           // InterfaceMethod java/util/Iterator.next:()Ljava/lang/Object;
      73: astore        10
      75: aload         7
      77: aload         10
      79: checkcast     #52                 // class com/seanshubin/condorcet/backend/domain/Ranking
      82: astore        11
      84: astore        16
      86: iconst_0
      87: istore        12
      89: aload         11
      91: invokevirtual #56                 // Method com/seanshubin/condorcet/backend/domain/Ranking.getCandidateName:()Ljava/lang/String;
      94: aload         16
      96: swap
      97: invokeinterface #214,  2          // InterfaceMethod java/util/Collection.add:(Ljava/lang/Object;)Z
     102: pop
     103: goto          56
     106: aload         7
     108: checkcast     #140                // class java/util/List
     111: nop
     112: astore_3
     113: aload_3
     114: invokedynamic #224,  0            // InvokeDynamic #2:invoke:(Ljava/util/List;)Lkotlin/jvm/functions/Function1;
     119: astore        4
     121: aload_2
     122: checkcast     #36                 // class java/lang/Iterable
     125: astore        6
     127: iconst_0
     128: istore        7
     130: aload         6
     132: astore        8
     134: new           #137                // class java/util/ArrayList
     137: dup
     138: invokespecial #138                // Method java/util/ArrayList."<init>":()V
     141: checkcast     #154                // class java/util/Collection
     144: astore        9
     146: iconst_0
     147: istore        10
     149: aload         8
     151: invokeinterface #40,  1           // InterfaceMethod java/lang/Iterable.iterator:()Ljava/util/Iterator;
     156: astore        11
     158: aload         11
     160: invokeinterface #46,  1           // InterfaceMethod java/util/Iterator.hasNext:()Z
     165: ifeq          208
     168: aload         11
     170: invokeinterface #50,  1           // InterfaceMethod java/util/Iterator.next:()Ljava/lang/Object;
     175: astore        12
     177: aload         4
     179: aload         12
     181: invokeinterface #228,  2          // InterfaceMethod kotlin/jvm/functions/Function1.invoke:(Ljava/lang/Object;)Ljava/lang/Object;
     186: checkcast     #230                // class java/lang/Boolean
     189: invokevirtual #233                // Method java/lang/Boolean.booleanValue:()Z
     192: ifeq          158
     195: aload         9
     197: aload         12
     199: invokeinterface #214,  2          // InterfaceMethod java/util/Collection.add:(Ljava/lang/Object;)Z
     204: pop
     205: goto          158
     208: aload         9
     210: checkcast     #140                // class java/util/List
     213: nop
     214: astore        5
     216: aload         5
     218: checkcast     #36                 // class java/lang/Iterable
     221: astore        7
     223: iconst_0
     224: istore        8
     226: aload         7
     228: astore        9
     230: new           #137                // class java/util/ArrayList
     233: dup
     234: aload         7
     236: bipush        10
     238: invokestatic  #210                // Method kotlin/collections/CollectionsKt.collectionSizeOrDefault:(Ljava/lang/Iterable;I)I
     241: invokespecial #213                // Method java/util/ArrayList."<init>":(I)V
     244: checkcast     #154                // class java/util/Collection
     247: astore        10
     249: iconst_0
     250: istore        11
     252: aload         9
     254: invokeinterface #40,  1           // InterfaceMethod java/lang/Iterable.iterator:()Ljava/util/Iterator;
     259: astore        12
     261: aload         12
     263: invokeinterface #46,  1           // InterfaceMethod java/util/Iterator.hasNext:()Z
     268: ifeq          316
     271: aload         12
     273: invokeinterface #50,  1           // InterfaceMethod java/util/Iterator.next:()Ljava/lang/Object;
     278: astore        13
     280: aload         10
     282: aload         13
     284: checkcast     #235                // class java/lang/String
     287: astore        14
     289: astore        16
     291: iconst_0
     292: istore        15
     294: new           #52                 // class com/seanshubin/condorcet/backend/domain/Ranking
     297: dup
     298: aload         14
     300: aconst_null
     301: invokespecial #238                // Method com/seanshubin/condorcet/backend/domain/Ranking."<init>":(Ljava/lang/String;Ljava/lang/Integer;)V
     304: aload         16
     306: swap
     307: invokeinterface #214,  2          // InterfaceMethod java/util/Collection.add:(Ljava/lang/Object;)Z
     312: pop
     313: goto          261
     316: aload         10
     318: checkcast     #140                // class java/util/List
     321: nop
     322: astore        6
     324: aload_1
     325: checkcast     #154                // class java/util/Collection
     328: aload         6
     330: checkcast     #36                 // class java/lang/Iterable
     333: invokestatic  #242                // Method kotlin/collections/CollectionsKt.plus:(Ljava/util/Collection;Ljava/lang/Iterable;)Ljava/util/List;
     336: areturn

  public final java.util.List<com.seanshubin.condorcet.backend.domain.Ranking> normalizeRankingsReplaceNulls(java.util.List<com.seanshubin.condorcet.backend.domain.Ranking>);
    Code:
       0: aload_1
       1: ldc           #16                 // String <this>
       3: invokestatic  #22                 // Method kotlin/jvm/internal/Intrinsics.checkNotNullParameter:(Ljava/lang/Object;Ljava/lang/String;)V
       6: aload_1
       7: checkcast     #36                 // class java/lang/Iterable
      10: astore_3
      11: iconst_0
      12: istore        4
      14: aload_3
      15: astore        5
      17: new           #137                // class java/util/ArrayList
      20: dup
      21: invokespecial #138                // Method java/util/ArrayList."<init>":()V
      24: checkcast     #154                // class java/util/Collection
      27: astore        6
      29: iconst_0
      30: istore        7
      32: aload         5
      34: astore        8
      36: iconst_0
      37: istore        9
      39: aload         8
      41: invokeinterface #40,  1           // InterfaceMethod java/lang/Iterable.iterator:()Ljava/util/Iterator;
      46: astore        10
      48: aload         10
      50: invokeinterface #46,  1           // InterfaceMethod java/util/Iterator.hasNext:()Z
      55: ifeq          116
      58: aload         10
      60: invokeinterface #50,  1           // InterfaceMethod java/util/Iterator.next:()Ljava/lang/Object;
      65: astore        11
      67: aload         11
      69: astore        12
      71: iconst_0
      72: istore        13
      74: aload         12
      76: checkcast     #52                 // class com/seanshubin/condorcet/backend/domain/Ranking
      79: astore        14
      81: iconst_0
      82: istore        15
      84: aload         14
      86: invokevirtual #64                 // Method com/seanshubin/condorcet/backend/domain/Ranking.getRank:()Ljava/lang/Integer;
      89: dup
      90: ifnull        111
      93: astore        16
      95: iconst_0
      96: istore        17
      98: aload         6
     100: aload         16
     102: invokeinterface #214,  2          // InterfaceMethod java/util/Collection.add:(Ljava/lang/Object;)Z
     107: pop
     108: goto          112
     111: pop
     112: nop
     113: goto          48
     116: nop
     117: aload         6
     119: checkcast     #140                // class java/util/List
     122: nop
     123: checkcast     #36                 // class java/lang/Iterable
     126: invokestatic  #266                // Method kotlin/collections/CollectionsKt.distinct:(Ljava/lang/Iterable;)Ljava/util/List;
     129: checkcast     #36                 // class java/lang/Iterable
     132: invokestatic  #268                // Method kotlin/collections/CollectionsKt.sorted:(Ljava/lang/Iterable;)Ljava/util/List;
     135: astore_2
     136: new           #270                // class kotlin/ranges/IntRange
     139: dup
     140: iconst_1
     141: aload_2
     142: invokeinterface #273,  1          // InterfaceMethod java/util/List.size:()I
     147: invokespecial #276                // Method kotlin/ranges/IntRange."<init>":(II)V
     150: astore_3
     151: aload_2
     152: checkcast     #36                 // class java/lang/Iterable
     155: aload_3
     156: checkcast     #36                 // class java/lang/Iterable
     159: invokestatic  #280                // Method kotlin/collections/CollectionsKt.zip:(Ljava/lang/Iterable;Ljava/lang/Iterable;)Ljava/util/List;
     162: checkcast     #36                 // class java/lang/Iterable
     165: invokestatic  #286                // Method kotlin/collections/MapsKt.toMap:(Ljava/lang/Iterable;)Ljava/util/Map;
     168: astore        4
     170: aload_2
     171: invokeinterface #273,  1          // InterfaceMethod java/util/List.size:()I
     176: iconst_1
     177: iadd
     178: istore        5
     180: aload_1
     181: checkcast     #36                 // class java/lang/Iterable
     184: astore        7
     186: iconst_0
     187: istore        8
     189: aload         7
     191: astore        9
     193: new           #137                // class java/util/ArrayList
     196: dup
     197: aload         7
     199: bipush        10
     201: invokestatic  #210                // Method kotlin/collections/CollectionsKt.collectionSizeOrDefault:(Ljava/lang/Iterable;I)I
     204: invokespecial #213                // Method java/util/ArrayList."<init>":(I)V
     207: checkcast     #154                // class java/util/Collection
     210: astore        10
     212: iconst_0
     213: istore        11
     215: aload         9
     217: invokeinterface #40,  1           // InterfaceMethod java/lang/Iterable.iterator:()Ljava/util/Iterator;
     222: astore        12
     224: aload         12
     226: invokeinterface #46,  1           // InterfaceMethod java/util/Iterator.hasNext:()Z
     231: ifeq          324
     234: aload         12
     236: invokeinterface #50,  1           // InterfaceMethod java/util/Iterator.next:()Ljava/lang/Object;
     241: astore        13
     243: aload         10
     245: aload         13
     247: checkcast     #52                 // class com/seanshubin/condorcet/backend/domain/Ranking
     250: astore        14
     252: astore        19
     254: iconst_0
     255: istore        15
     257: aload         14
     259: invokevirtual #289                // Method com/seanshubin/condorcet/backend/domain/Ranking.component1:()Ljava/lang/String;
     262: astore        16
     264: aload         14
     266: invokevirtual #292                // Method com/seanshubin/condorcet/backend/domain/Ranking.component2:()Ljava/lang/Integer;
     269: astore        17
     271: aload         4
     273: aload         17
     275: invokeinterface #135,  2          // InterfaceMethod java/util/Map.get:(Ljava/lang/Object;)Ljava/lang/Object;
     280: checkcast     #66                 // class java/lang/Integer
     283: dup
     284: ifnull        293
     287: invokevirtual #70                 // Method java/lang/Integer.intValue:()I
     290: goto          296
     293: pop
     294: iload         5
     296: istore        18
     298: new           #52                 // class com/seanshubin/condorcet/backend/domain/Ranking
     301: dup
     302: aload         16
     304: iload         18
     306: invokestatic  #296                // Method java/lang/Integer.valueOf:(I)Ljava/lang/Integer;
     309: invokespecial #238                // Method com/seanshubin/condorcet/backend/domain/Ranking."<init>":(Ljava/lang/String;Ljava/lang/Integer;)V
     312: aload         19
     314: swap
     315: invokeinterface #214,  2          // InterfaceMethod java/util/Collection.add:(Ljava/lang/Object;)Z
     320: pop
     321: goto          224
     324: aload         10
     326: checkcast     #140                // class java/util/List
     329: nop
     330: astore        6
     332: aload         6
     334: areturn

  public final java.util.List<com.seanshubin.condorcet.backend.domain.Ranking> normalizeRankingsKeepNulls(java.util.List<com.seanshubin.condorcet.backend.domain.Ranking>);
    Code:
       0: aload_1
       1: ldc           #16                 // String <this>
       3: invokestatic  #22                 // Method kotlin/jvm/internal/Intrinsics.checkNotNullParameter:(Ljava/lang/Object;Ljava/lang/String;)V
       6: aload_1
       7: checkcast     #36                 // class java/lang/Iterable
      10: astore_3
      11: iconst_0
      12: istore        4
      14: aload_3
      15: astore        5
      17: new           #137                // class java/util/ArrayList
      20: dup
      21: invokespecial #138                // Method java/util/ArrayList."<init>":()V
      24: checkcast     #154                // class java/util/Collection
      27: astore        6
      29: iconst_0
      30: istore        7
      32: aload         5
      34: astore        8
      36: iconst_0
      37: istore        9
      39: aload         8
      41: invokeinterface #40,  1           // InterfaceMethod java/lang/Iterable.iterator:()Ljava/util/Iterator;
      46: astore        10
      48: aload         10
      50: invokeinterface #46,  1           // InterfaceMethod java/util/Iterator.hasNext:()Z
      55: ifeq          116
      58: aload         10
      60: invokeinterface #50,  1           // InterfaceMethod java/util/Iterator.next:()Ljava/lang/Object;
      65: astore        11
      67: aload         11
      69: astore        12
      71: iconst_0
      72: istore        13
      74: aload         12
      76: checkcast     #52                 // class com/seanshubin/condorcet/backend/domain/Ranking
      79: astore        14
      81: iconst_0
      82: istore        15
      84: aload         14
      86: invokevirtual #64                 // Method com/seanshubin/condorcet/backend/domain/Ranking.getRank:()Ljava/lang/Integer;
      89: dup
      90: ifnull        111
      93: astore        16
      95: iconst_0
      96: istore        17
      98: aload         6
     100: aload         16
     102: invokeinterface #214,  2          // InterfaceMethod java/util/Collection.add:(Ljava/lang/Object;)Z
     107: pop
     108: goto          112
     111: pop
     112: nop
     113: goto          48
     116: nop
     117: aload         6
     119: checkcast     #140                // class java/util/List
     122: nop
     123: checkcast     #36                 // class java/lang/Iterable
     126: invokestatic  #266                // Method kotlin/collections/CollectionsKt.distinct:(Ljava/lang/Iterable;)Ljava/util/List;
     129: checkcast     #36                 // class java/lang/Iterable
     132: invokestatic  #268                // Method kotlin/collections/CollectionsKt.sorted:(Ljava/lang/Iterable;)Ljava/util/List;
     135: astore_2
     136: new           #270                // class kotlin/ranges/IntRange
     139: dup
     140: iconst_1
     141: aload_2
     142: invokeinterface #273,  1          // InterfaceMethod java/util/List.size:()I
     147: invokespecial #276                // Method kotlin/ranges/IntRange."<init>":(II)V
     150: astore_3
     151: aload_2
     152: checkcast     #36                 // class java/lang/Iterable
     155: aload_3
     156: checkcast     #36                 // class java/lang/Iterable
     159: invokestatic  #280                // Method kotlin/collections/CollectionsKt.zip:(Ljava/lang/Iterable;Ljava/lang/Iterable;)Ljava/util/List;
     162: checkcast     #36                 // class java/lang/Iterable
     165: invokestatic  #286                // Method kotlin/collections/MapsKt.toMap:(Ljava/lang/Iterable;)Ljava/util/Map;
     168: astore        4
     170: aload_1
     171: checkcast     #36                 // class java/lang/Iterable
     174: astore        6
     176: iconst_0
     177: istore        7
     179: aload         6
     181: astore        8
     183: new           #137                // class java/util/ArrayList
     186: dup
     187: aload         6
     189: bipush        10
     191: invokestatic  #210                // Method kotlin/collections/CollectionsKt.collectionSizeOrDefault:(Ljava/lang/Iterable;I)I
     194: invokespecial #213                // Method java/util/ArrayList."<init>":(I)V
     197: checkcast     #154                // class java/util/Collection
     200: astore        9
     202: iconst_0
     203: istore        10
     205: aload         8
     207: invokeinterface #40,  1           // InterfaceMethod java/lang/Iterable.iterator:()Ljava/util/Iterator;
     212: astore        11
     214: aload         11
     216: invokeinterface #46,  1           // InterfaceMethod java/util/Iterator.hasNext:()Z
     221: ifeq          298
     224: aload         11
     226: invokeinterface #50,  1           // InterfaceMethod java/util/Iterator.next:()Ljava/lang/Object;
     231: astore        12
     233: aload         9
     235: aload         12
     237: checkcast     #52                 // class com/seanshubin/condorcet/backend/domain/Ranking
     240: astore        13
     242: astore        18
     244: iconst_0
     245: istore        14
     247: aload         13
     249: invokevirtual #289                // Method com/seanshubin/condorcet/backend/domain/Ranking.component1:()Ljava/lang/String;
     252: astore        15
     254: aload         13
     256: invokevirtual #292                // Method com/seanshubin/condorcet/backend/domain/Ranking.component2:()Ljava/lang/Integer;
     259: astore        16
     261: aload         4
     263: aload         16
     265: invokeinterface #135,  2          // InterfaceMethod java/util/Map.get:(Ljava/lang/Object;)Ljava/lang/Object;
     270: checkcast     #66                 // class java/lang/Integer
     273: astore        17
     275: new           #52                 // class com/seanshubin/condorcet/backend/domain/Ranking
     278: dup
     279: aload         15
     281: aload         17
     283: invokespecial #238                // Method com/seanshubin/condorcet/backend/domain/Ranking."<init>":(Ljava/lang/String;Ljava/lang/Integer;)V
     286: aload         18
     288: swap
     289: invokeinterface #214,  2          // InterfaceMethod java/util/Collection.add:(Ljava/lang/Object;)Z
     294: pop
     295: goto          214
     298: aload         9
     300: checkcast     #140                // class java/util/List
     303: nop
     304: astore        5
     306: aload         5
     308: areturn

  public final java.util.List<com.seanshubin.condorcet.backend.domain.Ranking> effectiveRankings(java.util.List<com.seanshubin.condorcet.backend.domain.Ranking>, java.util.List<java.lang.String>);
    Code:
       0: aload_1
       1: ldc           #16                 // String <this>
       3: invokestatic  #22                 // Method kotlin/jvm/internal/Intrinsics.checkNotNullParameter:(Ljava/lang/Object;Ljava/lang/String;)V
       6: aload_2
       7: ldc_w         #326                // String candidateNames
      10: invokestatic  #22                 // Method kotlin/jvm/internal/Intrinsics.checkNotNullParameter:(Ljava/lang/Object;Ljava/lang/String;)V
      13: aload_0
      14: aload_0
      15: aload_1
      16: aload_2
      17: invokevirtual #328                // Method addMissingCandidates:(Ljava/util/List;Ljava/util/List;)Ljava/util/List;
      20: invokevirtual #330                // Method normalizeRankingsReplaceNulls:(Ljava/util/List;)Ljava/util/List;
      23: areturn

  public final java.util.List<com.seanshubin.condorcet.backend.domain.Ranking> matchOrderToCandidates(java.util.List<com.seanshubin.condorcet.backend.domain.Ranking>, java.util.List<java.lang.String>);
    Code:
       0: aload_1
       1: ldc           #16                 // String <this>
       3: invokestatic  #22                 // Method kotlin/jvm/internal/Intrinsics.checkNotNullParameter:(Ljava/lang/Object;Ljava/lang/String;)V
       6: aload_2
       7: ldc_w         #326                // String candidateNames
      10: invokestatic  #22                 // Method kotlin/jvm/internal/Intrinsics.checkNotNullParameter:(Ljava/lang/Object;Ljava/lang/String;)V
      13: aload_1
      14: checkcast     #36                 // class java/lang/Iterable
      17: astore        4
      19: iconst_0
      20: istore        5
      22: aload         4
      24: bipush        10
      26: invokestatic  #210                // Method kotlin/collections/CollectionsKt.collectionSizeOrDefault:(Ljava/lang/Iterable;I)I
      29: invokestatic  #336                // Method kotlin/collections/MapsKt.mapCapacity:(I)I
      32: bipush        16
      34: invokestatic  #342                // Method kotlin/ranges/RangesKt.coerceAtLeast:(II)I
      37: istore        6
      39: aload         4
      41: astore        7
      43: new           #129                // class java/util/LinkedHashMap
      46: dup
      47: iload         6
      49: invokespecial #343                // Method java/util/LinkedHashMap."<init>":(I)V
      52: checkcast     #132                // class java/util/Map
      55: astore        8
      57: iconst_0
      58: istore        9
      60: aload         7
      62: invokeinterface #40,  1           // InterfaceMethod java/lang/Iterable.iterator:()Ljava/util/Iterator;
      67: astore        10
      69: aload         10
      71: invokeinterface #46,  1           // InterfaceMethod java/util/Iterator.hasNext:()Z
      76: ifeq          121
      79: aload         10
      81: invokeinterface #50,  1           // InterfaceMethod java/util/Iterator.next:()Ljava/lang/Object;
      86: astore        11
      88: aload         8
      90: aload         11
      92: checkcast     #52                 // class com/seanshubin/condorcet/backend/domain/Ranking
      95: astore        12
      97: astore        14
      99: iconst_0
     100: istore        13
     102: aload         12
     104: invokevirtual #56                 // Method com/seanshubin/condorcet/backend/domain/Ranking.getCandidateName:()Ljava/lang/String;
     107: aload         14
     109: swap
     110: aload         11
     112: invokeinterface #144,  3          // InterfaceMethod java/util/Map.put:(Ljava/lang/Object;Ljava/lang/Object;)Ljava/lang/Object;
     117: pop
     118: goto          69
     121: aload         8
     123: nop
     124: astore_3
     125: aload_2
     126: checkcast     #36                 // class java/lang/Iterable
     129: astore        4
     131: iconst_0
     132: istore        5
     134: aload         4
     136: astore        6
     138: new           #137                // class java/util/ArrayList
     141: dup
     142: aload         4
     144: bipush        10
     146: invokestatic  #210                // Method kotlin/collections/CollectionsKt.collectionSizeOrDefault:(Ljava/lang/Iterable;I)I
     149: invokespecial #213                // Method java/util/ArrayList."<init>":(I)V
     152: checkcast     #154                // class java/util/Collection
     155: astore        7
     157: iconst_0
     158: istore        8
     160: aload         6
     162: invokeinterface #40,  1           // InterfaceMethod java/lang/Iterable.iterator:()Ljava/util/Iterator;
     167: astore        9
     169: aload         9
     171: invokeinterface #46,  1           // InterfaceMethod java/util/Iterator.hasNext:()Z
     176: ifeq          223
     179: aload         9
     181: invokeinterface #50,  1           // InterfaceMethod java/util/Iterator.next:()Ljava/lang/Object;
     186: astore        10
     188: aload         7
     190: aload         10
     192: checkcast     #235                // class java/lang/String
     195: astore        11
     197: astore        14
     199: iconst_0
     200: istore        12
     202: aload_3
     203: aload         11
     205: invokestatic  #347                // Method kotlin/collections/MapsKt.getValue:(Ljava/util/Map;Ljava/lang/Object;)Ljava/lang/Object;
     208: checkcast     #52                 // class com/seanshubin/condorcet/backend/domain/Ranking
     211: aload         14
     213: swap
     214: invokeinterface #214,  2          // InterfaceMethod java/util/Collection.add:(Ljava/lang/Object;)Z
     219: pop
     220: goto          169
     223: aload         7
     225: checkcast     #140                // class java/util/List
     228: nop
     229: areturn

  private static final java.lang.CharSequence listToString$lambda$1(com.seanshubin.condorcet.backend.domain.Ranking);
    Code:
       0: aload_0
       1: ldc_w         #358                // String <destruct>
       4: invokestatic  #22                 // Method kotlin/jvm/internal/Intrinsics.checkNotNullParameter:(Ljava/lang/Object;Ljava/lang/String;)V
       7: aload_0
       8: invokevirtual #289                // Method com/seanshubin/condorcet/backend/domain/Ranking.component1:()Ljava/lang/String;
      11: astore_1
      12: aload_0
      13: invokevirtual #292                // Method com/seanshubin/condorcet/backend/domain/Ranking.component2:()Ljava/lang/Integer;
      16: astore_2
      17: new           #360                // class java/lang/StringBuilder
      20: dup
      21: invokespecial #361                // Method java/lang/StringBuilder."<init>":()V
      24: aload_2
      25: invokevirtual #365                // Method java/lang/StringBuilder.append:(Ljava/lang/Object;)Ljava/lang/StringBuilder;
      28: bipush        32
      30: invokevirtual #368                // Method java/lang/StringBuilder.append:(C)Ljava/lang/StringBuilder;
      33: aload_1
      34: invokevirtual #371                // Method java/lang/StringBuilder.append:(Ljava/lang/String;)Ljava/lang/StringBuilder;
      37: invokevirtual #374                // Method java/lang/StringBuilder.toString:()Ljava/lang/String;
      40: checkcast     #84                 // class java/lang/CharSequence
      43: areturn

  private static final int voterBiasedOrdering$lambda$2(com.seanshubin.condorcet.backend.domain.Ranking, com.seanshubin.condorcet.backend.domain.Ranking);
    Code:
       0: aload_0
       1: dup
       2: ifnull        18
       5: invokevirtual #64                 // Method com/seanshubin/condorcet/backend/domain/Ranking.getRank:()Ljava/lang/Integer;
       8: dup
       9: ifnull        18
      12: invokevirtual #70                 // Method java/lang/Integer.intValue:()I
      15: goto          21
      18: pop
      19: ldc           #71                 // int 2147483647
      21: istore_2
      22: aload_1
      23: dup
      24: ifnull        40
      27: invokevirtual #64                 // Method com/seanshubin/condorcet/backend/domain/Ranking.getRank:()Ljava/lang/Integer;
      30: dup
      31: ifnull        40
      34: invokevirtual #70                 // Method java/lang/Integer.intValue:()I
      37: goto          43
      40: pop
      41: ldc           #71                 // int 2147483647
      43: istore_3
      44: iload_2
      45: iload_3
      46: invokestatic  #377                // Method kotlin/jvm/internal/Intrinsics.compare:(II)I
      49: ireturn

  private static final boolean addMissingCandidates$lambda$6(java.util.List, java.lang.String);
    Code:
       0: aload_1
       1: ldc_w         #383                // String candidate
       4: invokestatic  #22                 // Method kotlin/jvm/internal/Intrinsics.checkNotNullParameter:(Ljava/lang/Object;Ljava/lang/String;)V
       7: aload_0
       8: aload_1
       9: invokeinterface #386,  2          // InterfaceMethod java/util/List.contains:(Ljava/lang/Object;)Z
      14: ifne          21
      17: iconst_1
      18: goto          22
      21: iconst_0
      22: ireturn

  public com.seanshubin.condorcet.backend.domain.Ranking$Companion(kotlin.jvm.internal.DefaultConstructorMarker);
    Code:
       0: aload_0
       1: invokespecial #389                // Method "<init>":()V
       4: return
}

Compiled from "Ranking.kt"
public final class com.seanshubin.condorcet.backend.domain.Ranking$Companion$RankingListComparator implements java.util.Comparator<java.util.List<? extends com.seanshubin.condorcet.backend.domain.Ranking>> {
  public static final com.seanshubin.condorcet.backend.domain.Ranking$Companion$RankingListComparator INSTANCE;

  private com.seanshubin.condorcet.backend.domain.Ranking$Companion$RankingListComparator();
    Code:
       0: aload_0
       1: invokespecial #11                 // Method java/lang/Object."<init>":()V
       4: return

  public int compare(java.util.List<com.seanshubin.condorcet.backend.domain.Ranking>, java.util.List<com.seanshubin.condorcet.backend.domain.Ranking>);
    Code:
       0: aload_1
       1: ldc           #19                 // String firstRankingList
       3: invokestatic  #25                 // Method kotlin/jvm/internal/Intrinsics.checkNotNullParameter:(Ljava/lang/Object;Ljava/lang/String;)V
       6: aload_2
       7: ldc           #27                 // String secondRankingList
       9: invokestatic  #25                 // Method kotlin/jvm/internal/Intrinsics.checkNotNullParameter:(Ljava/lang/Object;Ljava/lang/String;)V
      12: aload_1
      13: checkcast     #29                 // class java/lang/Iterable
      16: astore        4
      18: iconst_0
      19: istore        5
      21: aload         4
      23: astore        6
      25: new           #31                 // class java/util/ArrayList
      28: dup
      29: invokespecial #32                 // Method java/util/ArrayList."<init>":()V
      32: checkcast     #34                 // class java/util/Collection
      35: astore        7
      37: iconst_0
      38: istore        8
      40: aload         6
      42: astore        9
      44: iconst_0
      45: istore        10
      47: aload         9
      49: invokeinterface #38,  1           // InterfaceMethod java/lang/Iterable.iterator:()Ljava/util/Iterator;
      54: astore        11
      56: aload         11
      58: invokeinterface #44,  1           // InterfaceMethod java/util/Iterator.hasNext:()Z
      63: ifeq          124
      66: aload         11
      68: invokeinterface #48,  1           // InterfaceMethod java/util/Iterator.next:()Ljava/lang/Object;
      73: astore        12
      75: aload         12
      77: astore        13
      79: iconst_0
      80: istore        14
      82: aload         13
      84: checkcast     #50                 // class com/seanshubin/condorcet/backend/domain/Ranking
      87: astore        15
      89: iconst_0
      90: istore        16
      92: aload         15
      94: invokevirtual #54                 // Method com/seanshubin/condorcet/backend/domain/Ranking.getRank:()Ljava/lang/Integer;
      97: dup
      98: ifnull        119
     101: astore        17
     103: iconst_0
     104: istore        18
     106: aload         7
     108: aload         17
     110: invokeinterface #58,  2           // InterfaceMethod java/util/Collection.add:(Ljava/lang/Object;)Z
     115: pop
     116: goto          120
     119: pop
     120: nop
     121: goto          56
     124: nop
     125: aload         7
     127: checkcast     #60                 // class java/util/List
     130: nop
     131: astore_3
     132: aload_2
     133: checkcast     #29                 // class java/lang/Iterable
     136: astore        5
     138: iconst_0
     139: istore        6
     141: aload         5
     143: astore        7
     145: new           #31                 // class java/util/ArrayList
     148: dup
     149: invokespecial #32                 // Method java/util/ArrayList."<init>":()V
     152: checkcast     #34                 // class java/util/Collection
     155: astore        8
     157: iconst_0
     158: istore        9
     160: aload         7
     162: astore        10
     164: iconst_0
     165: istore        11
     167: aload         10
     169: invokeinterface #38,  1           // InterfaceMethod java/lang/Iterable.iterator:()Ljava/util/Iterator;
     174: astore        12
     176: aload         12
     178: invokeinterface #44,  1           // InterfaceMethod java/util/Iterator.hasNext:()Z
     183: ifeq          244
     186: aload         12
     188: invokeinterface #48,  1           // InterfaceMethod java/util/Iterator.next:()Ljava/lang/Object;
     193: astore        13
     195: aload         13
     197: astore        14
     199: iconst_0
     200: istore        15
     202: aload         14
     204: checkcast     #50                 // class com/seanshubin/condorcet/backend/domain/Ranking
     207: astore        16
     209: iconst_0
     210: istore        17
     212: aload         16
     214: invokevirtual #54                 // Method com/seanshubin/condorcet/backend/domain/Ranking.getRank:()Ljava/lang/Integer;
     217: dup
     218: ifnull        239
     221: astore        18
     223: iconst_0
     224: istore        19
     226: aload         8
     228: aload         18
     230: invokeinterface #58,  2           // InterfaceMethod java/util/Collection.add:(Ljava/lang/Object;)Z
     235: pop
     236: goto          240
     239: pop
     240: nop
     241: goto          176
     244: nop
     245: aload         8
     247: checkcast     #60                 // class java/util/List
     250: nop
     251: astore        4
     253: getstatic     #66                 // Field com/seanshubin/condorcet/backend/domain/Ranking$Companion$RankListComparator.INSTANCE:Lcom/seanshubin/condorcet/backend/domain/Ranking$Companion$RankListComparator;
     256: aload_3
     257: aload         4
     259: invokevirtual #68                 // Method com/seanshubin/condorcet/backend/domain/Ranking$Companion$RankListComparator.compare:(Ljava/util/List;Ljava/util/List;)I
     262: ireturn

  public int compare(java.lang.Object, java.lang.Object);
    Code:
       0: aload_0
       1: aload_1
       2: checkcast     #60                 // class java/util/List
       5: aload_2
       6: checkcast     #60                 // class java/util/List
       9: invokevirtual #95                 // Method compare:(Ljava/util/List;Ljava/util/List;)I
      12: ireturn

  static {};
    Code:
       0: new           #2                  // class com/seanshubin/condorcet/backend/domain/Ranking$Companion$RankingListComparator
       3: dup
       4: invokespecial #99                 // Method "<init>":()V
       7: putstatic     #101                // Field INSTANCE:Lcom/seanshubin/condorcet/backend/domain/Ranking$Companion$RankingListComparator;
      10: return
}

Compiled from "Ranking.kt"
public final class com.seanshubin.condorcet.backend.domain.Ranking$Companion$RankListComparator implements java.util.Comparator<java.util.List<? extends java.lang.Integer>> {
  public static final com.seanshubin.condorcet.backend.domain.Ranking$Companion$RankListComparator INSTANCE;

  private com.seanshubin.condorcet.backend.domain.Ranking$Companion$RankListComparator();
    Code:
       0: aload_0
       1: invokespecial #11                 // Method java/lang/Object."<init>":()V
       4: return

  public int compare(java.util.List<java.lang.Integer>, java.util.List<java.lang.Integer>);
    Code:
       0: aload_1
       1: ldc           #19                 // String firstList
       3: invokestatic  #25                 // Method kotlin/jvm/internal/Intrinsics.checkNotNullParameter:(Ljava/lang/Object;Ljava/lang/String;)V
       6: aload_2
       7: ldc           #27                 // String secondList
       9: invokestatic  #25                 // Method kotlin/jvm/internal/Intrinsics.checkNotNullParameter:(Ljava/lang/Object;Ljava/lang/String;)V
      12: aload_1
      13: invokeinterface #33,  1           // InterfaceMethod java/util/List.size:()I
      18: aload_2
      19: invokeinterface #33,  1           // InterfaceMethod java/util/List.size:()I
      24: invokestatic  #39                 // Method java/lang/Math.max:(II)I
      27: istore_3
      28: iconst_0
      29: istore        4
      31: iconst_0
      32: istore        5
      34: iload         5
      36: iload_3
      37: if_icmpge     95
      40: aload_1
      41: iload         5
      43: invokeinterface #43,  2           // InterfaceMethod java/util/List.get:(I)Ljava/lang/Object;
      48: checkcast     #45                 // class java/lang/Number
      51: invokevirtual #48                 // Method java/lang/Number.intValue:()I
      54: istore        6
      56: aload_2
      57: iload         5
      59: invokeinterface #43,  2           // InterfaceMethod java/util/List.get:(I)Ljava/lang/Object;
      64: checkcast     #45                 // class java/lang/Number
      67: invokevirtual #48                 // Method java/lang/Number.intValue:()I
      70: istore        7
      72: getstatic     #54                 // Field com/seanshubin/condorcet/backend/domain/Ranking$Companion$RankComparator.INSTANCE:Lcom/seanshubin/condorcet/backend/domain/Ranking$Companion$RankComparator;
      75: iload         6
      77: iload         7
      79: invokevirtual #56                 // Method com/seanshubin/condorcet/backend/domain/Ranking$Companion$RankComparator.compare:(II)I
      82: istore        4
      84: iload         4
      86: ifne          95
      89: iinc          5, 1
      92: goto          34
      95: iload         4
      97: ireturn

  public int compare(java.lang.Object, java.lang.Object);
    Code:
       0: aload_0
       1: aload_1
       2: checkcast     #29                 // class java/util/List
       5: aload_2
       6: checkcast     #29                 // class java/util/List
       9: invokevirtual #66                 // Method compare:(Ljava/util/List;Ljava/util/List;)I
      12: ireturn

  static {};
    Code:
       0: new           #2                  // class com/seanshubin/condorcet/backend/domain/Ranking$Companion$RankListComparator
       3: dup
       4: invokespecial #71                 // Method "<init>":()V
       7: putstatic     #73                 // Field INSTANCE:Lcom/seanshubin/condorcet/backend/domain/Ranking$Companion$RankListComparator;
      10: return
}

Compiled from "Ranking.kt"
public final class com.seanshubin.condorcet.backend.domain.Ranking {
  public static final com.seanshubin.condorcet.backend.domain.Ranking$Companion Companion;

  private final java.lang.String candidateName;

  private final java.lang.Integer rank;

  public com.seanshubin.condorcet.backend.domain.Ranking(java.lang.String, java.lang.Integer);
    Code:
       0: aload_1
       1: ldc           #10                 // String candidateName
       3: invokestatic  #16                 // Method kotlin/jvm/internal/Intrinsics.checkNotNullParameter:(Ljava/lang/Object;Ljava/lang/String;)V
       6: aload_0
       7: invokespecial #19                 // Method java/lang/Object."<init>":()V
      10: aload_0
      11: aload_1
      12: putfield      #22                 // Field candidateName:Ljava/lang/String;
      15: aload_0
      16: aload_2
      17: putfield      #26                 // Field rank:Ljava/lang/Integer;
      20: return

  public final java.lang.String getCandidateName();
    Code:
       0: aload_0
       1: getfield      #22                 // Field candidateName:Ljava/lang/String;
       4: areturn

  public final java.lang.Integer getRank();
    Code:
       0: aload_0
       1: getfield      #26                 // Field rank:Ljava/lang/Integer;
       4: areturn

  public final java.lang.String component1();
    Code:
       0: aload_0
       1: getfield      #22                 // Field candidateName:Ljava/lang/String;
       4: areturn

  public final java.lang.Integer component2();
    Code:
       0: aload_0
       1: getfield      #26                 // Field rank:Ljava/lang/Integer;
       4: areturn

  public final com.seanshubin.condorcet.backend.domain.Ranking copy(java.lang.String, java.lang.Integer);
    Code:
       0: aload_1
       1: ldc           #10                 // String candidateName
       3: invokestatic  #16                 // Method kotlin/jvm/internal/Intrinsics.checkNotNullParameter:(Ljava/lang/Object;Ljava/lang/String;)V
       6: new           #2                  // class com/seanshubin/condorcet/backend/domain/Ranking
       9: dup
      10: aload_1
      11: aload_2
      12: invokespecial #38                 // Method "<init>":(Ljava/lang/String;Ljava/lang/Integer;)V
      15: areturn

  public static com.seanshubin.condorcet.backend.domain.Ranking copy$default(com.seanshubin.condorcet.backend.domain.Ranking, java.lang.String, java.lang.Integer, int, java.lang.Object);
    Code:
       0: iload_3
       1: iconst_1
       2: iand
       3: ifeq          11
       6: aload_0
       7: getfield      #22                 // Field candidateName:Ljava/lang/String;
      10: astore_1
      11: iload_3
      12: iconst_2
      13: iand
      14: ifeq          22
      17: aload_0
      18: getfield      #26                 // Field rank:Ljava/lang/Integer;
      21: astore_2
      22: aload_0
      23: aload_1
      24: aload_2
      25: invokevirtual #42                 // Method copy:(Ljava/lang/String;Ljava/lang/Integer;)Lcom/seanshubin/condorcet/backend/domain/Ranking;
      28: areturn

  public java.lang.String toString();
    Code:
       0: new           #45                 // class java/lang/StringBuilder
       3: dup
       4: invokespecial #46                 // Method java/lang/StringBuilder."<init>":()V
       7: ldc           #48                 // String Ranking(candidateName=
       9: invokevirtual #52                 // Method java/lang/StringBuilder.append:(Ljava/lang/String;)Ljava/lang/StringBuilder;
      12: aload_0
      13: getfield      #22                 // Field candidateName:Ljava/lang/String;
      16: invokevirtual #52                 // Method java/lang/StringBuilder.append:(Ljava/lang/String;)Ljava/lang/StringBuilder;
      19: ldc           #54                 // String , rank=
      21: invokevirtual #52                 // Method java/lang/StringBuilder.append:(Ljava/lang/String;)Ljava/lang/StringBuilder;
      24: aload_0
      25: getfield      #26                 // Field rank:Ljava/lang/Integer;
      28: invokevirtual #57                 // Method java/lang/StringBuilder.append:(Ljava/lang/Object;)Ljava/lang/StringBuilder;
      31: bipush        41
      33: invokevirtual #60                 // Method java/lang/StringBuilder.append:(C)Ljava/lang/StringBuilder;
      36: invokevirtual #62                 // Method java/lang/StringBuilder.toString:()Ljava/lang/String;
      39: areturn

  public int hashCode();
    Code:
       0: aload_0
       1: getfield      #22                 // Field candidateName:Ljava/lang/String;
       4: invokevirtual #68                 // Method java/lang/String.hashCode:()I
       7: istore_1
       8: iload_1
       9: bipush        31
      11: imul
      12: aload_0
      13: getfield      #26                 // Field rank:Ljava/lang/Integer;
      16: ifnonnull     23
      19: iconst_0
      20: goto          30
      23: aload_0
      24: getfield      #26                 // Field rank:Ljava/lang/Integer;
      27: invokevirtual #69                 // Method java/lang/Object.hashCode:()I
      30: iadd
      31: istore_1
      32: iload_1
      33: ireturn

  public boolean equals(java.lang.Object);
    Code:
       0: aload_0
       1: aload_1
       2: if_acmpne     7
       5: iconst_1
       6: ireturn
       7: aload_1
       8: instanceof    #2                  // class com/seanshubin/condorcet/backend/domain/Ranking
      11: ifne          16
      14: iconst_0
      15: ireturn
      16: aload_1
      17: checkcast     #2                  // class com/seanshubin/condorcet/backend/domain/Ranking
      20: astore_2
      21: aload_0
      22: getfield      #22                 // Field candidateName:Ljava/lang/String;
      25: aload_2
      26: getfield      #22                 // Field candidateName:Ljava/lang/String;
      29: invokestatic  #77                 // Method kotlin/jvm/internal/Intrinsics.areEqual:(Ljava/lang/Object;Ljava/lang/Object;)Z
      32: ifne          37
      35: iconst_0
      36: ireturn
      37: aload_0
      38: getfield      #26                 // Field rank:Ljava/lang/Integer;
      41: aload_2
      42: getfield      #26                 // Field rank:Ljava/lang/Integer;
      45: invokestatic  #77                 // Method kotlin/jvm/internal/Intrinsics.areEqual:(Ljava/lang/Object;Ljava/lang/Object;)Z
      48: ifne          53
      51: iconst_0
      52: ireturn
      53: iconst_1
      54: ireturn

  static {};
    Code:
       0: new           #82                 // class com/seanshubin/condorcet/backend/domain/Ranking$Companion
       3: dup
       4: aconst_null
       5: invokespecial #85                 // Method com/seanshubin/condorcet/backend/domain/Ranking$Companion."<init>":(Lkotlin/jvm/internal/DefaultConstructorMarker;)V
       8: putstatic     #89                 // Field Companion:Lcom/seanshubin/condorcet/backend/domain/Ranking$Companion;
      11: return
}

Compiled from "Ranking.kt"
public final class com.seanshubin.condorcet.backend.domain.Ranking$Companion$RankComparator implements java.util.Comparator<java.lang.Integer> {
  public static final com.seanshubin.condorcet.backend.domain.Ranking$Companion$RankComparator INSTANCE;

  private com.seanshubin.condorcet.backend.domain.Ranking$Companion$RankComparator();
    Code:
       0: aload_0
       1: invokespecial #11                 // Method java/lang/Object."<init>":()V
       4: return

  public int compare(int, int);
    Code:
       0: iload_1
       1: iload_2
       2: invokestatic  #19                 // Method kotlin/jvm/internal/Intrinsics.compare:(II)I
       5: ireturn

  public int compare(java.lang.Object, java.lang.Object);
    Code:
       0: aload_0
       1: aload_1
       2: checkcast     #25                 // class java/lang/Number
       5: invokevirtual #29                 // Method java/lang/Number.intValue:()I
       8: aload_2
       9: checkcast     #25                 // class java/lang/Number
      12: invokevirtual #29                 // Method java/lang/Number.intValue:()I
      15: invokevirtual #30                 // Method compare:(II)I
      18: ireturn

  static {};
    Code:
       0: new           #2                  // class com/seanshubin/condorcet/backend/domain/Ranking$Companion$RankComparator
       3: dup
       4: invokespecial #35                 // Method "<init>":()V
       7: putstatic     #38                 // Field INSTANCE:Lcom/seanshubin/condorcet/backend/domain/Ranking$Companion$RankComparator;
      10: return
}


package com.github.lernejo.korekto.toolkit.misc

import java.util.*
import java.util.stream.Collectors
import java.util.stream.Stream
import kotlin.math.min

object Distances {
    private fun minimum(a: Int, b: Int, c: Int): Int {
        return min(min(a, b), c)
    }

    fun levenshteinDistance(lhs: CharSequence?, rhs: CharSequence?): Int {
        val distance = Array(lhs!!.length + 1) {
            IntArray(
                rhs!!.length + 1
            )
        }
        for (i in 0..lhs.length) distance[i][0] = i
        for (j in 1..rhs!!.length) distance[0][j] = j
        for (i in 1..lhs.length) for (j in 1..rhs.length) distance[i][j] = minimum(
            distance[i - 1][j] + 1,
            distance[i][j - 1] + 1,
            distance[i - 1][j - 1] + if (lhs[i - 1] == rhs[j - 1]) 0 else 1
        )
        return distance[lhs.length][rhs.length]
    }

    fun isWordsIncludedApprox(left: String, right: String, wordLevenshteinDistance: Int): Boolean {
        val leftWords = words(left).collect(Collectors.toList())
        val rightWords = words(right).collect(Collectors.toList())
        val shorterList = if (rightWords.size > leftWords.size) leftWords else rightWords
        val longerList: MutableList<String?> = if (rightWords.size > leftWords.size) rightWords else leftWords
        for (shortListWord in shorterList) {
            if (!contains(longerList, shortListWord, wordLevenshteinDistance)) {
                return false
            }
        }
        return true
    }

    private fun contains(words: MutableList<String?>, match: String?, maxLevenshteinDistance: Int): Boolean {
        var contained = false
        var matched: String? = null
        for (word in words) {
            if (levenshteinDistance(word, match) <= maxLevenshteinDistance) {
                contained = true
                matched = word
                break
            }
        }
        if (contained) {
            words.remove(matched)
        }
        return contained
    }

    fun countWords(text: String): Int {
        return words(text).count().toInt()
    }

    private fun words(sentence: String): Stream<String?> {
        return Arrays.stream(sentence.split("\\s+".toRegex()).toTypedArray())
            .filter { s: String? -> s!!.trim { it <= ' ' }.isNotEmpty() }
    }

    fun longestCommonSubSequence(a: String, b: String): Int {
        return lCSubStr(a.toCharArray(), b.toCharArray(), a.length, b.length)
    }

    private fun lCSubStr(X: CharArray, Y: CharArray, m: Int, n: Int): Int {
        // Create a table to store lengths of longest common suffixes of
        // substrings. Note that LCSuff[i][j] contains length of longest
        // common suffix of X[0..i-1] and Y[0..j-1]. The first row and
        // first column entries have no logical meaning, they are used only
        // for simplicity of program
        val lCStuff = Array(m + 1) { IntArray(n + 1) }
        var result = 0 // To store length of the longest common substring

        // Following steps build LCSuff[m+1][n+1] in bottom up fashion
        for (i in 0..m) {
            for (j in 0..n) {
                if (i == 0 || j == 0) lCStuff[i][j] = 0 else if (X[i - 1] == Y[j - 1]) {
                    lCStuff[i][j] = lCStuff[i - 1][j - 1] + 1
                    result = Integer.max(result, lCStuff[i][j])
                } else lCStuff[i][j] = 0
            }
        }
        return result
    }
}

Compiled from "Distances.kt"
public final class com.github.lernejo.korekto.toolkit.misc.Distances {
  public static final com.github.lernejo.korekto.toolkit.misc.Distances INSTANCE;

  private com.github.lernejo.korekto.toolkit.misc.Distances();
    Code:
       0: aload_0
       1: invokespecial #8                  // Method java/lang/Object."<init>":()V
       4: return

  private final int minimum(int, int, int);
    Code:
       0: nop
       1: iload_1
       2: iload_2
       3: invokestatic  #18                 // Method java/lang/Math.min:(II)I
       6: iload_3
       7: invokestatic  #18                 // Method java/lang/Math.min:(II)I
      10: ireturn

  public final int levenshteinDistance(java.lang.CharSequence, java.lang.CharSequence);
    Code:
       0: iconst_0
       1: istore        4
       3: aload_1
       4: dup
       5: invokestatic  #31                 // Method kotlin/jvm/internal/Intrinsics.checkNotNull:(Ljava/lang/Object;)V
       8: invokeinterface #37,  1           // InterfaceMethod java/lang/CharSequence.length:()I
      13: iconst_1
      14: iadd
      15: istore        5
      17: iload         5
      19: anewarray     #39                 // class "[I"
      22: astore        6
      24: iload         4
      26: iload         5
      28: if_icmpge     60
      31: iload         4
      33: istore        7
      35: aload         6
      37: iload         7
      39: aload_2
      40: dup
      41: invokestatic  #31                 // Method kotlin/jvm/internal/Intrinsics.checkNotNull:(Ljava/lang/Object;)V
      44: invokeinterface #37,  1           // InterfaceMethod java/lang/CharSequence.length:()I
      49: iconst_1
      50: iadd
      51: newarray       int
      53: aastore
      54: iinc          4, 1
      57: goto          24
      60: aload         6
      62: astore_3
      63: iconst_0
      64: istore        4
      66: aload_1
      67: invokeinterface #37,  1           // InterfaceMethod java/lang/CharSequence.length:()I
      72: istore        5
      74: iload         4
      76: iload         5
      78: if_icmpgt     102
      81: aload_3
      82: iload         4
      84: aaload
      85: iconst_0
      86: iload         4
      88: iastore
      89: iload         4
      91: iload         5
      93: if_icmpeq     102
      96: iinc          4, 1
      99: goto          81
     102: iconst_1
     103: istore        4
     105: aload_2
     106: dup
     107: invokestatic  #31                 // Method kotlin/jvm/internal/Intrinsics.checkNotNull:(Ljava/lang/Object;)V
     110: invokeinterface #37,  1           // InterfaceMethod java/lang/CharSequence.length:()I
     115: istore        5
     117: iload         4
     119: iload         5
     121: if_icmpgt     145
     124: aload_3
     125: iconst_0
     126: aaload
     127: iload         4
     129: iload         4
     131: iastore
     132: iload         4
     134: iload         5
     136: if_icmpeq     145
     139: iinc          4, 1
     142: goto          124
     145: iconst_1
     146: istore        4
     148: aload_1
     149: invokeinterface #37,  1           // InterfaceMethod java/lang/CharSequence.length:()I
     154: istore        5
     156: iload         4
     158: iload         5
     160: if_icmpgt     280
     163: iconst_1
     164: istore        6
     166: aload_2
     167: invokeinterface #37,  1           // InterfaceMethod java/lang/CharSequence.length:()I
     172: istore        7
     174: iload         6
     176: iload         7
     178: if_icmpgt     267
     181: aload_3
     182: iload         4
     184: aaload
     185: iload         6
     187: aload_0
     188: aload_3
     189: iload         4
     191: iconst_1
     192: isub
     193: aaload
     194: iload         6
     196: iaload
     197: iconst_1
     198: iadd
     199: aload_3
     200: iload         4
     202: aaload
     203: iload         6
     205: iconst_1
     206: isub
     207: iaload
     208: iconst_1
     209: iadd
     210: aload_3
     211: iload         4
     213: iconst_1
     214: isub
     215: aaload
     216: iload         6
     218: iconst_1
     219: isub
     220: iaload
     221: aload_1
     222: iload         4
     224: iconst_1
     225: isub
     226: invokeinterface #43,  2           // InterfaceMethod java/lang/CharSequence.charAt:(I)C
     231: aload_2
     232: iload         6
     234: iconst_1
     235: isub
     236: invokeinterface #43,  2           // InterfaceMethod java/lang/CharSequence.charAt:(I)C
     241: if_icmpne     248
     244: iconst_0
     245: goto          249
     248: iconst_1
     249: iadd
     250: invokespecial #45                 // Method minimum:(III)I
     253: iastore
     254: iload         6
     256: iload         7
     258: if_icmpeq     267
     261: iinc          6, 1
     264: goto          181
     267: iload         4
     269: iload         5
     271: if_icmpeq     280
     274: iinc          4, 1
     277: goto          163
     280: aload_3
     281: aload_1
     282: invokeinterface #37,  1           // InterfaceMethod java/lang/CharSequence.length:()I
     287: aaload
     288: aload_2
     289: invokeinterface #37,  1           // InterfaceMethod java/lang/CharSequence.length:()I
     294: iaload
     295: ireturn

  public final boolean isWordsIncludedApprox(java.lang.String, java.lang.String, int);
    Code:
       0: aload_1
       1: ldc           #58                 // String left
       3: invokestatic  #62                 // Method kotlin/jvm/internal/Intrinsics.checkNotNullParameter:(Ljava/lang/Object;Ljava/lang/String;)V
       6: aload_2
       7: ldc           #64                 // String right
       9: invokestatic  #62                 // Method kotlin/jvm/internal/Intrinsics.checkNotNullParameter:(Ljava/lang/Object;Ljava/lang/String;)V
      12: aload_0
      13: aload_1
      14: invokespecial #68                 // Method words:(Ljava/lang/String;)Ljava/util/stream/Stream;
      17: invokestatic  #74                 // Method java/util/stream/Collectors.toList:()Ljava/util/stream/Collector;
      20: invokeinterface #80,  2           // InterfaceMethod java/util/stream/Stream.collect:(Ljava/util/stream/Collector;)Ljava/lang/Object;
      25: checkcast     #82                 // class java/util/List
      28: astore        4
      30: aload_0
      31: aload_2
      32: invokespecial #68                 // Method words:(Ljava/lang/String;)Ljava/util/stream/Stream;
      35: invokestatic  #74                 // Method java/util/stream/Collectors.toList:()Ljava/util/stream/Collector;
      38: invokeinterface #80,  2           // InterfaceMethod java/util/stream/Stream.collect:(Ljava/util/stream/Collector;)Ljava/lang/Object;
      43: checkcast     #82                 // class java/util/List
      46: astore        5
      48: aload         5
      50: invokeinterface #85,  1           // InterfaceMethod java/util/List.size:()I
      55: aload         4
      57: invokeinterface #85,  1           // InterfaceMethod java/util/List.size:()I
      62: if_icmple     70
      65: aload         4
      67: goto          72
      70: aload         5
      72: astore        6
      74: aload         5
      76: invokeinterface #85,  1           // InterfaceMethod java/util/List.size:()I
      81: aload         4
      83: invokeinterface #85,  1           // InterfaceMethod java/util/List.size:()I
      88: if_icmple     101
      91: aload         5
      93: invokestatic  #31                 // Method kotlin/jvm/internal/Intrinsics.checkNotNull:(Ljava/lang/Object;)V
      96: aload         5
      98: goto          108
     101: aload         4
     103: invokestatic  #31                 // Method kotlin/jvm/internal/Intrinsics.checkNotNull:(Ljava/lang/Object;)V
     106: aload         4
     108: astore        7
     110: aload         6
     112: invokeinterface #89,  1           // InterfaceMethod java/util/List.iterator:()Ljava/util/Iterator;
     117: astore        8
     119: aload         8
     121: invokeinterface #95,  1           // InterfaceMethod java/util/Iterator.hasNext:()Z
     126: ifeq          155
     129: aload         8
     131: invokeinterface #99,  1           // InterfaceMethod java/util/Iterator.next:()Ljava/lang/Object;
     136: checkcast     #101                // class java/lang/String
     139: astore        9
     141: aload_0
     142: aload         7
     144: aload         9
     146: iload_3
     147: invokespecial #105                // Method contains:(Ljava/util/List;Ljava/lang/String;I)Z
     150: ifne          119
     153: iconst_0
     154: ireturn
     155: iconst_1
     156: ireturn

  private final boolean contains(java.util.List<java.lang.String>, java.lang.String, int);
    Code:
       0: iconst_0
       1: istore        4
       3: aconst_null
       4: astore        5
       6: aload_1
       7: invokeinterface #89,  1           // InterfaceMethod java/util/List.iterator:()Ljava/util/Iterator;
      12: astore        6
      14: aload         6
      16: invokeinterface #95,  1           // InterfaceMethod java/util/Iterator.hasNext:()Z
      21: ifeq          63
      24: aload         6
      26: invokeinterface #99,  1           // InterfaceMethod java/util/Iterator.next:()Ljava/lang/Object;
      31: checkcast     #101                // class java/lang/String
      34: astore        7
      36: aload_0
      37: aload         7
      39: checkcast     #33                 // class java/lang/CharSequence
      42: aload_2
      43: checkcast     #33                 // class java/lang/CharSequence
      46: invokevirtual #116                // Method levenshteinDistance:(Ljava/lang/CharSequence;Ljava/lang/CharSequence;)I
      49: iload_3
      50: if_icmpgt     14
      53: iconst_1
      54: istore        4
      56: aload         7
      58: astore        5
      60: goto          63
      63: iload         4
      65: ifeq          77
      68: aload_1
      69: aload         5
      71: invokeinterface #120,  2          // InterfaceMethod java/util/List.remove:(Ljava/lang/Object;)Z
      76: pop
      77: iload         4
      79: ireturn

  public final int countWords(java.lang.String);
    Code:
       0: aload_1
       1: ldc           #130                // String text
       3: invokestatic  #62                 // Method kotlin/jvm/internal/Intrinsics.checkNotNullParameter:(Ljava/lang/Object;Ljava/lang/String;)V
       6: aload_0
       7: aload_1
       8: invokespecial #68                 // Method words:(Ljava/lang/String;)Ljava/util/stream/Stream;
      11: invokeinterface #134,  1          // InterfaceMethod java/util/stream/Stream.count:()J
      16: l2i
      17: ireturn

  private final java.util.stream.Stream<java.lang.String> words(java.lang.String);
    Code:
       0: aload_1
       1: checkcast     #33                 // class java/lang/CharSequence
       4: astore_2
       5: new           #137                // class kotlin/text/Regex
       8: dup
       9: ldc           #139                // String \\s+
      11: invokespecial #142                // Method kotlin/text/Regex."<init>":(Ljava/lang/String;)V
      14: astore_3
      15: iconst_0
      16: istore        4
      18: aload_3
      19: aload_2
      20: iload         4
      22: invokevirtual #146                // Method kotlin/text/Regex.split:(Ljava/lang/CharSequence;I)Ljava/util/List;
      25: checkcast     #148                // class java/util/Collection
      28: astore_2
      29: nop
      30: iconst_0
      31: istore_3
      32: aload_2
      33: astore        4
      35: aload         4
      37: iconst_0
      38: anewarray     #101                // class java/lang/String
      41: invokeinterface #152,  2          // InterfaceMethod java/util/Collection.toArray:([Ljava/lang/Object;)[Ljava/lang/Object;
      46: invokestatic  #158                // Method java/util/Arrays.stream:([Ljava/lang/Object;)Ljava/util/stream/Stream;
      49: invokedynamic #178,  0            // InvokeDynamic #0:invoke:()Lkotlin/jvm/functions/Function1;
      54: invokedynamic #188,  0            // InvokeDynamic #1:test:(Lkotlin/jvm/functions/Function1;)Ljava/util/function/Predicate;
      59: invokeinterface #192,  2          // InterfaceMethod java/util/stream/Stream.filter:(Ljava/util/function/Predicate;)Ljava/util/stream/Stream;
      64: dup
      65: ldc           #194                // String filter(...)
      67: invokestatic  #197                // Method kotlin/jvm/internal/Intrinsics.checkNotNullExpressionValue:(Ljava/lang/Object;Ljava/lang/String;)V
      70: areturn

  public final int longestCommonSubSequence(java.lang.String, java.lang.String);
    Code:
       0: aload_1
       1: ldc           #205                // String a
       3: invokestatic  #62                 // Method kotlin/jvm/internal/Intrinsics.checkNotNullParameter:(Ljava/lang/Object;Ljava/lang/String;)V
       6: aload_2
       7: ldc           #206                // String b
       9: invokestatic  #62                 // Method kotlin/jvm/internal/Intrinsics.checkNotNullParameter:(Ljava/lang/Object;Ljava/lang/String;)V
      12: aload_0
      13: aload_1
      14: invokevirtual #210                // Method java/lang/String.toCharArray:()[C
      17: dup
      18: ldc           #212                // String toCharArray(...)
      20: invokestatic  #197                // Method kotlin/jvm/internal/Intrinsics.checkNotNullExpressionValue:(Ljava/lang/Object;Ljava/lang/String;)V
      23: aload_2
      24: invokevirtual #210                // Method java/lang/String.toCharArray:()[C
      27: dup
      28: ldc           #212                // String toCharArray(...)
      30: invokestatic  #197                // Method kotlin/jvm/internal/Intrinsics.checkNotNullExpressionValue:(Ljava/lang/Object;Ljava/lang/String;)V
      33: aload_1
      34: invokevirtual #213                // Method java/lang/String.length:()I
      37: aload_2
      38: invokevirtual #213                // Method java/lang/String.length:()I
      41: invokespecial #217                // Method lCSubStr:([C[CII)I
      44: ireturn

  private final int lCSubStr(char[], char[], int, int);
    Code:
       0: iconst_0
       1: istore        6
       3: iload_3
       4: iconst_1
       5: iadd
       6: istore        7
       8: iload         7
      10: anewarray     #39                 // class "[I"
      13: astore        8
      15: iload         6
      17: iload         7
      19: if_icmpge     43
      22: iload         6
      24: istore        9
      26: aload         8
      28: iload         9
      30: iload         4
      32: iconst_1
      33: iadd
      34: newarray       int
      36: aastore
      37: iinc          6, 1
      40: goto          15
      43: aload         8
      45: astore        5
      47: iconst_0
      48: istore        6
      50: iconst_0
      51: istore        7
      53: iload         7
      55: iload_3
      56: if_icmpgt     180
      59: iconst_0
      60: istore        8
      62: iload         8
      64: iload         4
      66: if_icmpgt     168
      69: iload         7
      71: ifeq          79
      74: iload         8
      76: ifne          91
      79: aload         5
      81: iload         7
      83: aaload
      84: iload         8
      86: iconst_0
      87: iastore
      88: goto          155
      91: aload_1
      92: iload         7
      94: iconst_1
      95: isub
      96: caload
      97: aload_2
      98: iload         8
     100: iconst_1
     101: isub
     102: caload
     103: if_icmpne     146
     106: aload         5
     108: iload         7
     110: aaload
     111: iload         8
     113: aload         5
     115: iload         7
     117: iconst_1
     118: isub
     119: aaload
     120: iload         8
     122: iconst_1
     123: isub
     124: iaload
     125: iconst_1
     126: iadd
     127: iastore
     128: iload         6
     130: aload         5
     132: iload         7
     134: aaload
     135: iload         8
     137: iaload
     138: invokestatic  #222                // Method java/lang/Integer.max:(II)I
     141: istore        6
     143: goto          155
     146: aload         5
     148: iload         7
     150: aaload
     151: iload         8
     153: iconst_0
     154: iastore
     155: iload         8
     157: iload         4
     159: if_icmpeq     168
     162: iinc          8, 1
     165: goto          69
     168: iload         7
     170: iload_3
     171: if_icmpeq     180
     174: iinc          7, 1
     177: goto          59
     180: iload         6
     182: ireturn

  private static final boolean words$lambda$1(java.lang.String);
    Code:
       0: aload_0
       1: dup
       2: invokestatic  #31                 // Method kotlin/jvm/internal/Intrinsics.checkNotNull:(Ljava/lang/Object;)V
       5: astore_1
       6: iconst_0
       7: istore_2
       8: aload_1
       9: checkcast     #33                 // class java/lang/CharSequence
      12: astore_3
      13: iconst_0
      14: istore        4
      16: iconst_0
      17: istore        5
      19: aload_3
      20: invokeinterface #37,  1           // InterfaceMethod java/lang/CharSequence.length:()I
      25: iconst_1
      26: isub
      27: istore        6
      29: iconst_0
      30: istore        7
      32: iload         5
      34: iload         6
      36: if_icmpgt     119
      39: iload         7
      41: ifne          49
      44: iload         5
      46: goto          51
      49: iload         6
      51: istore        8
      53: aload_3
      54: iload         8
      56: invokeinterface #43,  2           // InterfaceMethod java/lang/CharSequence.charAt:(I)C
      61: istore        9
      63: iconst_0
      64: istore        10
      66: iload         9
      68: bipush        32
      70: invokestatic  #233                // Method kotlin/jvm/internal/Intrinsics.compare:(II)I
      73: ifgt          80
      76: iconst_1
      77: goto          81
      80: iconst_0
      81: istore        9
      83: iload         7
      85: ifne          105
      88: iload         9
      90: ifne          99
      93: iconst_1
      94: istore        7
      96: goto          32
      99: iinc          5, 1
     102: goto          32
     105: iload         9
     107: ifne          113
     110: goto          119
     113: iinc          6, -1
     116: goto          32
     119: aload_3
     120: iload         5
     122: iload         6
     124: iconst_1
     125: iadd
     126: invokeinterface #237,  3          // InterfaceMethod java/lang/CharSequence.subSequence:(II)Ljava/lang/CharSequence;
     131: invokevirtual #241                // Method java/lang/Object.toString:()Ljava/lang/String;
     134: checkcast     #33                 // class java/lang/CharSequence
     137: invokeinterface #37,  1           // InterfaceMethod java/lang/CharSequence.length:()I
     142: ifle          149
     145: iconst_1
     146: goto          150
     149: iconst_0
     150: ireturn

  private static final boolean words$lambda$2(kotlin.jvm.functions.Function1, java.lang.Object);
    Code:
       0: aload_0
       1: aload_1
       2: invokeinterface #257,  2          // InterfaceMethod kotlin/jvm/functions/Function1.invoke:(Ljava/lang/Object;)Ljava/lang/Object;
       7: checkcast     #259                // class java/lang/Boolean
      10: invokevirtual #262                // Method java/lang/Boolean.booleanValue:()Z
      13: ireturn

  static {};
    Code:
       0: new           #2                  // class com/github/lernejo/korekto/toolkit/misc/Distances
       3: dup
       4: invokespecial #268                // Method "<init>":()V
       7: putstatic     #271                // Field INSTANCE:Lcom/github/lernejo/korekto/toolkit/misc/Distances;
      10: return
}