Class IntSequenceGenerator
- Namespace
- LfrlAnvil.Generators
- Assembly
- LfrlAnvil.Core.dll
Represents int sequence generator of values within specified range.
public class IntSequenceGenerator : SequenceGeneratorBase<int>, ISequenceGenerator<int>, IBoundGenerator<int>, IGenerator<int>, IGenerator
- Inheritance
-
IntSequenceGenerator
- Implements
- Inherited Members
- Extension Methods
Constructors
IntSequenceGenerator()
Creates a new IntSequenceGenerator instance that starts with 0, with Step equal to 1 and with greatest possible Bounds.
public IntSequenceGenerator()
IntSequenceGenerator(Bounds<int>)
Creates a new IntSequenceGenerator instance that starts with
minimum possible value defined by bounds
, with Step equal to 1.
public IntSequenceGenerator(Bounds<int> bounds)
Parameters
IntSequenceGenerator(Bounds<int>, int, int)
Creates a new IntSequenceGenerator instance.
public IntSequenceGenerator(Bounds<int> bounds, int start, int step = 1)
Parameters
bounds
Bounds<int>Range of values that can be generated.
start
intNext value to generate.
step
intDifference between two consecutively generated values. Equal to 1 by default.
Exceptions
- ArgumentOutOfRangeException
When
bounds
do not containstart
.- ArgumentException
When
step
is equal to 0.
IntSequenceGenerator(int, int)
Creates a new IntSequenceGenerator instance with greatest possible Bounds.
public IntSequenceGenerator(int start, int step = 1)
Parameters
start
intNext value to generate.
step
intDifference between two consecutively generated values. Equal to 1 by default.
Exceptions
- ArgumentException
When
step
is equal to 0.
Methods
AddStep(int)
Adds Step to the previously generated value in order to calculate the next value to generate.
protected override sealed int AddStep(int value)
Parameters
value
intPreviously generated value.
Returns
- int
Next value to generate.
Exceptions
- OverflowException
When an arithmetic overflow occurred.