Table of Contents

Class RollingWindow<T>

Namespace
FinanceSharp
Assembly
FinanceSharp.dll

This is a window that allows for list access semantics, where this[0] refers to the most recent item in the window and this[Count-1] refers to the last item in the window

public class RollingWindow<T> : IReadOnlyWindow<T>, IEnumerable<T>, IEnumerable

Type Parameters

T

The type of data in the window

Inheritance
RollingWindow<T>
Implements
Inherited Members
Extension Methods

Constructors

RollingWindow(int)

Initializes a new instance of the RollwingWindow class with the specified window size.

public RollingWindow(int size)

Parameters

size int

The number of items to hold in the window

Properties

Count

Gets the current number of elements in this window

public int Count { get; }

Property Value

int

IsReady

Gets a value indicating whether or not this window is ready, i.e, it has been filled to its capacity

public bool IsReady { get; }

Property Value

bool

this[int]

Indexes into this window, where index 0 is the most recently entered value

public T this[int i] { get; set; }

Parameters

i int

the index, i

Property Value

T

the ith most recent entry

MostRecentlyRemoved

Gets the most recently removed item from the window. This is the piece of data that just 'fell off' as a result of the most recent add. If no items have been removed, this will throw an exception.

public T MostRecentlyRemoved { get; }

Property Value

T

Samples

Gets the number of samples that have been added to this window over its lifetime

public long Samples { get; }

Property Value

long

Size

Gets the size of this window

public int Size { get; }

Property Value

int

Methods

Add(T)

Adds an item to this window and shifts all other elements

public void Add(T item)

Parameters

item T

The item to be added

GetEnumerator()

Returns an enumerator that iterates through the collection.

public IEnumerator<T> GetEnumerator()

Returns

IEnumerator<T>

A IEnumerator<T> that can be used to iterate through the collection.

Reset()

Clears this window of all data

public void Reset()