public class Var<T>
extends java.lang.Object
| Modifier and Type | Field and Description |
|---|---|
static FlightRecorder |
RECORDER |
| Constructor and Description |
|---|
Var()
Creates a new
Var with no history. |
Var(FiberScheduler scheduler,
SuspendableCallable<T> f)
Creates a new
Var with no history, whose value is set to the value returned by the given function f; the
function will be re-applied, and the Var's value re-set, whenever any of the Vars referenced
by f change value. |
Var(int history)
Creates a new
Var. |
Var(int history,
FiberScheduler scheduler,
SuspendableCallable<T> f)
Creates a new
Var, whose value is set to the value returned by the given function f; the
function will be re-applied, and the Var's value re-set, whenever any of the Vars referenced
by f change value. |
Var(int history,
SuspendableCallable<T> f)
Creates a new
Var, whose value is set to the value returned by the given function f; the
function will be re-applied, and the Var's value re-set, whenever any of the Vars referenced
by f change value. |
Var(SuspendableCallable<T> f)
Creates a new
Var with no history, whose value is set to the value returned by the given function f; the
function will be re-applied, and the Var's value re-set, whenever any of the Vars referenced
by f change value. |
| Modifier and Type | Method and Description |
|---|---|
T |
get()
Returns the Var's current value (more precisely: it returns the oldest value in the maintained history that has
not yet been returned), unless this Var does not yet have a value; only in that case will this method block.
|
T |
getNext()
Blocks until a new value has been set and returns it.
|
void |
set(T val)
Sets a new value for this
Var. |
public static final FlightRecorder RECORDER
public Var(int history,
FiberScheduler scheduler,
SuspendableCallable<T> f)
Var, whose value is set to the value returned by the given function f; the
function will be re-applied, and the Var's value re-set, whenever any of the Vars referenced
by f change value.history - how many historical values to maintain for each strand reading the var.scheduler - the FiberScheduler to use to schedule the fiber that will run, and re-run f.f - this var's value is set to the return value of fget()public Var(int history,
SuspendableCallable<T> f)
Var, whose value is set to the value returned by the given function f; the
function will be re-applied, and the Var's value re-set, whenever any of the Vars referenced
by f change value. The fiber running f will be scheduled by the default fiber scheduler.history - how many historical values to maintain for each strand reading the var.f - this var's value is set to the return value of fget()public Var(SuspendableCallable<T> f)
Var with no history, whose value is set to the value returned by the given function f; the
function will be re-applied, and the Var's value re-set, whenever any of the Vars referenced
by f change value. The fiber running f will be scheduled by the default fiber scheduler.history - how many historical values to maintain for each strand reading the var.scheduler - the FiberScheduler to use to schedule the fiber that will run, and re-run f.f - this var's value is set to the return value of fget()public Var(FiberScheduler scheduler, SuspendableCallable<T> f)
Var with no history, whose value is set to the value returned by the given function f; the
function will be re-applied, and the Var's value re-set, whenever any of the Vars referenced
by f change value.scheduler - the FiberScheduler to use to schedule the fiber that will run, and re-run f.f - this var's value is set to the return value of fget()public Var(int history)
Var.history - how many historical values to maintain for each strand reading the var.get()public Var()
Var with no history.public void set(T val)
Var. The Var can be set multiple times and by multiple strands.val - the new value.public T get() throws SuspendExecution, java.lang.InterruptedException
SuspendExecutionjava.lang.InterruptedExceptionpublic T getNext() throws SuspendExecution, java.lang.InterruptedException
SuspendExecutionjava.lang.InterruptedException