diff options
| author | Fabian Mastenbroek <mail.fabianm@gmail.com> | 2021-05-18 15:51:13 +0200 |
|---|---|---|
| committer | GitHub <noreply@github.com> | 2021-05-18 15:51:13 +0200 |
| commit | 02776c958a3254735b2be7d9fb1627f75e7f80cd (patch) | |
| tree | 155d96b0f1a5173e4ac884ac6c9cbccea011918f /opendc-simulator | |
| parent | 1ce710ebaa8b071a3b30447d431f4af422f25156 (diff) | |
| parent | 7cbb401a0939cc58daae8b481a97f4b05140ec3b (diff) | |
build: Add support for Java 16
This pull request adds support for building OpenDC using Java 16.
To make this possible, we have upgraded the following dependencies:
- Kotlin from 1.4.3 to 1.5.0
- Jacoco from 0.8.6 to 0.8.7
- Gradle from 7.0 to 7.0.2
Diffstat (limited to 'opendc-simulator')
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 */ |
