A lot of minor fixes. Moving some code to kotlin
This commit is contained in:
parent
01b3da3a91
commit
a0087c2e17
@ -6,6 +6,9 @@ import hep.dataforge.maths.chain.StatefulChain
|
||||
import inr.numass.data.api.NumassBlock
|
||||
import inr.numass.data.api.NumassEvent
|
||||
import inr.numass.data.api.SimpleBlock
|
||||
import kotlinx.coroutines.experimental.channels.takeWhile
|
||||
import kotlinx.coroutines.experimental.channels.toList
|
||||
import kotlinx.coroutines.experimental.runBlocking
|
||||
import org.apache.commons.math3.random.JDKRandomGenerator
|
||||
import org.apache.commons.math3.random.RandomGenerator
|
||||
import java.time.Duration
|
||||
@ -20,7 +23,8 @@ private fun RandomGenerator.nextDeltaTime(cr: Double): Long {
|
||||
}
|
||||
|
||||
fun generateBlock(start: Instant, length: Long, chain: Chain<NumassEvent>): NumassBlock {
|
||||
val events = chain.asSequence().takeWhile { it.timeOffset < length }.toList()
|
||||
|
||||
val events = runBlocking { chain.asChannel().takeWhile { it.timeOffset < length }.toList()}
|
||||
return SimpleBlock(start, Duration.ofNanos(length), events)
|
||||
}
|
||||
|
||||
|
Loading…
Reference in New Issue
Block a user