Table of Contents

Class ShortSequenceGenerator

Namespace
LfrlAnvil.Generators
Assembly
LfrlAnvil.Core.dll

Represents short sequence generator of values within specified range.

public class ShortSequenceGenerator : SequenceGeneratorBase<short>, ISequenceGenerator<short>, IBoundGenerator<short>, IGenerator<short>, IGenerator
Inheritance
ShortSequenceGenerator
Implements
Inherited Members
Extension Methods

Constructors

ShortSequenceGenerator()

Creates a new ShortSequenceGenerator instance that starts with 0, with Step equal to 1 and with greatest possible Bounds.

public ShortSequenceGenerator()

ShortSequenceGenerator(Bounds<short>)

Creates a new ShortSequenceGenerator instance that starts with minimum possible value defined by bounds, with Step equal to 1.

public ShortSequenceGenerator(Bounds<short> bounds)

Parameters

bounds Bounds<short>

Range of values that can be generated.

ShortSequenceGenerator(Bounds<short>, short, short)

Creates a new ShortSequenceGenerator instance.

public ShortSequenceGenerator(Bounds<short> bounds, short start, short step = 1)

Parameters

bounds Bounds<short>

Range of values that can be generated.

start short

Next value to generate.

step short

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.

ShortSequenceGenerator(short, short)

Creates a new ShortSequenceGenerator instance with greatest possible Bounds.

public ShortSequenceGenerator(short start, short step = 1)

Parameters

start short

Next value to generate.

step short

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

Exceptions

ArgumentException

When step is equal to 0.

Methods

AddStep(short)

Adds Step to the previously generated value in order to calculate the next value to generate.

protected override sealed short AddStep(short value)

Parameters

value short

Previously generated value.

Returns

short

Next value to generate.

Exceptions

OverflowException

When an arithmetic overflow occurred.