org.nield.kotlinstatistics.range.OpenClosedRange.kt Maven / Gradle / Ivy
Go to download
Show more of this group Show more artifacts with this name
Show all versions of kotlin-statistics Show documentation
Show all versions of kotlin-statistics Show documentation
Statistical and analytical extensions for Kotlin
The newest version!
package org.nield.kotlinstatistics.range
class OpenClosedRange>(val startExclusive: T, val endInclusive: T): Range {
init {
if (startExclusive > endInclusive) throw InvalidRangeException("($startExclusive..$endInclusive] is an invalid OpenClosedRange!")
}
override val lowerBound get() = startExclusive
override val upperBound get() = endInclusive
override fun contains(value: T) = value > startExclusive && value <= endInclusive
override fun isEmpty() = endInclusive == startExclusive
override fun toString() = "($startExclusive..$endInclusive]"
}