kettle

Kotlin utilities for Quilt mod development


Project maintained by Cypher121 Hosted on GitHub Pages — Theme by mattgraham

//kettle/coffee.cypher.kettle.scheduler

Package-level declarations

Types

Name Summary
AttachedTaskBuilder [jvm]
class AttachedTaskBuilder<T : Any> : TaskBuilder<T>
Creates a Task attached to a specific TickingScheduler.
ConfigurationBuilder [jvm]
sealed class ConfigurationBuilder
A builder object representing the Task’s ExecutionConfiguration.
ExecutionConfiguration [jvm]
sealed class ExecutionConfiguration
Description of a Task’s execution pattern dictating how often it will execute, how many times, etc.
SchedulerDsl [jvm]
@DslMarker
annotation class SchedulerDsl
Marks functions and types belonging to the scheduler creation DSL.
Task [jvm]
interface Task<T : Any>
A task that can be run on a TickingScheduler. Entirely self-contained and can be moved between schedulers at will. Can be paused, stopped, and restarted from outside the task. Attempting to do so from inside the task will throw IllegalStateException. Use TaskContext.sleepFor and TaskContext.waitUntil instead.
TaskBlock [jvm]
typealias TaskBlock<T> = suspend TaskContext<T>.() -> Unit
TaskBuilder [jvm]
open class TaskBuilder<T : Any>
A builder object used with DSL extensions to create a Task.
TaskContext [jvm]
class TaskContext<T : Any>
Coroutine context for a Task containing methods allowing suspension of execution, such as sleepFor and waitUntil.
TaskExecutionException [jvm]
class TaskExecutionException : RuntimeException
Exception representing a failure that occurred while executing a task.
TickingScheduler [jvm]
class TickingScheduler<T : Any>
A scheduler object capable of executing multiple Tasks and providing them with contexts of type T.

Functions

Name Summary
action [jvm]
fun <T : Any> TaskBuilder<T>.action(block: TaskBlock<T>)
Sets the function executed by the Task to the provided block.
infinitely [jvm]
infix fun (ExecutionConfiguration) -> Unit.infinitely(configuration: ConfigurationBuilder.Infinite.() -> Unit)
Creates an ExecutionConfiguration that executes the task infinitely, further configured with the provided configuration.
multiple [jvm]
infix fun (ExecutionConfiguration) -> Unit.multiple(configuration: ConfigurationBuilder.Multiple.() -> Unit)
Creates an ExecutionConfiguration that executes the task multiple times, further configured with the provided configuration.
once [jvm]
infix fun (ExecutionConfiguration) -> Unit.once(configuration: ConfigurationBuilder.Once.() -> Unit)
Creates an ExecutionConfiguration that executes the task once, further configured with the provided configuration.
scheduler [jvm]
fun <T : Any> scheduler(config: TickingScheduler<T>.() -> Unit): TickingScheduler<T>
Creates a TickingScheduler with the additional context of type T configured with the provided config.
[jvm]
@JvmName(name = "scheduler$noContext")
fun scheduler(config: TickingScheduler<Unit>.() -> Unit): TickingScheduler<Unit>
Creates a new TickingScheduler with no additional task context configured with the provided config.
task [jvm]
fun <T : Any> task(config: TaskBuilder<T>.() -> Unit): Task<T>
Creates a new task described by the provided config with the use of other DSL functions.
task [jvm]
fun <T : Any> TickingScheduler<T>.task(config: AttachedTaskBuilder<T>.() -> Unit): Task<T>
Creates a new task on the receiver scheduler described by the provided config with the use of other DSL functions.
tick [jvm]
fun TickingScheduler<Unit>.tick()
Advances all tasks registered on this scheduler until they finish or suspend.