<commit_before>package com.ing.baker.java_api

import scala.collection.JavaConverters._

/**
  * Java API class wrapping a sequence of events for a process instance.
  *
  * @param events The event sequence.
  */
class EventList(private val events: Seq[Any]) extends java.util.AbstractList[AnyRef] {

  def this() = this(Seq.empty)

  def this(events: java.util.List[AnyRef]) = this(events.asScala)

  override def get(index: Int): AnyRef = events.apply(index).asInstanceOf[AnyRef]

  override def size(): Int = events.size

  /**
    * Returns whether an event occurred or not.
    *
    * @param clazz The event class.
    *
    * @return
    */
  def eventOccurred(clazz: Class[_]): Boolean = events.exists(e => clazz.isInstance(e))

  /**
    * Returns the number of times an event occurred.
    *
    * @param clazz The event class.
    *
    * @return The number of times an event occurred.
    */
  def eventCount(clazz: Class[_]): Int = events.filter(e => clazz.isInstance(e)).size

  /**
    * Returns a list of the event classes.
    *
    * @return A list of event classes.
    */
  def eventClassList: java.util.List[Class[_]] = events.toList.map(_.getClass).asJava
}<commit_msg>in java_api; added getEventNameList to EventList, renamed other methods to be more java style<commit_after>package com.ing.baker.java_api

import scala.collection.JavaConverters._

/**
  * Java API class wrapping a sequence of events for a process instance.
  *
  * @param events The event sequence.
  */
class EventList(private val events: Seq[Any]) extends java.util.AbstractList[AnyRef] {

  def this() = this(Seq.empty)

  def this(events: java.util.List[AnyRef]) = this(events.asScala)

  override def get(index: Int): AnyRef = events.apply(index).asInstanceOf[AnyRef]

  override def size(): Int = events.size

  /**
    * Returns whether an event occurred or not.
    *
    * @param clazz The event class.
    *
    * @return
    */
  def hasEventOccurred(clazz: Class[_]): Boolean = events.exists(e => clazz.isInstance(e))

  /**
    * Returns the number of times an event occurred.
    *
    * @param clazz The event class.
    *
    * @return The number of times an event occurred.
    */
  def getEventCount(clazz: Class[_]): Int = events.filter(e => clazz.isInstance(e)).size

  /**
    * Returns a list of the event classes.
    *
    * @return A list of event classes.
    */
  def getEventClassList: java.util.List[Class[_]] = events.toList.map(_.getClass).asJava

  /**
    * Returns a list of the event classes.
    *
    * @return A list of event classes.
    */
  def getEventNameList: java.util.List[String] = events.map(_.getClass.getName).asJava
}
{'fraction_non_alphanumeric': 0.12142857142857143, 'fraction_numerical': 0.0, 'mean_word_length': 3.1448598130841123, 'pattern_counts': {'":': 0, '<': 3, '<?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': '5709928', 'n_tokens_mistral': 855, 'n_tokens_neox': 833, 'n_words': 248}