Class DivideAndConquer
java.lang.Object
org.ojalgo.concurrent.DivideAndConquer
Divide an index (int) range into smaller parts, and conquer each part in parallel. There are two ways to
use this class:
- Extend it and implement the
conquer(int, int)method, and then invoke it withinvoke(int, int, int). - Use the
DivideAndConquer.Dividerto divide a range and provide aDivideAndConquer.Conquererthat will be called with the range of indices to conquer. You can get aDivideAndConquer.DividerfromProcessingService.newDivider()or fromParallelismSupplier.newDivider(int).
-
Nested Class Summary
Nested ClassesModifier and TypeClassDescriptionstatic interfaceA conquerer is a function that will be called with a range of indices to conquer.static final classA configurable divider that can be used to divide a range of indices and conquer each part in parallel. -
Constructor Summary
Constructors -
Method Summary
Modifier and TypeMethodDescription(package private) static voidcall(ExecutorService executor, int first, int limit, int threshold, int workers, DivideAndConquer.Conquerer conquerer) protected abstract voidconquer(int first, int limit) final voidinvoke(int first, int limit, int threshold) Synchronous execution - wait until it's finished.
-
Constructor Details
-
DivideAndConquer
public DivideAndConquer()
-
-
Method Details
-
call
static void call(ExecutorService executor, int first, int limit, int threshold, int workers, DivideAndConquer.Conquerer conquerer) -
invoke
public final void invoke(int first, int limit, int threshold) Synchronous execution - wait until it's finished.- Parameters:
first- The first index, in a range, to include.limit- The first index NOT to include - last (excl.) index in a range.
-
conquer
protected abstract void conquer(int first, int limit)
-