You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
forEachOffset( min, max, blockSize, ( to, d ) -> p.setPosition( to, d ), d -> p.getLongPosition( d ), ( by, d ) -> p.move( by, d ), runAtOffset );
132
+
}
133
+
134
+
/**
135
+
*
136
+
* Execute {@code runAtOffset} for each offset of a grid defined by
137
+
* {@code min}, {@code max}, and {@code blockSize}.
138
+
*
139
+
* @param min
140
+
* @param max
141
+
* @param blockSize
142
+
* @param runAtOffset
143
+
*/
144
+
publicstaticvoidforEachOffset(
145
+
finallong[] min,
146
+
finallong[] max,
147
+
finalint[] blockSize,
148
+
finalConsumer< long[] > runAtOffset )
149
+
{
150
+
finallong[] offset = newlong[ min.length ];
151
+
forEachOffset( min, max, blockSize, ( to, d ) -> offset[ d ] = to, ( d ) -> offset[ d ], ( by, d ) -> offset[ d ] += by, () -> runAtOffset.accept( offset ) );
152
+
}
153
+
154
+
/**
155
+
* Execute a {@link Runnable} for each offset of a grid defined by
156
+
* {@code min}, {@code max}, and {@code blockSize}.
157
+
*
158
+
* This method is agonstic of the object that represents the current offset.
159
+
* Instead, the caller provides {@code setOffsetForDimension},
160
+
* {@code getOffsetForDimension}, and {@code moveForDimension} to move the
161
+
* offset object in the correct positions. Consequently,
162
+
* {@code runAtEachOffset} needs to be a stateful object that is aware of
163
+
* the current position.
164
+
*
165
+
* See {@link Grids#forEachOffset(long[], long[], int[], Consumer)} and
0 commit comments