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