Drop Progression<T> and its deprecated properties: start, end, increment.

Drop deprecated range extensions.
Make progression constructors private.
This commit is contained in:
Ilya Gorbunov
2016-01-14 20:19:52 +03:00
parent 6dd8470835
commit 91f4cf0ebc
15 changed files with 45 additions and 257 deletions
-51
View File
@@ -410,30 +410,6 @@ public fun LongProgression.reversed(): LongProgression {
return LongProgression.fromClosedRange(last, first, -step)
}
/**
* Returns a progression that goes over this range in reverse direction.
*/
@Deprecated("Provided for binary compatibility", level = DeprecationLevel.HIDDEN)
public fun CharRange.reversed(): CharProgression {
return CharProgression.fromClosedRange(last, first, -1)
}
/**
* Returns a progression that goes over this range in reverse direction.
*/
@Deprecated("Provided for binary compatibility", level = DeprecationLevel.HIDDEN)
public fun IntRange.reversed(): IntProgression {
return IntProgression.fromClosedRange(last, first, -1)
}
/**
* Returns a progression that goes over this range in reverse direction.
*/
@Deprecated("Provided for binary compatibility", level = DeprecationLevel.HIDDEN)
public fun LongRange.reversed(): LongProgression {
return LongProgression.fromClosedRange(last, first, -1L)
}
/**
* Returns a progression that goes over the same range with the given step.
*/
@@ -458,33 +434,6 @@ public infix fun LongProgression.step(step: Long): LongProgression {
return LongProgression.fromClosedRange(first, last, if (this.step > 0) step else -step)
}
/**
* Returns a progression that goes over this range with given step.
*/
@Deprecated("Provided for binary compatibility", level = DeprecationLevel.HIDDEN)
public infix fun CharRange.step(step: Int): CharProgression {
checkStepIsPositive(step > 0, step)
return CharProgression.fromClosedRange(first, last, step)
}
/**
* Returns a progression that goes over this range with given step.
*/
@Deprecated("Provided for binary compatibility", level = DeprecationLevel.HIDDEN)
public infix fun IntRange.step(step: Int): IntProgression {
checkStepIsPositive(step > 0, step)
return IntProgression.fromClosedRange(first, last, step)
}
/**
* Returns a progression that goes over this range with given step.
*/
@Deprecated("Provided for binary compatibility", level = DeprecationLevel.HIDDEN)
public infix fun LongRange.step(step: Long): LongProgression {
checkStepIsPositive(step > 0, step)
return LongProgression.fromClosedRange(first, last, step)
}
/**
* Returns a range from this value up to but excluding the specified [to] value.
*/
@@ -27,14 +27,6 @@ public fun<T> Enumeration<T>.asSequence(): Sequence<T> = this.iterator().asSeque
*/
public fun <T> sequenceOf(vararg elements: T): Sequence<T> = if (elements.isEmpty()) emptySequence() else elements.asSequence()
/**
* Creates a sequence that returns all values in the specified [progression].
*/
@Deprecated("Use progression.asSequence() instead.", ReplaceWith("progression.asSequence()"))
public fun <T : Any> sequenceOf(progression: Progression<T>): Sequence<T> = object : Sequence<T> {
override fun iterator(): Iterator<T> = progression.iterator()
}
/**
* Returns an empty sequence.
*/
@@ -223,6 +223,7 @@ public fun String.replaceRange(firstIndex: Int, lastIndex: Int, replacement: Str
public fun String.replaceRange(range: IntRange, replacement: String): String
= replaceRange(range.start, range.end + 1, replacement)
private val IntRange.end: Int get() = endInclusive
@Deprecated("Provided for binary compatibility", level = DeprecationLevel.HIDDEN)
public fun String.removePrefix(prefix: String): String = removePrefix(prefix)