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
boundsBounds<ulong>Range of values that can be generated.
startulongNext value to generate.
stepulongDifference between two consecutively generated values. Equal to 1 by default.
Exceptions
- ArgumentOutOfRangeException
When
boundsdo not containstart.- ArgumentException
When
stepis equal to 0.
UlongSequenceGenerator(ulong, ulong)
Creates a new UlongSequenceGenerator instance with greatest possible Bounds.
public UlongSequenceGenerator(ulong start, ulong step = 1)
Parameters
startulongNext value to generate.
stepulongDifference between two consecutively generated values. Equal to 1 by default.
Exceptions
- ArgumentException
When
stepis 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
valueulongPreviously generated value.
Returns
- ulong
Next value to generate.
Exceptions
- OverflowException
When an arithmetic overflow occurred.