- java.lang.Object
-
- org.ojalgo.concurrent.DivideAndConquer
-
public abstract class DivideAndConquer extends java.lang.ObjectDivide 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).
- Extend it and implement the
-
-
Nested Class Summary
Nested Classes Modifier and Type Class Description static interfaceDivideAndConquer.ConquererA conquerer is a function that will be called with a range of indices to conquer.static classDivideAndConquer.DividerA configurable divider that can be used to divide a range of indices and conquer each part in parallel.
-
Constructor Summary
Constructors Constructor Description DivideAndConquer()
-
Method Summary
All Methods Static Methods Instance Methods Abstract Methods Concrete Methods Modifier and Type Method Description (package private) static voidcall(java.util.concurrent.ExecutorService executor, int first, int limit, int threshold, int workers, DivideAndConquer.Conquerer conquerer)protected abstract voidconquer(int first, int limit)voidinvoke(int first, int limit, int threshold)Synchronous execution - wait until it's finished.
-
-
-
Method Detail
-
call
static void call(java.util.concurrent.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)
-
-