Class TaskInput<T>
- All Implemented Interfaces:
Supplier<T>
- Direct Known Subclasses:
TaskInput.Collection
Inputs may be defined as a static known value, or defined as the output of another task.
Created by covers1624 on 6/26/25.
-
Nested Class Summary
Nested ClassesModifier and TypeClassDescriptionstatic final classAn input which can represent multiple things, and multiple dependencies. -
Field Summary
-
Method Summary
Modifier and TypeMethodDescription<A> voidderiveFrom(TaskIO<A> aIo, Function<? super A, ? extends T> func) Derive this input's value from the input or output of another task, with the given function applied to the result.<A,B> void deriveFrom(TaskIO<A> aIo, TaskIO<B> bIo, BiFunction<? super A, ? super B, ? extends T> func) Derive this input's value from multiple inputs and/or outputs of other tasks, with the given function applied to the result.get()Get the value stored in this Input.Compute the future for this Input, including any tasks required to read the input.protected final voidset(Supplier<CompletableFuture<T>> futureSupplier) Set the future supplier for this Input.voidSet the value of this input to be the value of another input or output.voidSet the vlue of this input to a static value.
-
Method Details
-
getFuture
Compute the future for this Input, including any tasks required to read the input. -
get
Get the value stored in this Input.Will block until the inputs future is completed.
- Returns:
- The vlaue.
-
set
Set the vlue of this input to a static value.It is illegal to override a task Input, if the task has already been scheduled.
- Parameters:
value- The value.
-
set
Set the value of this input to be the value of another input or output.If provided an Input of another task, this will copy the inputs requirements. If provided an output of another task, the other task will be marked as a dependency.
It is illegal to override a task Input, if the task has already been scheduled.
- Parameters:
io- The IO to set this input from.
-
deriveFrom
Derive this input's value from the input or output of another task, with the given function applied to the result.If provided an Input of another task, this will copy the inputs requirements. If provided an output of another task, this other task will be marked as a dependency.
- Parameters:
aIo- The IO to derive from.func- The function to apply
-
deriveFrom
public <A,B> void deriveFrom(TaskIO<A> aIo, TaskIO<B> bIo, BiFunction<? super A, ? super B, ? extends T> func) Derive this input's value from multiple inputs and/or outputs of other tasks, with the given function applied to the result.If provided an Input of another task, this will copy the inputs requirements. If provided an output of another task, this other task will be marked as a dependency.
- Parameters:
aIo- The first IO to derive from.bIo- The second IO to derive from.func- The function to apply
-
set
Set the future supplier for this Input.We use suppliers to avoid resolving the future until the task builds its own future, preventing execution of dependencies until our task is scheduled.
It is illegal to override a task Input, if the task has already been scheduled.
- Parameters:
futureSupplier- The supplier to provide the future for this IO's value.
-