Package com.cloudbees.groovy.cps
Class Next
java.lang.Object
com.cloudbees.groovy.cps.Next
- All Implemented Interfaces:
Continuation,Serializable
Remaining computation to execute. To work around the lack of tail-call optimization.
The remaining computation is either to execute
f under {#link #e} and pass the
result to k immediately, or to suspend execution by yielding yield,
and when the execution is resumed, continue by passing the resume value to k
(or throw the resume value to the catch handler as specified by e.)- Author:
- Kohsuke Kawaguchi
- See Also:
-
Nested Class Summary
Nested classes/interfaces inherited from interface com.cloudbees.groovy.cps.Continuation
Continuation.Halt -
Field Summary
FieldsModifier and TypeFieldDescriptionfinal Envfinal Blockfinal Continuationfinal OutcomeIf the program getting executed wants to yield a value and suspend its execution, this value is set to non-null.Fields inherited from interface com.cloudbees.groovy.cps.Continuation
HALT -
Constructor Summary
ConstructorsConstructorDescriptionNext(Block f, Env e, Continuation k) Next(Env e, Continuation k, Outcome yield) -
Method Summary
Modifier and TypeMethodDescriptionstatic Nextgo0(Outcome v, Continuable c) Crestes aNextobject that causes the interpreter loop to keep evaluating the continuation represented byContinuableby passing the outcome (or throwing it).As aContinuation, just ignore the argument.run()Resumes the execution of this program state, until it yields a value or finishes computation.run(int max) for testing onlystep()Executes one stepstatic NextCreates aNextobject that terminates the computation and either returns a value.static NextCreates aNextobject that terminates the computation and either returns a value or throw an exception.static NextCreates aNextobject that terminates the computation by throwing an exception.static Nextyield(Object v, Env e, Continuation k) Creates aNextobject that causes the interpreter loop to exit with the specified value, then optionally allow the interpreter to resume with the specifiedContinuation.static Nextyield0(Outcome v, Continuable c) Creates aNextobject that causes the interpreter loop to exit with the specified value, then optionally allow the interpreter to resume to the continuation represented byContinuable.
-
Field Details
-
f
-
e
-
k
-
yield
If the program getting executed wants to yield a value and suspend its execution, this value is set to non-null. This field andfis mutually exclusive.
-
-
Constructor Details
-
Next
-
Next
-
-
Method Details
-
run
Resumes the execution of this program state, until it yields a value or finishes computation. -
run
for testing only -
step
Executes one step -
yield
Creates aNextobject that causes the interpreter loop to exit with the specified value, then optionally allow the interpreter to resume with the specifiedContinuation. -
yield0
Creates aNextobject that causes the interpreter loop to exit with the specified value, then optionally allow the interpreter to resume to the continuation represented byContinuable. -
go0
Crestes aNextobject that causes the interpreter loop to keep evaluating the continuation represented byContinuableby passing the outcome (or throwing it). -
terminate
Creates aNextobject that terminates the computation and either returns a value. -
unhandledException
Creates aNextobject that terminates the computation by throwing an exception. -
terminate0
Creates aNextobject that terminates the computation and either returns a value or throw an exception. -
receive
As aContinuation, just ignore the argument.- Specified by:
receivein interfaceContinuation
-