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
@@ -13,15 +13,10 @@ fun ranges(): List<GenericFunction> {
fun <T> Collection<T>.permutations(): List<Pair<T, T>> = flatMap { a -> map { b -> a to b } }
templates add f("reversed()") {
only(RangesOfPrimitives, ProgressionsOfPrimitives)
only(ProgressionsOfPrimitives)
only(rangePrimitives)
doc(ProgressionsOfPrimitives) { "Returns a progression that goes over the same range in the opposite direction with the same step." }
doc(RangesOfPrimitives) { "Returns a progression that goes over this range in reverse direction." }
returns("TProgression")
deprecate(RangesOfPrimitives) { forBinaryCompatibility }
body(RangesOfPrimitives) {
"return TProgression.fromClosedRange(last, first, -ONE)"
}
body(ProgressionsOfPrimitives) {
"return TProgression.fromClosedRange(last, first, -step)"
}
@@ -30,18 +25,10 @@ fun ranges(): List<GenericFunction> {
templates add f("step(step: SUM)") {
infix(true)
only(RangesOfPrimitives, ProgressionsOfPrimitives)
only(ProgressionsOfPrimitives)
only(rangePrimitives)
doc(ProgressionsOfPrimitives) { "Returns a progression that goes over the same range with the given step." }
doc(RangesOfPrimitives) { "Returns a progression that goes over this range with given step." }
returns("TProgression")
deprecate(RangesOfPrimitives) { forBinaryCompatibility }
body(RangesOfPrimitives) {
"""
checkStepIsPositive(step > 0, step)
return TProgression.fromClosedRange(first, last, step)
"""
}
body(ProgressionsOfPrimitives) {
"""
checkStepIsPositive(step > 0, step)