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