Class ByteSequenceGenerator
- Namespace
- LfrlAnvil.Generators
- Assembly
- LfrlAnvil.Core.dll
Represents byte sequence generator of values within specified range.
public class ByteSequenceGenerator : SequenceGeneratorBase<byte>, ISequenceGenerator<byte>, IBoundGenerator<byte>, IGenerator<byte>, IGenerator
- Inheritance
-
ByteSequenceGenerator
- Implements
- Inherited Members
- Extension Methods
Constructors
ByteSequenceGenerator()
Creates a new ByteSequenceGenerator instance that starts with 0, with Step equal to 1 and with greatest possible Bounds.
public ByteSequenceGenerator()
ByteSequenceGenerator(Bounds<byte>)
Creates a new ByteSequenceGenerator instance that starts with
minimum possible value defined by bounds
, with Step equal to 1.
public ByteSequenceGenerator(Bounds<byte> bounds)
Parameters
ByteSequenceGenerator(Bounds<byte>, byte, byte)
Creates a new ByteSequenceGenerator instance.
public ByteSequenceGenerator(Bounds<byte> bounds, byte start, byte step = 1)
Parameters
bounds
Bounds<byte>Range of values that can be generated.
start
byteNext value to generate.
step
byteDifference between two consecutively generated values. Equal to 1 by default.
Exceptions
- ArgumentOutOfRangeException
When
bounds
do not containstart
.- ArgumentException
When
step
is equal to 0.
ByteSequenceGenerator(byte, byte)
Creates a new ByteSequenceGenerator instance with greatest possible Bounds.
public ByteSequenceGenerator(byte start, byte step = 1)
Parameters
start
byteNext value to generate.
step
byteDifference between two consecutively generated values. Equal to 1 by default.
Exceptions
- ArgumentException
When
step
is equal to 0.
Methods
AddStep(byte)
Adds Step to the previously generated value in order to calculate the next value to generate.
protected override sealed byte AddStep(byte value)
Parameters
value
bytePreviously generated value.
Returns
- byte
Next value to generate.
Exceptions
- OverflowException
When an arithmetic overflow occurred.