Package kilim.examples
Class Fib
- All Implemented Interfaces:
Iterable<BigInteger>,Iterator<BigInteger>,Fiber.Worker
This example prints the nth Fibonacci number.
It illustrates a generator, which is part iterator, part task. It returns the next object 'yielded' by its execute
method. The difference between a generator and a task is that the former is invoked by the caller synchronously on
the caller's stack; it is not scheduled in a separate thread.
-
Nested Class Summary
Nested classes/interfaces inherited from class kilim.Continuation
Continuation.FakeTask -
Constructor Summary
Constructors -
Method Summary
Methods inherited from class kilim.Continuation
ex, execute, reset, runMethods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, waitMethods inherited from interface java.lang.Iterable
forEach, spliteratorMethods inherited from interface java.util.Iterator
forEachRemaining
-
Constructor Details
-
Fib
public Fib()
-
-
Method Details
-
main
-
execute
Description copied from class:Continuationthe top level entrypoint for the continuation override this method cannot be called directly - use run() instead use Fiber.yield() to yield control cooperatively and return execution to the caller of run()- Specified by:
executein interfaceFiber.Worker- Overrides:
executein classContinuation- Throws:
Pausable
-