|
Copyright Workingmouse Pty. Ltd. 2007, 2008 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.Strategy<A>
public final class Strategy<A>
Functional-style parallel processing for Java. A Strategy is a method of turning a closure into a Future, from which the result of its evaluation can be retrieved at a later time.
| Method Summary | ||
|---|---|---|
static
|
completionStrategy(CompletionService<A> s)
Provides a parallelization strategy that uses a CompletionService to control the method and degree of parallelism, and where each parallel task's completion is registered with the service. |
|
|
concurry(F<B,A> f)
Promotes a function to a concurrent function. |
|
|
concurry(F2<B,C,A> f)
Promotes a function of arity-2 to a concurrent function. |
|
static
|
discard()
Returns an Effect that waits for a given Future to obtain a value, discarding the value. |
|
static
|
executorStrategy(ExecutorService s)
Provides a parallelization strategy that uses an ExecutorService to control the method and degree of parallelism. |
|
F<P1<A>,Future<A>> |
f()
Returns the functional representation of this Strategy. |
|
static
|
mergeAll(List<Future<A>> xs)
Waits for every Future in a list to obtain a value, and collects those values in a list. |
|
static
|
obtain()
Returns a function which returns a closure which waits for the given Future to obtain a value. |
|
F<P1<A>,P1<A>> |
par()
Returns a function that evaluates a closure concurrently. |
|
P1<A> |
par(P1<A> a)
Apply the strategy to the given closure, evaluating it concurrently. |
|
static
|
parFlatMap(Strategy<List<B>> s,
F<A,List<B>> f,
List<A> as)
Binds the given function in parallel across the given list, using the given strategy, with a final join. |
|
P1<List<A>> |
parList(List<P1<A>> ps)
Evaluates a list of closures in parallel. |
|
static
|
parListChunk(Strategy<List<A>> s,
int chunkLength,
List<P1<A>> as)
Sequentially evaluates chunks (sub-sequences) of a list in parallel. |
|
|
parMap_()
First-class version of parMap on lists |
|
|
parMap(F<B,A> f)
Lifts a function to a parallel function on lists using this strategy. |
|
|
parMap(F<B,A> f,
List<B> bs)
Maps the given function over the given list in parallel using this strategy. |
|
|
parMap1_()
First-class version of parMap1 on lists |
|
|
parMap1(F<B,A> f)
Lifts a function to a blocking parallel function on lists, using this strategy. |
|
|
parMapStream(F<B,A> f)
Lifts a function to a parallel function on streams using this strategy. |
|
|
parMapStream1_()
First-class version of parMap1 on streams |
|
|
parMapStream1(F<B,A> f)
Lifts a function to a blocking parallel function on streams, using this strategy. |
|
|
parZipWith(F2<B,C,A> f)
Lifts a given function of arity-2 so that it zips together two lists in parallel, using this strategy, calling the function once for each corresponding pair in the lists, position-wise. |
|
|
parZipWith(F2<B,C,A> f,
List<B> bs,
List<C> cs)
Zips together two lists in parallel using a given function, with this strategy. |
|
static
|
simpleThreadStrategy()
Provides a simple parallelization strategy that creates, and discards, a new thread for every evaluation. |
|
static
|
strategy(F<P1<A>,Future<A>> f)
Constructs a strategy from the given Future-valued function. |
|
| Methods inherited from class java.lang.Object |
|---|
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait |
| Method Detail |
|---|
public F<P1<A>,Future<A>> f()
public static <A> Strategy<A> strategy(F<P1<A>,Future<A>> f)
f - The execution function for the strategy
public P1<A> par(P1<A> a)
a - A P1 to evaluate concurrently.
public F<P1<A>,P1<A>> par()
public <B> F<B,P1<A>> concurry(F<B,A> f)
f - A function to promote to a concurrent function.
public <B,C> F<B,F<C,P1<A>>> concurry(F2<B,C,A> f)
f - The function to promote to a concurrent function.
public static <A> List<P1<A>> mergeAll(List<Future<A>> xs)
xs - The list of Futures from which to get values.
public P1<List<A>> parList(List<P1<A>> ps)
ps - A list to evaluate in parallel.
public <B> F<List<B>,P1<List<A>>> parMap(F<B,A> f)
f - A function to transform into a parallel function on lists.
public <B> P1<List<A>> parMap(F<B,A> f,
List<B> bs)
f - A function to map over the given list in parallel.bs - A list over which to map the given function in parallel.
public <B> F<List<B>,List<A>> parMap1(F<B,A> f)
f - A function to transform into a blocking parallel function on lists.
public <B> F<F<B,A>,F<List<B>,P1<List<A>>>> parMap_()
public <B> F<F<B,A>,F<List<B>,List<A>>> parMap1_()
public <B> F<Stream<B>,P1<Stream<A>>> parMapStream(F<B,A> f)
f - A function to transform into a parallel function on streams.
public <B> F<Stream<B>,Stream<A>> parMapStream1(F<B,A> f)
f - A function to transform into a blocking parallel function on streams.
public <B> F<F<B,A>,F<Stream<B>,Stream<A>>> parMapStream1_()
public static <A,B> P1<List<B>> parFlatMap(Strategy<List<B>> s,
F<A,List<B>> f,
List<A> as)
s - The strategy to use for parallelization.f - The function to bind across the given list.as - The list across which to bind the given function.
public static <A> P1<List<A>> parListChunk(Strategy<List<A>> s,
int chunkLength,
List<P1<A>> as)
s - The strategy to use for parallelization.chunkLength - The length of each sequence.as - The list to evaluate in parallel chunks.
public <B,C> P1<List<A>> parZipWith(F2<B,C,A> f,
List<B> bs,
List<C> cs)
f - The function of arity-2 with which to zip.bs - A list to zip with the given function.cs - A list to zip with the given function.
public <B,C> F2<List<B>,List<C>,P1<List<A>>> parZipWith(F2<B,C,A> f)
f - The function of arity-2 with which to zip.
public static <A> F<Future<A>,P1<A>> obtain()
public static <A> Effect<Future<A>> discard()
public static <A> Strategy<A> simpleThreadStrategy()
public static <A> Strategy<A> executorStrategy(ExecutorService s)
s - The ExecutorService to use for scheduling evaluations.
public static <A> Strategy<A> completionStrategy(CompletionService<A> s)
s - The CompletionService to use for scheduling evaluations and detect their completion.
|
Copyright Workingmouse Pty. Ltd. 2007, 2008 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 | ||||||||