edu.rice.cs.plt.recur
Class PendingContinuation<T>

java.lang.Object
  extended by edu.rice.cs.plt.recur.PendingContinuation<T>
All Implemented Interfaces:
ResolvingThunk<T>, Thunk<T>, Continuation<T>
Direct Known Subclasses:
ArgContinuation, BinaryArgContinuation, ComposedContinuation

public abstract class PendingContinuation<T>
extends Object
implements Continuation<T>

A continuation representing computation left to be done (in contrast to ValueContinuation, which represents a completed computation). This class provides default implementations of value(), isResolved(), and compose(edu.rice.cs.plt.lambda.Lambda>). Subclasses may be defined in one of two ways:


Constructor Summary
PendingContinuation()
           
 
Method Summary
<R> Continuation<R>
compose(Lambda<? super T,? extends Continuation<? extends R>> c)
          Create a ComposedContinuation in terms of this object and the provided function.
 boolean isResolved()
          Return false.
abstract  Continuation<? extends T> step()
          Defines the next step of the continuation.
 T value()
          Iteratively invoke step() until a resolved continuation is produced.
 
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
 

Constructor Detail

PendingContinuation

public PendingContinuation()
Method Detail

value

public T value()
Iteratively invoke step() until a resolved continuation is produced.

Specified by:
value in interface Thunk<T>
Specified by:
value in interface Continuation<T>

isResolved

public boolean isResolved()
Return false.

Specified by:
isResolved in interface ResolvingThunk<T>
Specified by:
isResolved in interface Continuation<T>

compose

public <R> Continuation<R> compose(Lambda<? super T,? extends Continuation<? extends R>> c)
Create a ComposedContinuation in terms of this object and the provided function.

Specified by:
compose in interface Continuation<T>

step

public abstract Continuation<? extends T> step()
Defines the next step of the continuation. For simple tail calls, this is generally a recursive invocation of the current method (or a related method).

Specified by:
step in interface Continuation<T>