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