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

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

There is a newer version: 1.2.1
Show newest version
package org.nield.kotlinstatistics.range

class OpenRange>(val startExclusive: T, val endExclusive: T): Range {

    init {
        if (startExclusive == endExclusive ||
                startExclusive > endExclusive) throw InvalidRangeException("($startExclusive..$endExclusive) is an invalid OpenRange!")
    }

    override val lowerBound get() = startExclusive

    override val upperBound get() = endExclusive

    override fun contains(value: T) = value > startExclusive && value < endExclusive

    override fun isEmpty() = endExclusive <= startExclusive

    override fun toString() = "($startExclusive..$endExclusive)"
}





© 2015 - 2024 Weber Informatics LLC | Privacy Policy