Generate Kotlin sources of progression iterators

This commit is contained in:
Alexander Udalov
2014-01-16 23:04:02 +04:00
parent dc66561ca5
commit 3b4c341046
2 changed files with 97 additions and 4 deletions
@@ -1,3 +1,5 @@
// Generated by org.jetbrains.jet.generators.runtime.progressionIterators.GenerateProgressionIterators
package jet
import jet.runtime.ProgressionUtil
@@ -99,9 +101,9 @@ class LongProgressionIterator(start: Long, end: Long, val increment: Long) : Lon
class FloatProgressionIterator(start: Float, val end: Float, val increment: Float) : FloatIterator() {
private var next = start
override fun hasNext() = if (increment > 0) next <= end else next >= end
override fun nextFloat(): Float {
val value = next
next += increment
@@ -111,12 +113,13 @@ class FloatProgressionIterator(start: Float, val end: Float, val increment: Floa
class DoubleProgressionIterator(start: Double, val end: Double, val increment: Double) : DoubleIterator() {
private var next = start
override fun hasNext() = if (increment > 0) next <= end else next >= end
override fun nextDouble(): Double {
val value = next
next += increment
return value
}
}