Drop Range<T> interface and its extensions.

This commit is contained in:
Ilya Gorbunov
2015-11-27 18:29:23 +03:00
parent face6d449b
commit e8621cb738
5 changed files with 5 additions and 438 deletions
+3 -36
View File
@@ -20,45 +20,12 @@ package kotlin.ranges
* Represents a range of values (for example, numbers or characters).
* See the [Kotlin language documentation](http://kotlinlang.org/docs/reference/ranges.html) for more information.
*/
@Deprecated("This range has unclear inclusiveness of end value. Use ClosedRange instead.", ReplaceWith("ClosedRange<T>"))
public interface Range<T : Comparable<T>> {
public interface ClosedRange<T: Comparable<T>> {
/**
* The minimum value in the range.
*/
public val start: T
/**
* The maximum value in the range (inclusive).
*/
public val end: T
/**
* Checks if the specified [value] belongs to the range.
*/
public operator fun contains(value: T): Boolean
/**
* Checks if the range is empty.
*/
public fun isEmpty(): Boolean = start > end
}
/**
* Represents a range of values (for example, numbers or characters).
* See the [Kotlin language documentation](http://kotlinlang.org/docs/reference/ranges.html) for more information.
*/
public interface ClosedRange<T: Comparable<T>> : Range<T> {
/**
* The minimum value in the range.
*/
public override val start: T
/**
* The maximum value in the range (inclusive).
*/
@Deprecated("Use endInclusive instead.", ReplaceWith("endInclusive"))
public override val end: T get() = endInclusive
/**
* The maximum value in the range (inclusive).
*/
@@ -67,10 +34,10 @@ public interface ClosedRange<T: Comparable<T>> : Range<T> {
/**
* Checks whether the specified [value] belongs to the range.
*/
public override operator fun contains(value: T): Boolean = value >= start && value <= endInclusive
public operator fun contains(value: T): Boolean = value >= start && value <= endInclusive
/**
* Checks whether the range is empty.
*/
public override fun isEmpty(): Boolean = start > endInclusive
public fun isEmpty(): Boolean = start > endInclusive
}