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

org.nield.kotlinstatistics.range.XClosedRange.kt Maven / Gradle / Ivy

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]"
}





© 2015 - 2024 Weber Informatics LLC | Privacy Policy