<commit_before>package sfc.board

import akka.actor.Actor

/**
 * @author <EMAIL>
 */
class ValidCountActor extends Actor {
  import ValidCountActor._

  def receive = {
    case board: Board => {
      if (board.check) {
        result += 1
      }

      count += 1
    }

    case GetResult(expectedCount) => {
      // TODO: use stash
      if (count == expectedCount) {
        sender ! Pair(result, count)
      } else {
        self forward GetResult(expectedCount)
      }
    }
  }
}

object ValidCountActor {
  case class GetResult(expectedCount: Int)

  // TODO: remove use of var
  var result = 0
  var count = 0
}<commit_msg>Use of var removed.<commit_after>package sfc.board

import akka.actor.Actor

/**
 * @author <EMAIL>
 */
class ValidCountActor extends Actor {
  import ValidCountActor._

  private def processMessages(numberOfValidBoards: Int, sampleSize: Int): Receive = {
    case board: Board => {
      implicit def booleanToInt(b: Boolean) = if (b) {
        1
      } else {
        0
      }

      context.become(processMessages(numberOfValidBoards + board.check, sampleSize + 1))
    }

    case GetResult(expectedSampleSize) => {
      // TODO: use stash
      if (sampleSize == expectedSampleSize) {
        sender ! Pair(numberOfValidBoards, sampleSize)
      } else {
        self forward GetResult(expectedSampleSize)
      }
    }
  }

  def receive = processMessages(0, 0)
}

object ValidCountActor {
  case class GetResult(expectedCount: Int)
}
{'fraction_non_alphanumeric': 0.10263335584064821, 'fraction_numerical': 0.006076975016880486, 'mean_word_length': 2.5285714285714285, 'pattern_counts': {'":': 0, '<': 5, '<?xml version=': 0, '>': 9, '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': '4613610', 'n_tokens_mistral': 467, 'n_tokens_neox': 448, 'n_words': 118}