Skip to content

MockSeriesCursor

ClassMockMagiccom.wetzold.mock-magic
public sealed class MockSeriesCursor

Continues a series pattern across successive requests, so live streams follow the pattern over time instead of restarting it with every emission.

Each cycle has the shape MockSeries.GenerateValues(SeriesPattern, int, float, float, float) produces for MockSeriesCursor.CycleLength points and repeats with fresh randomness. Random walks continue from their last value. Range or noise changes apply to the next value while keeping the cycle position.

public const int DefaultCycleLength = 50

Default number of points per pattern cycle.

Returns

System.Int32

public MockSeriesCursor(SeriesPattern pattern, int cycleLength = 50)

Creates a cursor at the start of the pattern.

Parameters

Name Type Description
pattern MockMagic.SeriesPattern Pattern to follow.
cycleLength System.Int32 Points per pattern cycle; values below 2 use 2.

public float[] Next(int count, float min, float max, float noise)

Returns the next values of the pattern.

Parameters

Name Type Description
count System.Int32 Number of values to produce.
min System.Single Lowest value.
max System.Single Highest value.
noise System.Single Random variation relative to the range, as in MockSeries.GenerateValues(SeriesPattern, int, float, float, float).

Returns

System.Single[]: The values that follow the previously returned ones.

public void ContinueFrom(float value)

Continues a random walk from value instead of the middle of the range; other patterns ignore it.

Parameters

Name Type Description
value System.Single Last value of data the walk should continue.
public void Reset()

Returns to the start of the pattern.

public SeriesPattern Pattern { get; }

Pattern the cursor follows.

Returns

MockMagic.SeriesPattern

public int CycleLength { get; }

Points per pattern cycle.

Returns

System.Int32

public long Position { get; }

Number of values produced since creation or the last MockSeriesCursor.Reset().

Returns

System.Int64