mirror of
https://github.com/PolyhedralDev/Terra.git
synced 2025-07-03 00:15:35 +00:00
fix Column
This commit is contained in:
parent
7ce8dfbc65
commit
cc9f9cc8d8
@ -33,15 +33,16 @@ public interface Column<T> {
|
||||
default void forRanges(IntIntObjConsumer<T> consumer) {
|
||||
int min = getMinY();
|
||||
|
||||
int y = min + 1;
|
||||
int y = min;
|
||||
|
||||
T runningObj = get(y);
|
||||
|
||||
T runningObj = get(min);
|
||||
|
||||
|
||||
int runningMin = min;
|
||||
int max = (getMaxY() - 1);
|
||||
|
||||
int max = getMaxY() - 1;
|
||||
|
||||
while(y < max) {
|
||||
y++;
|
||||
T current = get(y);
|
||||
|
||||
if(!current.equals(runningObj)) {
|
||||
@ -49,7 +50,6 @@ public interface Column<T> {
|
||||
runningMin = y;
|
||||
runningObj = current;
|
||||
}
|
||||
y++;
|
||||
}
|
||||
consumer.accept(runningMin, ++y, runningObj);
|
||||
}
|
||||
|
@ -51,7 +51,7 @@ public class ColumnTest {
|
||||
|
||||
returnY.forRanges((min, max, p) -> list.add(Pair.of(Pair.of(min, max), p)));
|
||||
|
||||
assertEquals(IntStream.range(-10, 11).mapToObj(i -> Pair.of(Pair.of(i, i + 1), i)).collect(Collectors.toList()),
|
||||
assertEquals(IntStream.range(-10, 10).mapToObj(i -> Pair.of(Pair.of(i, i + 1), i)).collect(Collectors.toList()),
|
||||
list);
|
||||
}
|
||||
static class ColumnImpl<T> implements Column<T> {
|
||||
|
Loading…
x
Reference in New Issue
Block a user