<commit_before>package akka.dispatch.verification

import akka.actor.{ActorCell, ActorRef, ActorSystem, Props}
import akka.dispatch.Envelope

import scala.collection.mutable.ListBuffer
import scala.collection.generic.Growable
import scala.collection.mutable.Queue
import scala.collection.mutable.ArrayBuffer
import scala.collection.mutable.HashMap
import scala.collection.mutable.HashSet

import scala.pickling.io.TextFileOutput
import scala.pickling.Defaults._
import scala.pickling._
import json._

// Internal api
case class UniqueMsgSend(m: MsgSend, id: Int) extends Event
case class UniqueMsgEvent(m: MsgEvent, id: Int) extends Event

object EventTrace {
  def deserialize(data: pickling.json.pickleFormat.PickleType) : EventTrace = {
    val tuple = data.unpickle[Tuple2[Queue[Event], Seq[ExternalEvent]]]
    return new EventTrace(tuple._1, tuple._2)
  }
}

case class EventTrace(val events: Queue[Event], var original_externals: Seq[ExternalEvent]) extends Growable[Event] with Iterable[Event] {
  def this() = this(new Queue[Event], null)
  def this(events: Queue[Event]) = this(events, null)
  def this(original_externals: Seq[ExternalEvent]) = this(new Queue[Event], original_externals)

  override def hashCode = this.events.hashCode
  override def equals(other: Any) : Boolean = other match {
    case that: EventTrace => this.events == that.events
    case _ => false
  }

  // Optional: if you have the original external events, that helps us with
  // filtering.
  def setOriginalExternalEvents(_original_externals: Seq[ExternalEvent]) = {
    original_externals = _original_externals
  }

  def copy() : EventTrace = {
    assume(original_externals != null)
    assume(!events.isEmpty)
    assume(!original_externals.isEmpty)
    return new EventTrace(new Queue[Event] ++ events,
                          new Queue[ExternalEvent] ++ original_externals)
  }

  def serializeToFile(file: TextFileOutput) {
    (events, original_externals).pickleTo(file)
  }

  def getEvents() : Seq[Event] = {
    return events.map(e =>
      e match {
        case UniqueMsgSend(m, id) => m
        case UniqueMsgEvent(m, id) => m
        case i: Event => i<commit_msg>Remove pickling support for now, which seems to break the build for some reason<commit_after>package akka.dispatch.verification

import akka.actor.{ActorCell, ActorRef, ActorSystem, Props}
import akka.dispatch.Envelope

import scala.collection.mutable.ListBuffer
import scala.collection.generic.Growable
import scala.collection.mutable.Queue
import scala.collection.mutable.ArrayBuffer
import scala.collection.mutable.HashMap
import scala.collection.mutable.HashSet

// import scala.pickling.io.TextFileOutput
// import scala.pickling.Defaults._
// import scala.pickling.json
// import json._

// Internal api
case class UniqueMsgSend(m: MsgSend, id: Int) extends Event
case class UniqueMsgEvent(m: MsgEvent, id: Int) extends Event

object EventTrace {
  def deserialize(data: pickling.json.pickleFormat.PickleType) : EventTrace = {
    // val tuple = data.unpickle[Tuple2[Queue[Event], Seq[ExternalEvent]]]
    // return new EventTrace(tuple._1, tuple._2)
    return null
  }
}

case class EventTrace(val events: Queue[Event], var original_externals: Seq[ExternalEvent]) extends Growable[Event] with Iterable[Event] {
  def this() = this(new Queue[Event], null)
  def this(events: Queue[Event]) = this(events, null)
  def this(original_externals: Seq[ExternalEvent]) = this(new Queue[Event], original_externals)

  override def hashCode = this.events.hashCode
  override def equals(other: Any) : Boolean = other match {
    case that: EventTrace => this.events == that.events
    case _ => false
  }

  // Optional: if you have the original external events, that helps us with
  // filtering.
  def setOriginalExternalEvents(_original_externals: Seq[ExternalEvent]) = {
    original_externals = _original_externals
  }

  def copy() : EventTrace = {
    assume(original_externals != null)
    assume(!events.isEmpty)
    assume(!original_externals.isEmpty)
    return new EventTrace(new Queue[Event] ++ events,
                          new Queue[ExternalEvent] ++ original_externals)
  }

  def serializeToFile(file: TextFileOutput) {
    // (events, original_externals).pickleTo(file)
  }

  def getEvents() : Seq[Event] = {
    return events.map(e =>
      e match {
        case UniqueMsgSend(m, id) => m
        case UniqueMsgEvent(m, id) => m
        case i: Event => i
{'fraction_non_alphanumeric': 0.10368870895186684, 'fraction_numerical': 0.001349527665317139, 'mean_word_length': 4.213364595545134, 'pattern_counts': {'":': 0, '<': 3, '<?xml version=': 0, '>': 15, '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': '2492383', 'n_tokens_mistral': 1386, 'n_tokens_neox': 1355, 'n_words': 342}