org.nield.kotlinstatistics.range.XClosedRange.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 XClosedRange>(val startInclusive: T, override val endInclusive: T): Range, kotlin.ranges.ClosedRange by startInclusive..endInclusive {
init {
if (startInclusive > endInclusive) throw InvalidRangeException("[$startInclusive..$endInclusive] is an invalid XClosedRange!")
}
override val lowerBound get() = startInclusive
override val upperBound get() = endInclusive
override fun contains(value: T) = value in startInclusive..endInclusive
override fun isEmpty() = endInclusive == startInclusive
override fun toString() = "[$startInclusive..$endInclusive]"
}