Table of Contents

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

bounds Bounds<Fixed>

Range of values that can be generated.

FixedSequenceGenerator(Bounds<Fixed>, Fixed, Fixed?)

Creates a new FixedSequenceGenerator instance.

public FixedSequenceGenerator(Bounds<Fixed> bounds, Fixed start, Fixed? step = null)

Parameters

bounds Bounds<Fixed>

Range of values that can be generated.

start Fixed

Next value to generate.

step Fixed?

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

Exceptions

ArgumentOutOfRangeException

When bounds do not contain start.

ArgumentException

When step is equal to 0.

FixedSequenceGenerator(Fixed, Fixed?)

Creates a new FixedSequenceGenerator instance with greatest possible Bounds.

public FixedSequenceGenerator(Fixed start, Fixed? step = null)

Parameters

start Fixed

Next value to generate.

step Fixed?

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

Exceptions

ArgumentException

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

decimals byte

Precision of generated values. Equal to 0 by default.

Exceptions

ArgumentOutOfRangeException

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

value Fixed

Previously generated value.

Returns

Fixed

Next value to generate.

Exceptions

OverflowException

When an arithmetic overflow occurred.