<commit_before>package com.gilesc.scalacasts

import akka.actor.{ActorRef, Props}
import com.gilesc.commons.akka.BaseActor

object Library {
  val name: String = "scalacasts-library"

  case class AddScreencast(screencast: Screencast)
  case class RemoveScreencast(title: Title)

  case class FindByTitle(name: Title)
  case class ScreencastResults(screencasts: Set[Screencast])

  case object AllScreencasts

  def props(): Props = Props(new Library)
}

/**
  * Library is a host for all videos on the site
  */
class Library extends BaseActor {
  import Library._

  var screencasts: Set[Screencast] = Set.empty[Screencast]

  override def receive: Receive = {
    case Receptionist.RequestContext(request, replyTo) =>
      request match {
        case AddScreencast(screencast) => add(screencast, replyTo)
        case RemoveScreencast(title) => remove(title, replyTo)
        case FindByTitle(title) =>
          val cast = screencasts.filter(_.title == title)
        case AllScreencasts => sender() ! ScreencastResults(screencasts)
      }
  }

  def add(screencast: Screencast, replyTo: ActorRef): Unit = {
    log.info("Adding Screencast to library: {}", screencast.title)
    screencasts = screencasts + screencast

    replyTo ! Receptionist.Successful(true)
  }

  def remove(title: Title, replyTo: ActorRef): Unit = {
    log.info("Removing Screencast from library: {}", title)
    screencasts = screencasts.filterNot(_.title == title)

    replyTo ! Receptionist.Successful(true)
  }
}
<commit_msg>Documentation<commit_after>package com.gilesc.scalacasts

import akka.actor.{ActorRef, Props}
import com.gilesc.commons.akka.BaseActor

object Library {
  val name: String = "scalacasts-library"

  case class AddScreencast(screencast: Screencast)
  case class RemoveScreencast(title: Title)

  case class FindByTitle(name: Title)
  case class ScreencastResults(screencasts: Set[Screencast])

  case object AllScreencasts

  def props(): Props = Props(new Library)
}

/**
  * Library is a host for all screencasts on the site
  */
class Library extends BaseActor {
  import Library._

  var screencasts: Set[Screencast] = Set.empty[Screencast]

  override def receive: Receive = {
    case Receptionist.RequestContext(request, replyTo) =>
      request match {
        case AddScreencast(screencast) => add(screencast, replyTo)
        case RemoveScreencast(title) => remove(title, replyTo)
        case FindByTitle(title) =>
          val cast = screencasts.filter(_.title == title)
        case AllScreencasts => sender() ! ScreencastResults(screencasts)
      }
  }

  def add(screencast: Screencast, replyTo: ActorRef): Unit = {
    log.info("Adding Screencast to library: {}", screencast.title)
    screencasts = screencasts + screencast

    replyTo ! Receptionist.Successful(true)
  }

  def remove(title: Title, replyTo: ActorRef): Unit = {
    log.info("Removing Screencast from library: {}", title)
    screencasts = screencasts.filterNot(_.title == title)

    replyTo ! Receptionist.Successful(true)
  }
}

{'fraction_non_alphanumeric': 0.10234400792340706, 'fraction_numerical': 0.0, 'mean_word_length': 3.9590834697217674, 'pattern_counts': {'":': 0, '<': 3, '<?xml version=': 0, '>': 13, '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': '2271601', 'n_tokens_mistral': 1023, 'n_tokens_neox': 940, 'n_words': 232}