TParameter
- The type of an instance that is passed to the body of the loop.public abstract static class ThreadedCalculation.BodyCallbackWithProgress<TParameter> extends Delegate
ThreadingPolicy
with only one thread unless it is explicitly set inside the callback.Modifier and Type | Class and Description |
---|---|
static interface |
ThreadedCalculation.BodyCallbackWithProgress.Function<TParameter>
A functional interface for the containing delegate type.
|
Constructor and Description |
---|
BodyCallbackWithProgress()
Creates a new instance of this delegate.
|
BodyCallbackWithProgress(Class<?> targetClass,
String methodName,
Class<?>... methodParameterClasses)
Initializes a delegate that will invoke a static method on a class.
|
BodyCallbackWithProgress(Object targetObject,
String methodName,
Class<?>... methodParameterClasses)
Initializes a delegate that will invoke an instance method on a class instance.
|
Modifier and Type | Method and Description |
---|---|
abstract void |
invoke(TParameter parameter,
int i,
ITrackCalculationProgress tracker)
A delegate representing the body of a multithreaded 'for' loop, where each iteration
of the loop intends to provide detailed information about its progress.
|
static <TParameter> |
of(ThreadedCalculation.BodyCallbackWithProgress.Function<TParameter> f)
Create a delegate for the given interface.
|
static <TParameter> |
of(ThreadedCalculation.BodyCallbackWithProgress.Function<TParameter> f,
Class<?> targetClass,
String methodName,
Class<?>... methodParameterClasses)
Create a delegate for the given interface.
|
static <TParameter> |
of(ThreadedCalculation.BodyCallbackWithProgress.Function<TParameter> f,
Object targetObject,
String methodName,
Class<?>... methodParameterClasses)
Create a delegate for the given interface.
|
public BodyCallbackWithProgress()
public BodyCallbackWithProgress(@Nonnull Object targetObject, @Nonnull String methodName, @Nonnull Class<?>... methodParameterClasses)
targetObject
- The class instance on which the delegate will invoke the method.methodName
- The name of the instance method.methodParameterClasses
- The type of the parameters of the instance method.public BodyCallbackWithProgress(@Nonnull Class<?> targetClass, @Nonnull String methodName, @Nonnull Class<?>... methodParameterClasses)
targetClass
- The class that defines the method.methodName
- The name of the static method.methodParameterClasses
- The type of the parameters of the static method.public abstract void invoke(TParameter parameter, int i, @Nullable ITrackCalculationProgress tracker)
ThreadingPolicy
with only one thread unless it is explicitly set inside the callback.parameter
- A parameter that is passed to the body of the loop. If this instance implements
IThreadAware
and IsThreadSafe
(get
) returns
false
, a copy of the parameter is made for each thread using
CopyForAnotherThread
.i
- The index to evaluate.tracker
- The object to which progress is reported and that is able to cancel this operation before it is complete, or null
.@Nonnull public static <TParameter> ThreadedCalculation.BodyCallbackWithProgress<TParameter> of(@Nonnull ThreadedCalculation.BodyCallbackWithProgress.Function<TParameter> f)
f
- The function which will be invoked.@Nonnull public static <TParameter> ThreadedCalculation.BodyCallbackWithProgress<TParameter> of(@Nonnull ThreadedCalculation.BodyCallbackWithProgress.Function<TParameter> f, @Nonnull Object targetObject, @Nonnull String methodName, @Nonnull Class<?>... methodParameterClasses)
f
- The function which will be invoked.targetObject
- The class instance on which the delegate will invoke the method.methodName
- The name of the instance method.methodParameterClasses
- The type of the parameters of the instance method.@Nonnull public static <TParameter> ThreadedCalculation.BodyCallbackWithProgress<TParameter> of(@Nonnull ThreadedCalculation.BodyCallbackWithProgress.Function<TParameter> f, @Nonnull Class<?> targetClass, @Nonnull String methodName, @Nonnull Class<?>... methodParameterClasses)
f
- The function which will be invoked.targetClass
- The class that defines the method.methodName
- The name of the static method.methodParameterClasses
- The type of the parameters of the static method.