<commit_before>package com.jakewharton.diffuse.diff

import com.jakewharton.diffuse.ApiMapping
import com.jakewharton.diffuse.Field
import com.jakewharton.diffuse.Jar
import com.jakewharton.diffuse.Method
import com.jakewharton.diffuse.diffuseTable
import com.jakewharton.diffuse.report.toDiffString
import com.jakewharton.picnic.TextAlignment.MiddleLeft
import com.jakewharton.picnic.TextAlignment.MiddleRight
import com.jakewharton.picnic.renderText

internal class JarsDiff(
  val oldJars: List<Jar>,
  val oldMapping: ApiMapping,
  val newJars: List<Jar>,
  val newMapping: ApiMapping
) {
  val classes = componentDiff(oldJars, newJars) { it.classes }
  val methods = componentDiff(oldJars, newJars) { it.members.filterIsInstance<Method>() }
  val declaredMethods = componentDiff(oldJars, newJars) { it.declaredMembers.filterIsInstance<Method>() }
  val referencedMethods = componentDiff(oldJars, newJars) { it.referencedMembers.filterIsInstance<Method>() }
  val fields = componentDiff(oldJars, newJars) { it.members.filterIsInstance<Field>() }
  val declaredFields = componentDiff(oldJars, newJars) { it.declaredMembers.filterIsInstance<Field>() }
  val referencedFields = componentDiff(oldJars, newJars) { it.referencedMembers.filterIsInstance<Field>() }

  val changed = methods.changed || fields.changed
}

internal fun JarsDiff.toSummaryTable() = diffuseTable {
  header {
    row {
      cell("JAR")
      cell("old")
      cell("new")
      cell("diff") {
        columnSpan = 2
      }<commit_msg>Diff classes by type only<commit_after>package com.jakewharton.diffuse.diff

import com.jakewharton.diffuse.ApiMapping
import com.jakewharton.diffuse.Class
import com.jakewharton.diffuse.Field
import com.jakewharton.diffuse.Jar
import com.jakewharton.diffuse.Method
import com.jakewharton.diffuse.diffuseTable
import com.jakewharton.diffuse.report.toDiffString
import com.jakewharton.picnic.TextAlignment.MiddleLeft
import com.jakewharton.picnic.TextAlignment.MiddleRight
import com.jakewharton.picnic.renderText

internal class JarsDiff(
  val oldJars: List<Jar>,
  val oldMapping: ApiMapping,
  val newJars: List<Jar>,
  val newMapping: ApiMapping
) {
  val classes = componentDiff(oldJars, newJars) { it.classes.map(Class::descriptor) }
  val methods = componentDiff(oldJars, newJars) { it.members.filterIsInstance<Method>() }
  val declaredMethods = componentDiff(oldJars, newJars) { it.declaredMembers.filterIsInstance<Method>() }
  val referencedMethods = componentDiff(oldJars, newJars) { it.referencedMembers.filterIsInstance<Method>() }
  val fields = componentDiff(oldJars, newJars) { it.members.filterIsInstance<Field>() }
  val declaredFields = componentDiff(oldJars, newJars) { it.declaredMembers.filterIsInstance<Field>() }
  val referencedFields = componentDiff(oldJars, newJars) { it.referencedMembers.filterIsInstance<Field>() }

  val changed = methods.changed || fields.changed
}

internal fun JarsDiff.toSummaryTable() = diffuseTable {
  header {
    row {
      cell("JAR")
      cell("old")
      cell("new")
      cell("diff") {
        columnSpan = 2
      }
{'fraction_non_alphanumeric': 0.10672703751617077, 'fraction_numerical': 0.000646830530401035, 'mean_word_length': 5.325153374233129, 'pattern_counts': {'":': 0, '<': 19, '<?xml version=': 0, '>': 19, 'https://': 0, 'lorem ipsum': 0, 'www.': 0, 'xml': 0}, 'pii_count': 0, 'substrings_counts': 0, 'word_list_counts': {'cursed_substrings.json': 0, 'profanity_word_list.json': 0, 'sexual_word_list.json': 0, 'zh_pornsignals.json': 0}}
{'dir': 'git-commits-cleaned', 'id': '2275795', 'n_tokens_mistral': 1022, 'n_tokens_neox': 989, 'n_words': 178}