summaryrefslogtreecommitdiff
path: root/opendc-simulator
diff options
context:
space:
mode:
authorFabian Mastenbroek <mail.fabianm@gmail.com>2021-05-05 23:14:56 +0200
committerFabian Mastenbroek <mail.fabianm@gmail.com>2021-05-18 15:21:29 +0200
commitcc9310efad6177909ff2f7415384d7c393383106 (patch)
tree5e94f0443cdf1c63ec77248aaf520974e5bfd7d0 /opendc-simulator
parentef3868ec729f7ce3f5976d4f9a0c8b95098d9857 (diff)
chore: Address deprecations due to Kotlin 1.5
This change addresses the deprecations that were caused by the migration to Kotlin 1.5.
Diffstat (limited to 'opendc-simulator')
-rw-r--r--opendc-simulator/opendc-simulator-compute/src/main/kotlin/org/opendc/simulator/compute/SimAbstractMachine.kt2
-rw-r--r--opendc-simulator/opendc-simulator-resources/src/main/kotlin/org/opendc/simulator/resources/SimAbstractResourceAggregator.kt4
2 files changed, 3 insertions, 3 deletions
diff --git a/opendc-simulator/opendc-simulator-compute/src/main/kotlin/org/opendc/simulator/compute/SimAbstractMachine.kt b/opendc-simulator/opendc-simulator-compute/src/main/kotlin/org/opendc/simulator/compute/SimAbstractMachine.kt
index f6324e13..e501033a 100644
--- a/opendc-simulator/opendc-simulator-compute/src/main/kotlin/org/opendc/simulator/compute/SimAbstractMachine.kt
+++ b/opendc-simulator/opendc-simulator-compute/src/main/kotlin/org/opendc/simulator/compute/SimAbstractMachine.kt
@@ -80,7 +80,7 @@ public abstract class SimAbstractMachine(private val clock: Clock) : SimMachine
override suspend fun run(workload: SimWorkload, meta: Map<String, Any>): Unit = withContext(context) {
require(!isTerminated) { "Machine is terminated" }
val ctx = Context(meta)
- val totalCapacity = model.cpus.sumByDouble { it.frequency }
+ val totalCapacity = model.cpus.sumOf { it.frequency }
_speed = DoubleArray(model.cpus.size) { 0.0 }
var totalSpeed = 0.0
diff --git a/opendc-simulator/opendc-simulator-resources/src/main/kotlin/org/opendc/simulator/resources/SimAbstractResourceAggregator.kt b/opendc-simulator/opendc-simulator-resources/src/main/kotlin/org/opendc/simulator/resources/SimAbstractResourceAggregator.kt
index 6ae04f27..653b53e0 100644
--- a/opendc-simulator/opendc-simulator-resources/src/main/kotlin/org/opendc/simulator/resources/SimAbstractResourceAggregator.kt
+++ b/opendc-simulator/opendc-simulator-resources/src/main/kotlin/org/opendc/simulator/resources/SimAbstractResourceAggregator.kt
@@ -82,7 +82,7 @@ public abstract class SimAbstractResourceAggregator(private val scheduler: SimRe
return if (_remainingWorkFlush < now) {
_remainingWorkFlush = now
- _inputConsumers.sumByDouble { it._ctx?.remainingWork ?: 0.0 }.also { _remainingWork = it }
+ _inputConsumers.sumOf { it._ctx?.remainingWork ?: 0.0 }.also { _remainingWork = it }
} else {
_remainingWork
}
@@ -132,7 +132,7 @@ public abstract class SimAbstractResourceAggregator(private val scheduler: SimRe
private fun updateCapacity() {
// Adjust capacity of output resource
- context.capacity = _inputConsumers.sumByDouble { it._ctx?.capacity ?: 0.0 }
+ context.capacity = _inputConsumers.sumOf { it._ctx?.capacity ?: 0.0 }
}
/* Input */