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