Generate Kotlin sources of progression iterators
This commit is contained in:
@@ -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
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
Reference in New Issue
Block a user