diff options
5 files changed, 10 insertions, 6 deletions
diff --git a/opendc-core/src/main/kotlin/nl/atlarge/opendc/kernel/Context.kt b/opendc-core/src/main/kotlin/nl/atlarge/opendc/kernel/Context.kt index 6185e273..83a7c4fb 100644 --- a/opendc-core/src/main/kotlin/nl/atlarge/opendc/kernel/Context.kt +++ b/opendc-core/src/main/kotlin/nl/atlarge/opendc/kernel/Context.kt @@ -30,6 +30,7 @@ import nl.atlarge.opendc.kernel.time.Clock import nl.atlarge.opendc.kernel.time.Duration import nl.atlarge.opendc.kernel.time.Instant import nl.atlarge.opendc.topology.Entity +import nl.atlarge.opendc.topology.MutableTopology import nl.atlarge.opendc.topology.Topology import nl.atlarge.opendc.topology.TopologyContext import java.lang.Process @@ -50,7 +51,7 @@ interface Context<out E : Entity<*>> : Readable, Writable, TopologyContext { /** * The [Topology] over which the simulation is run. */ - val topology: Topology + val topology: MutableTopology /** * The current point in simulation time. diff --git a/opendc-core/src/main/kotlin/nl/atlarge/opendc/kernel/Kernel.kt b/opendc-core/src/main/kotlin/nl/atlarge/opendc/kernel/Kernel.kt index 524c9131..ffb6299c 100644 --- a/opendc-core/src/main/kotlin/nl/atlarge/opendc/kernel/Kernel.kt +++ b/opendc-core/src/main/kotlin/nl/atlarge/opendc/kernel/Kernel.kt @@ -24,6 +24,7 @@ package nl.atlarge.opendc.kernel +import nl.atlarge.opendc.topology.MutableTopology import nl.atlarge.opendc.topology.Topology /** @@ -45,5 +46,5 @@ interface Kernel { * @param topology The [Topology] to create a [Simulation] of. * @return A [Simulation] instance. */ - fun create(topology: Topology): Simulation + fun create(topology: MutableTopology): Simulation } diff --git a/opendc-core/src/main/kotlin/nl/atlarge/opendc/topology/TopologyBuilder.kt b/opendc-core/src/main/kotlin/nl/atlarge/opendc/topology/TopologyBuilder.kt index 20cbdb0c..d5a57549 100644 --- a/opendc-core/src/main/kotlin/nl/atlarge/opendc/topology/TopologyBuilder.kt +++ b/opendc-core/src/main/kotlin/nl/atlarge/opendc/topology/TopologyBuilder.kt @@ -36,7 +36,7 @@ interface TopologyBuilder { * @param block The block to construct the topology. * @return The topology that has been built. */ - fun construct(block: MutableTopology.() -> Unit): Topology = build().apply(block) + fun construct(block: MutableTopology.() -> Unit): MutableTopology = build().apply(block) /** * Build a [Topology] instance from the current state of this builder. diff --git a/opendc-omega/src/main/kotlin/nl/atlarge/opendc/kernel/omega/OmegaKernel.kt b/opendc-omega/src/main/kotlin/nl/atlarge/opendc/kernel/omega/OmegaKernel.kt index 5367e674..cbc25b63 100644 --- a/opendc-omega/src/main/kotlin/nl/atlarge/opendc/kernel/omega/OmegaKernel.kt +++ b/opendc-omega/src/main/kotlin/nl/atlarge/opendc/kernel/omega/OmegaKernel.kt @@ -28,6 +28,7 @@ import nl.atlarge.opendc.kernel.Kernel import nl.atlarge.opendc.kernel.Process import nl.atlarge.opendc.kernel.Simulation import nl.atlarge.opendc.topology.Entity +import nl.atlarge.opendc.topology.MutableTopology import nl.atlarge.opendc.topology.Topology /** @@ -53,5 +54,5 @@ object OmegaKernel : Kernel { * @param topology The [Topology] to create a [Simulation] of. * @return A [Simulation] instance. */ - override fun create(topology: Topology): Simulation = OmegaSimulation(this, topology) + override fun create(topology: MutableTopology): Simulation = OmegaSimulation(this, topology) } diff --git a/opendc-omega/src/main/kotlin/nl/atlarge/opendc/kernel/omega/OmegaSimulation.kt b/opendc-omega/src/main/kotlin/nl/atlarge/opendc/kernel/omega/OmegaSimulation.kt index 67b192fb..e3477d3e 100644 --- a/opendc-omega/src/main/kotlin/nl/atlarge/opendc/kernel/omega/OmegaSimulation.kt +++ b/opendc-omega/src/main/kotlin/nl/atlarge/opendc/kernel/omega/OmegaSimulation.kt @@ -33,6 +33,7 @@ import nl.atlarge.opendc.kernel.time.Duration import nl.atlarge.opendc.kernel.time.Instant import nl.atlarge.opendc.kernel.time.TickClock import nl.atlarge.opendc.topology.Entity +import nl.atlarge.opendc.topology.MutableTopology import nl.atlarge.opendc.topology.Topology import nl.atlarge.opendc.topology.TopologyContext import java.util.* @@ -52,7 +53,7 @@ import kotlin.coroutines.experimental.* * @property clock The clock to use for simulation time. * @author Fabian Mastenbroek (f.s.mastenbroek@student.tudelft.nl) */ -internal class OmegaSimulation(override val kernel: OmegaKernel, override val topology: Topology, +internal class OmegaSimulation(override val kernel: OmegaKernel, override val topology: MutableTopology, override val clock: Clock = TickClock()) : Simulation { /** * The logger instance to use for the simulator. @@ -212,7 +213,7 @@ internal class OmegaSimulation(override val kernel: OmegaKernel, override val to /** * The [Topology] over which the simulation is run. */ - override val topology: Topology = this@OmegaSimulation.topology + override val topology = this@OmegaSimulation.topology /** * The current point in simulation time. |
