|
Copyright 2008 - 2010 Tony Morris, Runar Bjarnason, Tom Adams, Brad Clow, Ricky Clarkson, Nick Partridge, Jason Zaugg This software is released under an open source BSD licence. |
||||||||
| PREV CLASS NEXT CLASS | FRAMES NO FRAMES | ||||||||
| SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD | ||||||||
java.lang.Objectfj.control.parallel.Callables
public final class Callables
Monadic functions and conversion methods for java.util.concurrent.Callable.
| Method Summary | ||
|---|---|---|
static
|
apply(java.util.concurrent.Callable<A> ca,
java.util.concurrent.Callable<F<A,B>> cf)
Performs function application within a callable (applicative functor pattern). |
|
static
|
arrow()
Provides a transformation from a function to a Callable-valued function that is equivalent to it. |
|
static
|
bind(java.util.concurrent.Callable<A> ca,
java.util.concurrent.Callable<B> cb,
F<A,F<B,C>> f)
Binds the given function to the values in the given callables with a final join. |
|
static
|
bind(java.util.concurrent.Callable<A> a,
F<A,java.util.concurrent.Callable<B>> f)
Binds the given function to the value in a Callable with a final join. |
|
static
|
callable()
Provides a transformation from a value to a Callable that completely preserves that value. |
|
static
|
callable(A a)
Returns a callable that completely preserves the argument. |
|
static
|
callable(java.lang.Exception e)
Returns a callable that throws the given exception. |
|
static
|
callable(F<A,B> f)
Wraps a given function's return value in a Callable. |
|
static
|
either()
Returns a transformation from a Callable to an Either. |
|
static
|
either(java.util.concurrent.Callable<A> a)
Turns the given Callable into either an exception or the value in the Callable. |
|
static
|
fmap(F<A,B> f)
Lifts any function to a function on Callables. |
|
static
|
fromEither()
Returns a transformation from an Either to a Callable. |
|
static
|
fromEither(P1<Either<java.lang.Exception,A>> e)
Turns a given Either value into the equivalent Callable. |
|
static
|
fromOption()
Returns a transformation from an optional value to a Callable |
|
static
|
fromOption(P1<Option<A>> o)
Turns an optional value into a Callable. |
|
static
|
join(java.util.concurrent.Callable<java.util.concurrent.Callable<A>> a)
Joins a Callable of a Callable with a bind operation. |
|
static
|
liftM2(F<A,F<B,C>> f)
Promotes a function of arity-2 to a function on callables. |
|
static
|
normalise()
A first-class version of the normalise function. |
|
static
|
normalise(java.util.concurrent.Callable<A> a)
Normalises the given Callable by calling it and wrapping the result in a new Callable. |
|
static
|
option()
Returns a transformation from a Callable to an optional value. |
|
static
|
option(java.util.concurrent.Callable<A> a)
Turns the given Callable into an optional value. |
|
static
|
sequence_()
A first-class version of the sequence method. |
|
static
|
sequence(List<java.util.concurrent.Callable<A>> as)
Turns a List of Callables into a single Callable of a List. |
|
| Methods inherited from class java.lang.Object |
|---|
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait |
| Method Detail |
|---|
public static <A> java.util.concurrent.Callable<A> callable(A a)
a - A value to preserve in a Callable
public static <A> java.util.concurrent.Callable<A> callable(java.lang.Exception e)
e - The exception to throw when the Callable is called.
public static <A> F<A,java.util.concurrent.Callable<A>> callable()
public static <A,B> F<A,java.util.concurrent.Callable<B>> callable(F<A,B> f)
f - The function whose return value to wrap in a Callable.
public static <A,B> F<F<A,B>,F<A,java.util.concurrent.Callable<B>>> arrow()
public static <A,B> java.util.concurrent.Callable<B> bind(java.util.concurrent.Callable<A> a,
F<A,java.util.concurrent.Callable<B>> f)
a - A value in a Callable to which to apply a function.f - A function to apply to the value in a Callable.
public static <A,B> F<java.util.concurrent.Callable<A>,java.util.concurrent.Callable<B>> fmap(F<A,B> f)
f - A function to lift to a function on Callables.
public static <A,B> java.util.concurrent.Callable<B> apply(java.util.concurrent.Callable<A> ca,
java.util.concurrent.Callable<F<A,B>> cf)
ca - The callable to which to apply a function.cf - The callable function to apply.
public static <A,B,C> java.util.concurrent.Callable<C> bind(java.util.concurrent.Callable<A> ca,
java.util.concurrent.Callable<B> cb,
F<A,F<B,C>> f)
ca - A given callable to bind the given function with.cb - A given callable to bind the given function with.f - The function to apply to the values in the given callables.
public static <A> java.util.concurrent.Callable<A> join(java.util.concurrent.Callable<java.util.concurrent.Callable<A>> a)
a - The Callable of a Callable to join.
public static <A,B,C> F<java.util.concurrent.Callable<A>,F<java.util.concurrent.Callable<B>,java.util.concurrent.Callable<C>>> liftM2(F<A,F<B,C>> f)
f - The function to promote.
public static <A> java.util.concurrent.Callable<List<A>> sequence(List<java.util.concurrent.Callable<A>> as)
as - The list of callables to transform.
public static <A> F<List<java.util.concurrent.Callable<A>>,java.util.concurrent.Callable<List<A>>> sequence_()
public static <A> P1<Option<A>> option(java.util.concurrent.Callable<A> a)
a - The callable to convert to an optional value.
public static <A> F<java.util.concurrent.Callable<A>,P1<Option<A>>> option()
public static <A> P1<Either<java.lang.Exception,A>> either(java.util.concurrent.Callable<A> a)
a - The callable to convert to an Either value.
public static <A> F<java.util.concurrent.Callable<A>,P1<Either<java.lang.Exception,A>>> either()
public static <A> java.util.concurrent.Callable<A> fromEither(P1<Either<java.lang.Exception,A>> e)
e - Either an exception or a value to wrap in a Callable
public static <A> F<P1<Either<java.lang.Exception,A>>,java.util.concurrent.Callable<A>> fromEither()
public static <A> java.util.concurrent.Callable<A> fromOption(P1<Option<A>> o)
o - An optional value to turn into a Callable.
public static <A> F<P1<Option<A>>,java.util.concurrent.Callable<A>> fromOption()
public static <A> java.util.concurrent.Callable<A> normalise(java.util.concurrent.Callable<A> a)
a - The callable to evaluate.
public static <A> F<java.util.concurrent.Callable<A>,java.util.concurrent.Callable<A>> normalise()
|
Copyright 2008 - 2010 Tony Morris, Runar Bjarnason, Tom Adams, Brad Clow, Ricky Clarkson, Nick Partridge, Jason Zaugg This software is released under an open source BSD licence. |
||||||||
| PREV CLASS NEXT CLASS | FRAMES NO FRAMES | ||||||||
| SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD | ||||||||