Renamed NumberSequence to Progression.

This commit is contained in:
Evgeny Gerashchenko
2013-01-29 21:54:55 +04:00
parent dd4b508213
commit 58f37f38f4
34 changed files with 326 additions and 327 deletions
+98 -98
View File
@@ -6,198 +6,198 @@ package kotlin
//
public inline fun Byte.downTo(to: Byte): ByteSequence {
return ByteSequence(this, to, -1)
public inline fun Byte.downTo(to: Byte): ByteProgression {
return ByteProgression(this, to, -1)
}
public inline fun Byte.downTo(to: Char): CharacterSequence {
return CharacterSequence(this.toChar(), to, -1)
public inline fun Byte.downTo(to: Char): CharProgression {
return CharProgression(this.toChar(), to, -1)
}
public inline fun Byte.downTo(to: Short): ShortSequence {
return ShortSequence(this.toShort(), to, -1)
public inline fun Byte.downTo(to: Short): ShortProgression {
return ShortProgression(this.toShort(), to, -1)
}
public inline fun Byte.downTo(to: Int): IntSequence {
return IntSequence(this.toInt(), to, -1)
public inline fun Byte.downTo(to: Int): IntProgression {
return IntProgression(this.toInt(), to, -1)
}
public inline fun Byte.downTo(to: Long): LongSequence {
return LongSequence(this.toLong(), to, -1.toLong())
public inline fun Byte.downTo(to: Long): LongProgression {
return LongProgression(this.toLong(), to, -1.toLong())
}
public inline fun Byte.downTo(to: Float): FloatSequence {
return FloatSequence(this.toFloat(), to, -1.toFloat())
public inline fun Byte.downTo(to: Float): FloatProgression {
return FloatProgression(this.toFloat(), to, -1.toFloat())
}
public inline fun Byte.downTo(to: Double): DoubleSequence {
return DoubleSequence(this.toDouble(), to, -1.0)
public inline fun Byte.downTo(to: Double): DoubleProgression {
return DoubleProgression(this.toDouble(), to, -1.0)
}
public inline fun Char.downTo(to: Byte): CharacterSequence {
return CharacterSequence(this, to.toChar(), -1)
public inline fun Char.downTo(to: Byte): CharProgression {
return CharProgression(this, to.toChar(), -1)
}
public inline fun Char.downTo(to: Char): CharacterSequence {
return CharacterSequence(this, to, -1)
public inline fun Char.downTo(to: Char): CharProgression {
return CharProgression(this, to, -1)
}
public inline fun Char.downTo(to: Short): ShortSequence {
return ShortSequence(this.toShort(), to, -1)
public inline fun Char.downTo(to: Short): ShortProgression {
return ShortProgression(this.toShort(), to, -1)
}
public inline fun Char.downTo(to: Int): IntSequence {
return IntSequence(this.toInt(), to, -1)
public inline fun Char.downTo(to: Int): IntProgression {
return IntProgression(this.toInt(), to, -1)
}
public inline fun Char.downTo(to: Long): LongSequence {
return LongSequence(this.toLong(), to, -1.toLong())
public inline fun Char.downTo(to: Long): LongProgression {
return LongProgression(this.toLong(), to, -1.toLong())
}
public inline fun Char.downTo(to: Float): FloatSequence {
return FloatSequence(this.toFloat(), to, -1.toFloat())
public inline fun Char.downTo(to: Float): FloatProgression {
return FloatProgression(this.toFloat(), to, -1.toFloat())
}
public inline fun Char.downTo(to: Double): DoubleSequence {
return DoubleSequence(this.toDouble(), to, -1.0)
public inline fun Char.downTo(to: Double): DoubleProgression {
return DoubleProgression(this.toDouble(), to, -1.0)
}
public inline fun Short.downTo(to: Byte): ShortSequence {
return ShortSequence(this, to.toShort(), -1)
public inline fun Short.downTo(to: Byte): ShortProgression {
return ShortProgression(this, to.toShort(), -1)
}
public inline fun Short.downTo(to: Char): ShortSequence {
return ShortSequence(this, to.toShort(), -1)
public inline fun Short.downTo(to: Char): ShortProgression {
return ShortProgression(this, to.toShort(), -1)
}
public inline fun Short.downTo(to: Short): ShortSequence {
return ShortSequence(this, to, -1)
public inline fun Short.downTo(to: Short): ShortProgression {
return ShortProgression(this, to, -1)
}
public inline fun Short.downTo(to: Int): IntSequence {
return IntSequence(this.toInt(), to, -1)
public inline fun Short.downTo(to: Int): IntProgression {
return IntProgression(this.toInt(), to, -1)
}
public inline fun Short.downTo(to: Long): LongSequence {
return LongSequence(this.toLong(), to, -1.toLong())
public inline fun Short.downTo(to: Long): LongProgression {
return LongProgression(this.toLong(), to, -1.toLong())
}
public inline fun Short.downTo(to: Float): FloatSequence {
return FloatSequence(this.toFloat(), to, -1.toFloat())
public inline fun Short.downTo(to: Float): FloatProgression {
return FloatProgression(this.toFloat(), to, -1.toFloat())
}
public inline fun Short.downTo(to: Double): DoubleSequence {
return DoubleSequence(this.toDouble(), to, -1.0)
public inline fun Short.downTo(to: Double): DoubleProgression {
return DoubleProgression(this.toDouble(), to, -1.0)
}
public inline fun Int.downTo(to: Byte): IntSequence {
return IntSequence(this, to.toInt(), -1)
public inline fun Int.downTo(to: Byte): IntProgression {
return IntProgression(this, to.toInt(), -1)
}
public inline fun Int.downTo(to: Char): IntSequence {
return IntSequence(this, to.toInt(), -1)
public inline fun Int.downTo(to: Char): IntProgression {
return IntProgression(this, to.toInt(), -1)
}
public inline fun Int.downTo(to: Short): IntSequence {
return IntSequence(this, to.toInt(), -1)
public inline fun Int.downTo(to: Short): IntProgression {
return IntProgression(this, to.toInt(), -1)
}
public inline fun Int.downTo(to: Int): IntSequence {
return IntSequence(this, to, -1)
public inline fun Int.downTo(to: Int): IntProgression {
return IntProgression(this, to, -1)
}
public inline fun Int.downTo(to: Long): LongSequence {
return LongSequence(this.toLong(), to, -1.toLong())
public inline fun Int.downTo(to: Long): LongProgression {
return LongProgression(this.toLong(), to, -1.toLong())
}
public inline fun Int.downTo(to: Float): FloatSequence {
return FloatSequence(this.toFloat(), to, -1.toFloat())
public inline fun Int.downTo(to: Float): FloatProgression {
return FloatProgression(this.toFloat(), to, -1.toFloat())
}
public inline fun Int.downTo(to: Double): DoubleSequence {
return DoubleSequence(this.toDouble(), to, -1.0)
public inline fun Int.downTo(to: Double): DoubleProgression {
return DoubleProgression(this.toDouble(), to, -1.0)
}
public inline fun Long.downTo(to: Byte): LongSequence {
return LongSequence(this, to.toLong(), -1.toLong())
public inline fun Long.downTo(to: Byte): LongProgression {
return LongProgression(this, to.toLong(), -1.toLong())
}
public inline fun Long.downTo(to: Char): LongSequence {
return LongSequence(this, to.toLong(), -1.toLong())
public inline fun Long.downTo(to: Char): LongProgression {
return LongProgression(this, to.toLong(), -1.toLong())
}
public inline fun Long.downTo(to: Short): LongSequence {
return LongSequence(this, to.toLong(), -1.toLong())
public inline fun Long.downTo(to: Short): LongProgression {
return LongProgression(this, to.toLong(), -1.toLong())
}
public inline fun Long.downTo(to: Int): LongSequence {
return LongSequence(this, to.toLong(), -1.toLong())
public inline fun Long.downTo(to: Int): LongProgression {
return LongProgression(this, to.toLong(), -1.toLong())
}
public inline fun Long.downTo(to: Long): LongSequence {
return LongSequence(this, to, -1.toLong())
public inline fun Long.downTo(to: Long): LongProgression {
return LongProgression(this, to, -1.toLong())
}
public inline fun Long.downTo(to: Float): FloatSequence {
return FloatSequence(this.toFloat(), to, -1.toFloat())
public inline fun Long.downTo(to: Float): FloatProgression {
return FloatProgression(this.toFloat(), to, -1.toFloat())
}
public inline fun Long.downTo(to: Double): DoubleSequence {
return DoubleSequence(this.toDouble(), to, -1.0)
public inline fun Long.downTo(to: Double): DoubleProgression {
return DoubleProgression(this.toDouble(), to, -1.0)
}
public inline fun Float.downTo(to: Byte): FloatSequence {
return FloatSequence(this, to.toFloat(), -1.toFloat())
public inline fun Float.downTo(to: Byte): FloatProgression {
return FloatProgression(this, to.toFloat(), -1.toFloat())
}
public inline fun Float.downTo(to: Char): FloatSequence {
return FloatSequence(this, to.toFloat(), -1.toFloat())
public inline fun Float.downTo(to: Char): FloatProgression {
return FloatProgression(this, to.toFloat(), -1.toFloat())
}
public inline fun Float.downTo(to: Short): FloatSequence {
return FloatSequence(this, to.toFloat(), -1.toFloat())
public inline fun Float.downTo(to: Short): FloatProgression {
return FloatProgression(this, to.toFloat(), -1.toFloat())
}
public inline fun Float.downTo(to: Int): FloatSequence {
return FloatSequence(this, to.toFloat(), -1.toFloat())
public inline fun Float.downTo(to: Int): FloatProgression {
return FloatProgression(this, to.toFloat(), -1.toFloat())
}
public inline fun Float.downTo(to: Long): FloatSequence {
return FloatSequence(this, to.toFloat(), -1.toFloat())
public inline fun Float.downTo(to: Long): FloatProgression {
return FloatProgression(this, to.toFloat(), -1.toFloat())
}
public inline fun Float.downTo(to: Float): FloatSequence {
return FloatSequence(this, to, -1.toFloat())
public inline fun Float.downTo(to: Float): FloatProgression {
return FloatProgression(this, to, -1.toFloat())
}
public inline fun Float.downTo(to: Double): DoubleSequence {
return DoubleSequence(this.toDouble(), to, -1.0)
public inline fun Float.downTo(to: Double): DoubleProgression {
return DoubleProgression(this.toDouble(), to, -1.0)
}
public inline fun Double.downTo(to: Byte): DoubleSequence {
return DoubleSequence(this, to.toDouble(), -1.0)
public inline fun Double.downTo(to: Byte): DoubleProgression {
return DoubleProgression(this, to.toDouble(), -1.0)
}
public inline fun Double.downTo(to: Char): DoubleSequence {
return DoubleSequence(this, to.toDouble(), -1.0)
public inline fun Double.downTo(to: Char): DoubleProgression {
return DoubleProgression(this, to.toDouble(), -1.0)
}
public inline fun Double.downTo(to: Short): DoubleSequence {
return DoubleSequence(this, to.toDouble(), -1.0)
public inline fun Double.downTo(to: Short): DoubleProgression {
return DoubleProgression(this, to.toDouble(), -1.0)
}
public inline fun Double.downTo(to: Int): DoubleSequence {
return DoubleSequence(this, to.toDouble(), -1.0)
public inline fun Double.downTo(to: Int): DoubleProgression {
return DoubleProgression(this, to.toDouble(), -1.0)
}
public inline fun Double.downTo(to: Long): DoubleSequence {
return DoubleSequence(this, to.toDouble(), -1.0)
public inline fun Double.downTo(to: Long): DoubleProgression {
return DoubleProgression(this, to.toDouble(), -1.0)
}
public inline fun Double.downTo(to: Float): DoubleSequence {
return DoubleSequence(this, to.toDouble(), -1.0)
public inline fun Double.downTo(to: Float): DoubleProgression {
return DoubleProgression(this, to.toDouble(), -1.0)
}
public inline fun Double.downTo(to: Double): DoubleSequence {
return DoubleSequence(this, to, -1.0)
public inline fun Double.downTo(to: Double): DoubleProgression {
return DoubleProgression(this, to, -1.0)
}
+56 -56
View File
@@ -19,133 +19,133 @@ public fun <T: Comparable<T>> T.rangeTo(that: T): ComparableRange<T> {
public fun CharacterSequence.reversed(): CharacterSequence {
return CharacterSequence(end, start, -increment)
public fun CharProgression.reversed(): CharProgression {
return CharProgression(end, start, -increment)
}
public fun ByteSequence.reversed(): ByteSequence {
return ByteSequence(end, start, -increment)
public fun ByteProgression.reversed(): ByteProgression {
return ByteProgression(end, start, -increment)
}
public fun ShortSequence.reversed(): ShortSequence {
return ShortSequence(end, start, -increment)
public fun ShortProgression.reversed(): ShortProgression {
return ShortProgression(end, start, -increment)
}
public fun IntSequence.reversed(): IntSequence {
return IntSequence(end, start, -increment)
public fun IntProgression.reversed(): IntProgression {
return IntProgression(end, start, -increment)
}
public fun FloatSequence.reversed(): FloatSequence {
return FloatSequence(end, start, -increment)
public fun FloatProgression.reversed(): FloatProgression {
return FloatProgression(end, start, -increment)
}
public fun LongSequence.reversed(): LongSequence {
return LongSequence(end, start, -increment)
public fun LongProgression.reversed(): LongProgression {
return LongProgression(end, start, -increment)
}
public fun DoubleSequence.reversed(): DoubleSequence {
return DoubleSequence(end, start, -increment)
public fun DoubleProgression.reversed(): DoubleProgression {
return DoubleProgression(end, start, -increment)
}
public fun CharRange.reversed(): CharacterSequence {
return CharacterSequence(end, start, -1)
public fun CharRange.reversed(): CharProgression {
return CharProgression(end, start, -1)
}
public fun ByteRange.reversed(): ByteSequence {
return ByteSequence(end, start, -1)
public fun ByteRange.reversed(): ByteProgression {
return ByteProgression(end, start, -1)
}
public fun ShortRange.reversed(): ShortSequence {
return ShortSequence(end, start, -1)
public fun ShortRange.reversed(): ShortProgression {
return ShortProgression(end, start, -1)
}
public fun IntRange.reversed(): IntSequence {
return IntSequence(end, start, -1)
public fun IntRange.reversed(): IntProgression {
return IntProgression(end, start, -1)
}
public fun FloatRange.reversed(): FloatSequence {
return FloatSequence(end, start, -1.0.toFloat())
public fun FloatRange.reversed(): FloatProgression {
return FloatProgression(end, start, -1.0.toFloat())
}
public fun LongRange.reversed(): LongSequence {
return LongSequence(end, start, -1.toLong())
public fun LongRange.reversed(): LongProgression {
return LongProgression(end, start, -1.toLong())
}
public fun DoubleRange.reversed(): DoubleSequence {
return DoubleSequence(end, start, -1.0)
public fun DoubleRange.reversed(): DoubleProgression {
return DoubleProgression(end, start, -1.0)
}
public fun IntSequence.step(step: Int): IntSequence {
public fun IntProgression.step(step: Int): IntProgression {
checkStepIsPositive(step > 0, step)
return IntSequence(start, end, if (increment > 0) step else -step)
return IntProgression(start, end, if (increment > 0) step else -step)
}
public fun CharacterSequence.step(step: Int): CharacterSequence {
public fun CharProgression.step(step: Int): CharProgression {
checkStepIsPositive(step > 0, step)
return CharacterSequence(start, end, if (increment > 0) step else -step)
return CharProgression(start, end, if (increment > 0) step else -step)
}
public fun ByteSequence.step(step: Int): ByteSequence {
public fun ByteProgression.step(step: Int): ByteProgression {
checkStepIsPositive(step > 0, step)
return ByteSequence(start, end, if (increment > 0) step else -step)
return ByteProgression(start, end, if (increment > 0) step else -step)
}
public fun ShortSequence.step(step: Int): ShortSequence {
public fun ShortProgression.step(step: Int): ShortProgression {
checkStepIsPositive(step > 0, step)
return ShortSequence(start, end, if (increment > 0) step else -step)
return ShortProgression(start, end, if (increment > 0) step else -step)
}
public fun LongSequence.step(step: Long): LongSequence {
public fun LongProgression.step(step: Long): LongProgression {
checkStepIsPositive(step > 0, step)
return LongSequence(start, end, if (increment > 0) step else -step)
return LongProgression(start, end, if (increment > 0) step else -step)
}
public fun FloatSequence.step(step: Float): FloatSequence {
public fun FloatProgression.step(step: Float): FloatProgression {
checkStepIsPositive(step > 0, step)
return FloatSequence(start, end, if (increment > 0) step else -step)
return FloatProgression(start, end, if (increment > 0) step else -step)
}
public fun DoubleSequence.step(step: Double): DoubleSequence {
public fun DoubleProgression.step(step: Double): DoubleProgression {
checkStepIsPositive(step > 0, step)
return DoubleSequence(start, end, if (increment > 0) step else -step)
return DoubleProgression(start, end, if (increment > 0) step else -step)
}
public fun IntRange.step(step: Int): IntSequence {
public fun IntRange.step(step: Int): IntProgression {
checkStepIsPositive(step > 0, step)
return IntSequence(start, end, step)
return IntProgression(start, end, step)
}
public fun CharRange.step(step: Int): CharacterSequence {
public fun CharRange.step(step: Int): CharProgression {
checkStepIsPositive(step > 0, step)
return CharacterSequence(start, end, step)
return CharProgression(start, end, step)
}
public fun ByteRange.step(step: Int): ByteSequence {
public fun ByteRange.step(step: Int): ByteProgression {
checkStepIsPositive(step > 0, step)
return ByteSequence(start, end, step)
return ByteProgression(start, end, step)
}
public fun ShortRange.step(step: Int): ShortSequence {
public fun ShortRange.step(step: Int): ShortProgression {
checkStepIsPositive(step > 0, step)
return ShortSequence(start, end, step)
return ShortProgression(start, end, step)
}
public fun LongRange.step(step: Long): LongSequence {
public fun LongRange.step(step: Long): LongProgression {
checkStepIsPositive(step > 0, step)
return LongSequence(start, end, step)
return LongProgression(start, end, step)
}
public fun FloatRange.step(step: Float): FloatSequence {
public fun FloatRange.step(step: Float): FloatProgression {
checkStepIsPositive(step > 0, step)
return FloatSequence(start, end, step)
return FloatProgression(start, end, step)
}
public fun DoubleRange.step(step: Double): DoubleSequence {
public fun DoubleRange.step(step: Double): DoubleProgression {
checkStepIsPositive(step > 0, step)
return DoubleSequence(start, end, step)
return DoubleProgression(start, end, step)
}