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
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
longNext value to generate.
step
longDifference between two consecutively generated values. Equal to 1 by default.
Exceptions
- ArgumentOutOfRangeException
When
bounds
do not containstart
.- 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
longNext value to generate.
step
longDifference 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
longPreviously generated value.
Returns
- long
Next value to generate.
Exceptions
- OverflowException
When an arithmetic overflow occurred.