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