TParameter1
- The type of the first parameter passed to the body of the loop.TParameter2
- The type of the second parameter passed to the body of the loop.public abstract static class ThreadedCalculation.BodyCallback2<TParameter1,TParameter2> extends Delegate
ThreadingPolicy
with only one thread unless it is explicitly set inside the callback.Modifier and Type | Class and Description |
---|---|
static interface |
ThreadedCalculation.BodyCallback2.Function<TParameter1,TParameter2>
A functional interface for the containing delegate type.
|
Constructor and Description |
---|
BodyCallback2()
Creates a new instance of this delegate.
|
BodyCallback2(Class<?> targetClass,
String methodName,
Class<?>... methodParameterClasses)
Initializes a delegate that will invoke a static method on a class.
|
BodyCallback2(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(TParameter1 parameter1,
TParameter2 parameter2,
int i)
A delegate representing the body of a multithreaded 'for' loop.
|
static <TParameter1,TParameter2> |
of(ThreadedCalculation.BodyCallback2.Function<TParameter1,TParameter2> f)
Create a delegate for the given interface.
|
static <TParameter1,TParameter2> |
of(ThreadedCalculation.BodyCallback2.Function<TParameter1,TParameter2> f,
Class<?> targetClass,
String methodName,
Class<?>... methodParameterClasses)
Create a delegate for the given interface.
|
static <TParameter1,TParameter2> |
of(ThreadedCalculation.BodyCallback2.Function<TParameter1,TParameter2> f,
Object targetObject,
String methodName,
Class<?>... methodParameterClasses)
Create a delegate for the given interface.
|
public BodyCallback2()
public BodyCallback2(@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 BodyCallback2(@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(TParameter1 parameter1, TParameter2 parameter2, int i)
ThreadingPolicy
with only one thread unless it is explicitly set inside the callback.parameter1
- The first 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
.parameter2
- The second 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.@Nonnull public static <TParameter1,TParameter2> ThreadedCalculation.BodyCallback2<TParameter1,TParameter2> of(@Nonnull ThreadedCalculation.BodyCallback2.Function<TParameter1,TParameter2> f)
f
- The function which will be invoked.@Nonnull public static <TParameter1,TParameter2> ThreadedCalculation.BodyCallback2<TParameter1,TParameter2> of(@Nonnull ThreadedCalculation.BodyCallback2.Function<TParameter1,TParameter2> 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 <TParameter1,TParameter2> ThreadedCalculation.BodyCallback2<TParameter1,TParameter2> of(@Nonnull ThreadedCalculation.BodyCallback2.Function<TParameter1,TParameter2> 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.