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
boundsBounds<long>Range of values that can be generated.
startlongNext value to generate.
steplongDifference between two consecutively generated values. Equal to 1 by default.
Exceptions
- ArgumentOutOfRangeException
When
boundsdo not containstart.- ArgumentException
When
stepis equal to 0.
LongSequenceGenerator(long, long)
Creates a new LongSequenceGenerator instance with greatest possible Bounds.
public LongSequenceGenerator(long start, long step = 1)
Parameters
startlongNext value to generate.
steplongDifference between two consecutively generated values. Equal to 1 by default.
Exceptions
- ArgumentException
When
stepis 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
valuelongPreviously generated value.
Returns
- long
Next value to generate.
Exceptions
- OverflowException
When an arithmetic overflow occurred.