edu.rice.cs.plt.recur
Class ArgContinuation<T,R>

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

public abstract class ArgContinuation<T,R>
extends PendingContinuation<R>

A continuation for results that depend on a single recursive invocation, followed by some additional computation. Instances must implement arg(), which wraps the recursive invocation, and apply(T), which performs the remaining computation.


Constructor Summary
ArgContinuation()
           
 
Method Summary
protected abstract  Continuation<? extends R> apply(T arg)
          Given the result of evaluating arg(), produce a continuation for the ultimate result.
protected abstract  Continuation<? extends T> arg()
          Produce a continuation computing the result of a recursive invocation.
 Continuation<R> step()
          Create a ComposedContinuation in terms of the result of arg() and a lambda wrapper of apply().
 
Methods inherited from class edu.rice.cs.plt.recur.PendingContinuation
compose, isResolved, value
 
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
 

Constructor Detail

ArgContinuation

public ArgContinuation()
Method Detail

arg

protected abstract Continuation<? extends T> arg()
Produce a continuation computing the result of a recursive invocation.


apply

protected abstract Continuation<? extends R> apply(T arg)
Given the result of evaluating arg(), produce a continuation for the ultimate result.


step

public Continuation<R> step()
Create a ComposedContinuation in terms of the result of arg() and a lambda wrapper of apply().

Specified by:
step in interface Continuation<R>
Specified by:
step in class PendingContinuation<R>