<commit_before>package com.sedsoftware.yaptalker.presentation.mappers

import com.sedsoftware.yaptalker.domain.entity.BaseEntity
import com.sedsoftware.yaptalker.domain.entity.base.NavigationPanel
import com.sedsoftware.yaptalker.domain.entity.base.SinglePost
import com.sedsoftware.yaptalker.domain.entity.base.TopicInfoBlock
import com.sedsoftware.yaptalker.presentation.mappers.util.TextTransformer
import com.sedsoftware.yaptalker.presentation.model.YapEntity
import com.sedsoftware.yaptalker.presentation.model.base.NavigationPanelModel
import com.sedsoftware.yaptalker.presentation.model.base.SinglePostGalleryImageModel
import com.sedsoftware.yaptalker.presentation.model.base.TopicInfoBlockModel
import io.reactivex.functions.Function
import java.util.ArrayList
import javax.inject.Inject

/**
 * Mapper class used to transform single topic image list entities from the domain layer into YapEntity list
 * in the presentation layer.
 */
class TopicGalleryModelMapper @Inject constructor(
  private val textTransformer: TextTransformer
) : Function<List<BaseEntity>, List<YapEntity>> {

  override fun apply(items: List<BaseEntity>): List<YapEntity> {

    val result: MutableList<YapEntity> = ArrayList()
    val imagesList: MutableList<String> = ArrayList()
    var currentPage = 0
    var totalPages = 0

    items.forEach { item ->
      when (item) {
        is TopicInfoBlock -> result.add(
          TopicInfoBlockModel(
            topicTitle = item.topicTitle,
            isClosed = item.isClosed,
            authKey = item.authKey,
            topicRating = item.topicRating,
            topicRatingPlusAvailable = item.topicRatingPlusAvailable,
            topicRatingMinusAvailable = item.topicRatingMinusAvailable,
            topicRatingPlusClicked = item.topicRatingPlusClicked,
            topicRatingMinusClicked = item.topicRatingMinusClicked,
            topicRatingTargetId = item.topicRatingTargetId
          )
        )

        is NavigationPanel -> {
          currentPage = item.currentPage
          totalPages = item.totalPages
          result.add(
            NavigationPanelModel(
              currentPage = item.currentPage,<commit_msg>Remove unused vars<commit_after>package com.sedsoftware.yaptalker.presentation.mappers

import com.sedsoftware.yaptalker.domain.entity.BaseEntity
import com.sedsoftware.yaptalker.domain.entity.base.NavigationPanel
import com.sedsoftware.yaptalker.domain.entity.base.SinglePost
import com.sedsoftware.yaptalker.domain.entity.base.TopicInfoBlock
import com.sedsoftware.yaptalker.presentation.mappers.util.TextTransformer
import com.sedsoftware.yaptalker.presentation.model.YapEntity
import com.sedsoftware.yaptalker.presentation.model.base.NavigationPanelModel
import com.sedsoftware.yaptalker.presentation.model.base.SinglePostGalleryImageModel
import com.sedsoftware.yaptalker.presentation.model.base.TopicInfoBlockModel
import io.reactivex.functions.Function
import java.util.ArrayList
import javax.inject.Inject

/**
 * Mapper class used to transform single topic image list entities from the domain layer into YapEntity list
 * in the presentation layer.
 */
class TopicGalleryModelMapper @Inject constructor(
  private val textTransformer: TextTransformer
) : Function<List<BaseEntity>, List<YapEntity>> {

  override fun apply(items: List<BaseEntity>): List<YapEntity> {

    val result: MutableList<YapEntity> = ArrayList()
    val imagesList: MutableList<String> = ArrayList()

    items.forEach { item ->
      when (item) {
        is TopicInfoBlock -> result.add(
          TopicInfoBlockModel(
            topicTitle = item.topicTitle,
            isClosed = item.isClosed,
            authKey = item.authKey,
            topicRating = item.topicRating,
            topicRatingPlusAvailable = item.topicRatingPlusAvailable,
            topicRatingMinusAvailable = item.topicRatingMinusAvailable,
            topicRatingPlusClicked = item.topicRatingPlusClicked,
            topicRatingMinusClicked = item.topicRatingMinusClicked,
            topicRatingTargetId = item.topicRatingTargetId
          )
        )

        is NavigationPanel -> {
          result.add(
            NavigationPanelModel(
              currentPage = item.currentPage,
{'fraction_non_alphanumeric': 0.07557864903164856, 'fraction_numerical': 0.0004723665564478035, 'mean_word_length': 3.669239250275634, 'pattern_counts': {'":': 0, '<': 17, '<?xml version=': 0, '>': 23, 'https://': 0, 'lorem ipsum': 0, 'www.': 0, 'xml': 0}, 'pii_count': 0, 'substrings_counts': 0, 'word_list_counts': {'cursed_substrings.json': 0, 'profanity_word_list.json': 0, 'sexual_word_list.json': 0, 'zh_pornsignals.json': 0}}
{'dir': 'git-commits-cleaned', 'id': '5940623', 'n_tokens_mistral': 1207, 'n_tokens_neox': 1132, 'n_words': 215}