Class BindActionToSamplers
java.lang.Object
net.imglib2.loops.BindActionToSamplers
Package-private utility class that's used by
LoopBuilder.-
Nested Class Summary
Nested ClassesModifier and TypeClassDescriptionstatic classstatic classstatic classstatic classstatic classstatic class -
Field Summary
Fields -
Constructor Summary
Constructors -
Method Summary
Modifier and TypeMethodDescriptionstatic RunnablebindActionToSamplers(Object action, List<? extends Sampler<?>> samplers) For example.: Given a BiConsumer and two Samplers:
-
Field Details
-
factories
-
-
Constructor Details
-
BindActionToSamplers
BindActionToSamplers()
-
-
Method Details
-
bindActionToSamplers
For example.: Given a BiConsumer and two Samplers:
This methodBiConsumer<A, B> biConsumer = ... ; Sampler<A> samplerA = ... ; Sampler<B> samplerB = ... ;bindConsumerToSamplers(biConsumer, Arrays.asList(samplerA, samplerB))will return a Runnable that is functionally equivalent to:
It does it in such manner, that the returnedRunnable result = () -> { biConsumer.accept( sampleA.get(), samplerB.get() ); };Runnablecan be gracefully optimised by the Java just-in-time compiler.- Parameters:
action- This must be an instance ofConsumer,BiConsumerofLoopBuilder.TriConsumer.LoopBuilder.FourConsumer,LoopBuilder.FourConsumer, orLoopBuilder.SixConsumer.samplers- A list ofSampler, the size of the list must fit the consumer given by .- Throws:
IllegalArgumentException- if the number of sampler does not fit the given consumer.
-