<commit_before>package org.scalameter
package utils



import collection._



case class Tree[T](context: Context, items: Seq[T], children: Seq[Tree[T]]) {
  def foreach[U](f: T => U) {
    for (x <- items) f(x)
    for (child <- children; x <- child) f(x)
  }

  def map[S](f: T => S): Tree[S] = {
    val mappeditems = for (x <- items) yield f(x)
    val mappedchildren = for (child <- children) yield child.map(f)
    Tree(context, mappeditems, mappedchildren)
  }

  def filter(p: T => Boolean): Tree[T] = {
    val filtereditems = for (x <- items if p(x)) yield x
    val filteredchildren = for (child <- children) yield child.filter(p)
    Tree(context, filtereditems, filteredchildren)
  }

  def scopes = new Traversable[(Context, Seq[T])] {
    private def recurse[U](f: ((Context, Seq[T])) => U, tree: Tree[T]) {
      f(tree.context -> tree.items)
      for (n <- tree.children) recurse(f, n)
    }
    def foreach[U](f: ((Context, Seq[T])) => U) {
      recurse(f, Tree.this)
    }
  }

  override def toString = s"Tree(${context.get(FrameworkKey.dsl.executor)}, $items, $children)"
}


object Tree {

  case class Zipper[T](current: Tree[T], path: Zipper.Path[T]) {
    import Zipper._
    def addContext[T](kv: (Key[T], T)) = Zipper(current.copy(context = current.context + kv), path)
    def modifyContext(f: Context => Context) = setContext(f(current.context))
    def setContext(ctx: Context) = Zipper(current.copy(context = ctx), path)<commit_msg>Fix warning.<commit_after>package org.scalameter
package utils



import collection._



case class Tree[T](context: Context, items: Seq[T], children: Seq[Tree[T]]) {
  def foreach[U](f: T => U) {
    for (x <- items) f(x)
    for (child <- children; x <- child) f(x)
  }

  def map[S](f: T => S): Tree[S] = {
    val mappeditems = for (x <- items) yield f(x)
    val mappedchildren = for (child <- children) yield child.map(f)
    Tree(context, mappeditems, mappedchildren)
  }

  def filter(p: T => Boolean): Tree[T] = {
    val filtereditems = for (x <- items if p(x)) yield x
    val filteredchildren = for (child <- children) yield child.filter(p)
    Tree(context, filtereditems, filteredchildren)
  }

  def scopes = new Traversable[(Context, Seq[T])] {
    private def recurse[U](f: ((Context, Seq[T])) => U, tree: Tree[T]) {
      f(tree.context -> tree.items)
      for (n <- tree.children) recurse(f, n)
    }
    def foreach[U](f: ((Context, Seq[T])) => U) {
      recurse(f, Tree.this)
    }
  }

  override def toString = s"Tree(${context.get(FrameworkKey.dsl.executor)}, $items, $children)"
}


object Tree {

  case class Zipper[T](current: Tree[T], path: Zipper.Path[T]) {
    import Zipper._
    def addContext[S](kv: (Key[S], S)) = Zipper(current.copy(context = current.context + kv), path)
    def modifyContext(f: Context => Context) = setContext(f(current.context))
    def setContext(ctx: Context) = Zipper(current.copy(context = ctx), path)
{'fraction_non_alphanumeric': 0.16831683168316833, 'fraction_numerical': 0.0, 'mean_word_length': 3.5426356589147288, 'pattern_counts': {'":': 0, '<': 19, '<?xml version=': 0, '>': 17, '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': '1452203', 'n_tokens_mistral': 1044, 'n_tokens_neox': 1012, 'n_words': 272}