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

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

public class ValueContinuation<T>
extends Object
implements Continuation<T>

A continuation that is resolved at creation time.


Constructor Summary
ValueContinuation(T val)
          Wrap the given value as a continuation.
 
Method Summary
<R> Continuation<R>
compose(Lambda<? super T,? extends Continuation<? extends R>> c)
          Create a ComposedContinuation in terms of this object and c.
 boolean isResolved()
          Always true.
static
<T> ValueContinuation<T>
make(T val)
          Call the constructor (allows T to be inferred).
 Continuation<T> step()
          Throw an IllegalStateException, because this continuation is already resolved.
 T value()
          Return the wrapped value.
 
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
 

Constructor Detail

ValueContinuation

public ValueContinuation(T val)
Wrap the given value as a continuation.

Method Detail

value

public T value()
Return the wrapped value.

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

isResolved

public boolean isResolved()
Always true.

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

step

public Continuation<T> step()
Throw an IllegalStateException, because this continuation is already resolved.

Specified by:
step 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 c.

Specified by:
compose in interface Continuation<T>

make

public static <T> ValueContinuation<T> make(T val)
Call the constructor (allows T to be inferred).