<commit_before>package ch.fhnw.saav.model

import ch.fhnw.saav.model.model.Entity.{Organisation, Person, Project}

import scala.collection.mutable
import scala.collection.mutable.ListBuffer

object model {

  trait Analysis[E <: Entity] {

    def categories: Seq[Category]

    def entities: Seq[E]

    def reviews: Seq[Review]

    def value(entity: E, indicator: Indicator, review: Review): Option[Double]

    def groupedValue(entity: E, indicator: Indicator): Option[Double]

    def groupedValue(entity: E, subCategory: SubCategory): Option[Double]

    def groupedValue(entity: E, category: Category): Option[Double]

  }

  trait Category {
    def name: String
    def subCategories: Seq[SubCategory]
  }

  trait SubCategory {
    def name: String
    def indicators: Seq[Indicator]
  }

  trait Indicator {
    def name: String
  }

  case class Review(name: String)

  abstract class Entity(name: String)

  object Entity {

    final case class Project(name: String) extends Entity(name)

    final case class Person(name: String) extends Entity(name)

    final case class Organisation(name: String) extends Entity(name)

  }

  object AnalysisBuilder {
    def projectAnalysisBuilder = AnalysisBuilder[Project]()

    def personAnalysisBuilder = AnalysisBuilder[Person]()

    def organisationAnalysisBuilder = AnalysisBuilder[Organisation]()
  }

  case class AnalysisBuilder[E <: Entity]() {

    private val categories: ListBuffer[MutableCategoryScope] = ListBuffer()

    def category(categoryName: String): CategoryScope = {
      val existingCategory = categories.find(_.name == categoryName)
      existingCategory match {
        case Some(c) => c
        case None =>
          val category = new MutableCategoryScope(categoryName)<commit_msg>#9: Seal abstract Entity class<commit_after>package ch.fhnw.saav.model

import ch.fhnw.saav.model.model.Entity.{Organisation, Person, Project}

import scala.collection.mutable
import scala.collection.mutable.ListBuffer

object model {

  trait Analysis[E <: Entity] {

    def categories: Seq[Category]

    def entities: Seq[E]

    def reviews: Seq[Review]

    def value(entity: E, indicator: Indicator, review: Review): Option[Double]

    def groupedValue(entity: E, indicator: Indicator): Option[Double]

    def groupedValue(entity: E, subCategory: SubCategory): Option[Double]

    def groupedValue(entity: E, category: Category): Option[Double]

  }

  trait Category {
    def name: String
    def subCategories: Seq[SubCategory]
  }

  trait SubCategory {
    def name: String
    def indicators: Seq[Indicator]
  }

  trait Indicator {
    def name: String
  }

  case class Review(name: String)

  sealed abstract class Entity(name: String)

  object Entity {

    final case class Project(name: String) extends Entity(name)

    final case class Person(name: String) extends Entity(name)

    final case class Organisation(name: String) extends Entity(name)

  }

  object AnalysisBuilder {
    def projectAnalysisBuilder = AnalysisBuilder[Project]()

    def personAnalysisBuilder = AnalysisBuilder[Person]()

    def organisationAnalysisBuilder = AnalysisBuilder[Organisation]()
  }

  case class AnalysisBuilder[E <: Entity]() {

    private val categories: ListBuffer[MutableCategoryScope] = ListBuffer()

    def category(categoryName: String): CategoryScope = {
      val existingCategory = categories.find(_.name == categoryName)
      existingCategory match {
        case Some(c) => c
        case None =>
          val category = new MutableCategoryScope(categoryName)
{'fraction_non_alphanumeric': 0.09157303370786517, 'fraction_numerical': 0.0002808988764044944, 'mean_word_length': 3.9049586776859506, 'pattern_counts': {'":': 0, '<': 7, '<?xml version=': 0, '>': 7, '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': '2641968', 'n_tokens_mistral': 1031, 'n_tokens_neox': 980, 'n_words': 286}