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