Table of Contents

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

bounds Bounds<decimal>

Range of values that can be generated.

DecimalSequenceGenerator(Bounds<decimal>, decimal, decimal)

Creates a new DecimalSequenceGenerator instance.

public DecimalSequenceGenerator(Bounds<decimal> bounds, decimal start, decimal step = 1)

Parameters

bounds Bounds<decimal>

Range of values that can be generated.

start decimal

Next value to generate.

step decimal

Difference between two consecutively generated values. Equal to 1 by default.

Exceptions

ArgumentOutOfRangeException

When bounds do not contain start.

ArgumentException

When step is equal to 0.

DecimalSequenceGenerator(decimal, decimal)

Creates a new DecimalSequenceGenerator instance with greatest possible Bounds.

public DecimalSequenceGenerator(decimal start, decimal step = 1)

Parameters

start decimal

Next value to generate.

step decimal

Difference between two consecutively generated values. Equal to 1 by default.

Exceptions

ArgumentException

When step is 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

value decimal

Previously generated value.

Returns

decimal

Next value to generate.

Exceptions

OverflowException

When an arithmetic overflow occurred.