Interface CycleSegment
- All Known Implementing Classes:
CycleArray.ArraySegment,InputInterval.Segment
public interface CycleSegment
A segment of cycle numbers to iterate over. Usage of an InputSegment
is meant to be stack-local, or at least single threaded, so no
precautions are needed to make it thread safe.
-
Method Summary
Modifier and TypeMethodDescriptionbooleanlongThe next cycle, which should be a positive number between 0 and Long.MAX_VALUE.default long[]nextCycles(int len) longlongReturn the value of the next cycle which would be returned bynextCycle()} without modifying the segment, or a negative number if the cycle range would be outside the valid range for this segment.
-
Method Details
-
nextCycle
long nextCycle()The next cycle, which should be a positive number between 0 and Long.MAX_VALUE. If a negative value is returned, then the caller should disregard the value and assume that any further input segments will be invalid.Implementations of this method should not worry about thread safety.
- Returns:
- a positive and valid long cycle, or a negative indicator of end of input
-
nextRecycle
long nextRecycle() -
isExhausted
boolean isExhausted()- Returns:
- true if the input can provide no further cycles
-
nextCycles
default long[] nextCycles(int len) -
peekNextCycle
long peekNextCycle()Return the value of the next cycle which would be returned bynextCycle()} without modifying the segment, or a negative number if the cycle range would be outside the valid range for this segment.- Returns:
- the next cycle that will be returned
-