Package net.imglib2.loops
Class FastCursorLoops
- java.lang.Object
-
- net.imglib2.loops.FastCursorLoops
-
public final class FastCursorLoops extends java.lang.ObjectA package-private utility class that's used byLoopBuilder.- See Also:
createLoop(Object, List)
-
-
Nested Class Summary
Nested Classes Modifier and Type Class Description static classFastCursorLoops.FiveCursorLoop<A,B,C,D,E>static classFastCursorLoops.FourCursorLoop<A,B,C,D>static classFastCursorLoops.OneCursorLoop<A>static classFastCursorLoops.SixCursorLoop<A,B,C,D,E,F>static classFastCursorLoops.ThreeCursorLoop<A,B,C>static classFastCursorLoops.TwoCursorLoop<A,B>
-
Field Summary
Fields Modifier and Type Field Description private static java.util.List<ClassCopyProvider<java.util.function.LongConsumer>>factories
-
Constructor Summary
Constructors Modifier Constructor Description privateFastCursorLoops()
-
Method Summary
All Methods Static Methods Concrete Methods Modifier and Type Method Description static java.util.function.LongConsumercreateLoop(java.lang.Object action, java.util.List<? extends Cursor<?>> cursors)For example.: Given a BiConsumer and two Cursors:
-
-
-
Field Detail
-
factories
private static final java.util.List<ClassCopyProvider<java.util.function.LongConsumer>> factories
-
-
Method Detail
-
createLoop
public static java.util.function.LongConsumer createLoop(java.lang.Object action, java.util.List<? extends Cursor<?>> cursors)For example.: Given a BiConsumer and two Cursors:
This methodBiConsumer<A, B> biConsumer = ... ; Cursor<A> cursorA = ... ; Cursor<B> cursorB = ... ;createLoop(biConsumer, Arrays.asList(cursorA, cursorB))will return a LongConsumer that is functionally equivalent to:
The returnedLongConsumer loop = n -> { for ( long i = 0; i < n; i++ ) biConsumer.accept( cursorA.next(), cursorB.next() ); };LongConsumeris created in a way, that it can be gracefully optimised by the Java just-in-time compiler.- Parameters:
action- This must be an instance ofConsumer,BiConsumer,LoopBuilder.TriConsumer,LoopBuilder.FourConsumer,LoopBuilder.FiveConsumerorLoopBuilder.SixConsumer.cursors- A list ofCursor, the size of the list must fit given action.- Throws:
java.lang.IllegalArgumentException- if the number of cursor does not fit the given consumer.
-
-