<commit_before>package fr.laas.fape.constraints.meta.domains

import fr.laas.fape.constraints.meta.util.Assertion._

trait Domain {

  /** Number of values in the domain */
  def size : Int

  def contains(value: Int) : Boolean

  /** All values in the domain */
  def values : Iterable[Int]

  /** Lowest value in the domain */
  def lb: Int

  /** Highest value in the domain */
  def ub: Int

  def intersection(other: Domain) : Domain = {
    val intersection = this.values.toSet.filter(other.contains)
    new EnumeratedDomain(intersection)
  }

  def &(other: Domain) : Domain = intersection(other)

  def union(other: Domain) : Domain = {
    val union = this.values.toSet ++ other.values
    new EnumeratedDomain(union)
  }

  def +(other: Domain) : Domain = union(other)

  def emptyIntersection(other: Domain) = (this & other).size == 0<commit_msg>[constraints] Added a contained by method in the Domain class.<commit_after>package fr.laas.fape.constraints.meta.domains

import fr.laas.fape.constraints.meta.util.Assertion._

trait Domain {

  /** Number of values in the domain */
  def size : Int

  def contains(value: Int) : Boolean

  /** All values in the domain */
  def values : Iterable[Int]

  /** Lowest value in the domain */
  def lb: Int

  /** Highest value in the domain */
  def ub: Int

  def intersection(other: Domain) : Domain = {
    val intersection = this.values.toSet.filter(other.contains)
    new EnumeratedDomain(intersection)
  }

  def &(other: Domain) : Domain = intersection(other)

  def union(other: Domain) : Domain = {
    val union = this.values.toSet ++ other.values
    new EnumeratedDomain(union)
  }

  def +(other: Domain) : Domain = union(other)

  def emptyIntersection(other: Domain) = (this & other).size == 0

  def containedBy(other: Domain) = (this & other).size == this.size
{'fraction_non_alphanumeric': 0.11995637949836423, 'fraction_numerical': 0.0010905125408942203, 'mean_word_length': 3.4216867469879517, 'pattern_counts': {'":': 0, '<': 3, '<?xml version=': 0, '>': 3, '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': '3143291', 'n_tokens_mistral': 610, 'n_tokens_neox': 564, 'n_words': 170}