Table of Contents

Class LongSequenceGenerator

Namespace
LfrlAnvil.Generators
Assembly
LfrlAnvil.Core.dll

Represents long sequence generator of values within specified range.

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

Constructors

LongSequenceGenerator()

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

public LongSequenceGenerator()

LongSequenceGenerator(Bounds<long>)

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

public LongSequenceGenerator(Bounds<long> bounds)

Parameters

bounds Bounds<long>

Range of values that can be generated.

LongSequenceGenerator(Bounds<long>, long, long)

Creates a new LongSequenceGenerator instance.

public LongSequenceGenerator(Bounds<long> bounds, long start, long step = 1)

Parameters

bounds Bounds<long>

Range of values that can be generated.

start long

Next value to generate.

step long

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.

LongSequenceGenerator(long, long)

Creates a new LongSequenceGenerator instance with greatest possible Bounds.

public LongSequenceGenerator(long start, long step = 1)

Parameters

start long

Next value to generate.

step long

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

Exceptions

ArgumentException

When step is equal to 0.

Methods

AddStep(long)

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

protected override sealed long AddStep(long value)

Parameters

value long

Previously generated value.

Returns

long

Next value to generate.

Exceptions

OverflowException

When an arithmetic overflow occurred.