All Downloads are FREE. Search and download functionalities are using the official Maven repository.

teststate.domzipper.MofN.scala Maven / Gradle / Ivy

There is a newer version: 2.3.0
Show newest version
package teststate.domzipper

final case class MofN(m: Int, n: Int) {
  override def toString = s"$m of $n"
  assert(n > 0, s"$this is invalid. $n must be > 0.")
  assert(m > 0, s"$this is invalid. $m must be > 0.")
  assert(m <= n, s"$this is invalid. $m must be ≤ $n.")
}

object MofN {
  val Sole = MofN(1, 1)

  final class IntExt(private val i: Int) extends AnyVal {
    def of(n: Int) = MofN(i, n)
  }
}




© 2015 - 2025 Weber Informatics LLC | Privacy Policy