diff options
4 files changed, 11 insertions, 11 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 fb8c2044..37d21d60 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 @@ -55,7 +55,7 @@ interface Context<out T: Component<*>>: Readable { * Suspend the simulation kernel until the next tick occurs in the simulation. */ suspend fun tick(): Boolean { - sleep(1) + wait(1) return true } @@ -64,5 +64,5 @@ interface Context<out T: Component<*>>: Readable { * * @param n The amount of ticks to suspend the simulation kernel. */ - suspend fun sleep(n: Int) + suspend fun wait(n: Int) } diff --git a/opendc-core/src/main/kotlin/nl/atlarge/opendc/kernel/Simulator.kt b/opendc-core/src/main/kotlin/nl/atlarge/opendc/kernel/Simulator.kt index dfe41295..c173418d 100644 --- a/opendc-core/src/main/kotlin/nl/atlarge/opendc/kernel/Simulator.kt +++ b/opendc-core/src/main/kotlin/nl/atlarge/opendc/kernel/Simulator.kt @@ -180,7 +180,7 @@ class Simulator(val topology: Topology): Iterator<Unit> { * * @param n The amount of ticks to suspend the simulation kernel. */ - suspend override fun sleep(n: Int): Unit = suspendCoroutine { cont -> clock.scheduleAfter(n, { cont.resume(Unit) }) } + suspend override fun wait(n: Int): Unit = suspendCoroutine { cont -> clock.scheduleAfter(n, { cont.resume(Unit) }) } } /** @@ -220,7 +220,7 @@ class Simulator(val topology: Topology): Iterator<Unit> { * * @param n The amount of ticks to suspend the simulation kernel. */ - suspend override fun sleep(n: Int): Unit = suspendCoroutine { cont -> clock.scheduleAfter(n, { cont.resume(Unit) }) } + suspend override fun wait(n: Int): Unit = suspendCoroutine { cont -> clock.scheduleAfter(n, { cont.resume(Unit) }) } } /** diff --git a/opendc-core/src/main/kotlin/nl/atlarge/opendc/topology/Node.kt b/opendc-core/src/main/kotlin/nl/atlarge/opendc/topology/Node.kt index 39d1a804..c21fd088 100644 --- a/opendc-core/src/main/kotlin/nl/atlarge/opendc/topology/Node.kt +++ b/opendc-core/src/main/kotlin/nl/atlarge/opendc/topology/Node.kt @@ -60,22 +60,22 @@ interface Node<out T: Entity<*>>: Component<T> { } /** - * Return the set of ingoing edges of this node with the given tag. + * Return the set of entities that are connected inwards to this node with the given tag. * * @param tag The tag of the edges to get. * @param T The shape of the label of these edges. - * @return All edges whose destination is this node and have the given tag. + * @return The entities of all edges whose destination is this node and have the given tag. */ inline fun <reified T> Node<*>.ingoing(tag: String) = - ingoingEdges().filter { it.tag == tag }.map { it.label as T }.toSet() + ingoingEdges().filter { it.tag == tag }.map { it.to.entity as T }.toSet() /** - * Return the set of outgoing edges of this node with the given tag. + * Return the set of entities that are connected outwards to this node with the given tag. * * @param tag The tag of the edges to get. * @param T The shape of the label of these edges. - * @return All edges whose source is this node and have the given tag. + * @return The entities of all edges whose source is this node and have the given tag. */ inline fun <reified T> Node<*>.outgoing(tag: String) = - outgoingEdges().filter { it.tag == tag }.map { it.label as T }.toSet() + outgoingEdges().filter { it.tag == tag }.map { it.to.entity as T }.toSet() diff --git a/opendc-core/src/main/kotlin/nl/atlarge/opendc/topology/machine/Machine.kt b/opendc-core/src/main/kotlin/nl/atlarge/opendc/topology/machine/Machine.kt index f310e103..049f82b8 100644 --- a/opendc-core/src/main/kotlin/nl/atlarge/opendc/topology/machine/Machine.kt +++ b/opendc-core/src/main/kotlin/nl/atlarge/opendc/topology/machine/Machine.kt @@ -66,7 +66,7 @@ class Machine: Entity<Machine.State>, Kernel<EntityContext<Machine>> { val task: Task val delay = Random().nextInt(1000) - sleep(delay) + wait(delay) loop@while (true) { val msg = receive() |
