Class SequentialIntegerGenerator.Builder
- Enclosing class:
SequentialIntegerGenerator
Fluent builder for
SequentialIntegerGenerator.-
Field Summary
Fields inherited from class AbstractBuilder
DEFAULT_REFERENCE, random -
Constructor Summary
ConstructorsConstructorDescriptionBuilder(RandomGenerator random) Creates a builder backed by the given seeded random source. -
Method Summary
-
Constructor Details
-
Builder
Creates a builder backed by the given seeded random source.- Parameters:
random- the random source used to draw generated values
-
-
Method Details
-
start
The first value of the sequence, inclusive. It is the value emitted for row 0 and the value the sequence wraps back to afterendis emitted. Defaults to1.- Parameters:
start- the lowest value of the cycle, inclusive- Returns:
- this builder, for chaining
-
end
The last value of the sequence, inclusive. Onceendis emitted the next call wraps back tostart, so the generator cycles through[start, end]forever. Defaults toInteger.MAX_VALUE. Must be>= start, otherwisebuild()throws.- Parameters:
end- the highest value of the cycle, inclusive- Returns:
- this builder, for chaining
-
build
Builds the generator.- Returns:
- a new
SequentialIntegerGeneratorover the inclusive range[start, end] - Throws:
IllegalArgumentException- ifend < start
-