edu.rice.cs.plt.recur
Class BinaryArgContinuation<T1,T2,R>

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

public abstract class BinaryArgContinuation<T1,T2,R>
extends PendingContinuation<R>

A continuation for results that depend on a two recursive invocations, followed by some additional computation. Instances must implement arg1(), which wraps the first recursive invocation, arg2(), which wraps the second, and apply(T1, T2), which performs the remaining computation.


Constructor Summary
BinaryArgContinuation()
           
 
Method Summary
protected abstract  Continuation<? extends R> apply(T1 arg1, T2 arg2)
          Given the results of evaluating arg1() and arg2(), produce a continuation for the ultimate result.
protected abstract  Continuation<? extends T1> arg1()
          Produce a continuation computing the first result of a recursive invocation.
protected abstract  Continuation<? extends T2> arg2()
          Produce a continuation computing the second result of a recursive invocation.
 Continuation<R> step()
          Create a ComposedContinuation in terms of the result of arg1() and a lambda that computes arg2() and ultimately invokes apply() with the results.
 
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

BinaryArgContinuation

public BinaryArgContinuation()
Method Detail

arg1

protected abstract Continuation<? extends T1> arg1()
Produce a continuation computing the first result of a recursive invocation.


arg2

protected abstract Continuation<? extends T2> arg2()
Produce a continuation computing the second result of a recursive invocation.


apply

protected abstract Continuation<? extends R> apply(T1 arg1,
                                                   T2 arg2)
Given the results of evaluating arg1() and arg2(), produce a continuation for the ultimate result.


step

public Continuation<R> step()
Create a ComposedContinuation in terms of the result of arg1() and a lambda that computes arg2() and ultimately invokes apply() with the results.

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