diff options
Diffstat (limited to 'odcsim-core/src/main')
| -rw-r--r-- | odcsim-core/src/main/kotlin/com/atlarge/odcsim/ActorRef.kt | 2 | ||||
| -rw-r--r-- | odcsim-core/src/main/kotlin/com/atlarge/odcsim/Time.kt | 40 |
2 files changed, 41 insertions, 1 deletions
diff --git a/odcsim-core/src/main/kotlin/com/atlarge/odcsim/ActorRef.kt b/odcsim-core/src/main/kotlin/com/atlarge/odcsim/ActorRef.kt index f6a9f0b5..3f01e409 100644 --- a/odcsim-core/src/main/kotlin/com/atlarge/odcsim/ActorRef.kt +++ b/odcsim-core/src/main/kotlin/com/atlarge/odcsim/ActorRef.kt @@ -36,7 +36,7 @@ interface ActorRef<in T : Any> { /** * Send the specified message to the actor referenced by this [ActorRef]. * - * @param msg The message to send to the referenced architecture. + * @param msg The message to send to the referenced actor. * @param after The delay after which the message should be received by the actor. */ fun send(msg: T, after: Duration = 0.1) diff --git a/odcsim-core/src/main/kotlin/com/atlarge/odcsim/Time.kt b/odcsim-core/src/main/kotlin/com/atlarge/odcsim/Time.kt index 8eab3bdc..f19f6fe2 100644 --- a/odcsim-core/src/main/kotlin/com/atlarge/odcsim/Time.kt +++ b/odcsim-core/src/main/kotlin/com/atlarge/odcsim/Time.kt @@ -33,3 +33,43 @@ typealias Instant = Double * A time interval which represents the amount of elapsed time between two messages. */ typealias Duration = Double + +/** + * Convert this [Int] into an [Instant]. + */ +fun Int.toInstant(): Instant = toDouble() + +/** + * Convert this [Int] into a [Duration]. + */ +fun Int.toDuration(): Duration = toDouble() + +/** + * Convert this [Long] into an [Instant]. + */ +fun Long.toInstant(): Instant = toDouble() + +/** + * Convert this [Long] into a [Duration]. + */ +fun Long.toDuration(): Duration = toDouble() + +/** + * Convert this [Float] into an [Instant]. + */ +fun Float.toInstant(): Instant = toDouble() + +/** + * Convert this [Float] into a [Duration]. + */ +fun Float.toDuration(): Duration = toDouble() + +/** + * Convert this [Double] into an [Instant]. + */ +fun Double.toInstant(): Instant = toDouble() + +/** + * Convert this [Double] into a [Duration]. + */ +fun Double.toDuration(): Duration = toDouble() |
