private boolean nextIsLeft() { boolean returnLeft; if (leftHasNext) { if (rightHasNext) { int leftFirstDayIndex = nextLeft.getFirstDayIndex(); int rightFirstDayIndex = nextRight.getFirstDayIndex(); returnLeft = leftFirstDayIndex <= rightFirstDayIndex; } else { returnLeft = true; } } else { if (rightHasNext) { returnLeft = false; } else { throw new NoSuchElementException(); } } return returnLeft; }
public boolean hasNextWithMaximumFirstDayIndexes( int leftMinimumFirstDayIndex, int rightMinimumFirstDayIndex) { if (!hasNext()) { return false; } boolean nextIsLeft = nextIsLeft(); if (nextIsLeft) { int firstDayIndex = nextLeft.getFirstDayIndex(); // It should not be conflict in the same pillar and it should be in conflict with the other // pillar return firstDayIndex > leftMinimumFirstDayIndex && firstDayIndex <= rightMinimumFirstDayIndex; } else { int firstDayIndex = nextRight.getFirstDayIndex(); // It should not be conflict in the same pillar and it should be in conflict with the other // pillar return firstDayIndex > rightMinimumFirstDayIndex && firstDayIndex <= leftMinimumFirstDayIndex; } }