Show / Hide Table of Contents

Class NodeHistory<T>

A class that implements a history using a linked list.

Inheritance
object
NodeHistory<T>
Implements
IHistory<T>
IEnumerable<T>
IEnumerable
Inherited Members
object.Equals(object)
object.Equals(object, object)
object.GetHashCode()
object.GetType()
object.MemberwiseClone()
object.ReferenceEquals(object, object)
object.ToString()
Namespace: SpiceSharp.Simulations.Histories
Assembly: SpiceSharp.dll
Syntax
public class NodeHistory<T> : IHistory<T>, IEnumerable<T>, IEnumerable
Type Parameters
Name Description
T

The base value type.

Constructors

NodeHistory(int)

Initializes a new instance of the NodeHistory<T> class.

Declaration
public NodeHistory(int length)
Parameters
Type Name Description
int length

The number of points to store.

NodeHistory(int, Func<int, T>)

Initializes a new instance of the NodeHistory<T> class.

Declaration
public NodeHistory(int length, Func<int, T> generator)
Parameters
Type Name Description
int length

The number of points to store.

Func<int, T> generator

The function that generates the initial values.

NodeHistory(int, T)

Initializes a new instance of the NodeHistory<T> class.

Declaration
public NodeHistory(int length, T defaultValue)
Parameters
Type Name Description
int length

The number of points to store.

T defaultValue

The default value.

Properties

Length

Gets the number of points tracked by the history.

Declaration
public int Length { get; }
Property Value
Type Description
int

The length.

Value

Gets or sets the current value.

Declaration
public T Value { get; set; }
Property Value
Type Description
T

Methods

Accept()

Accepts the current point and moves on to the next.

Declaration
public void Accept()

GetEnumerator()

Returns an enumerator that iterates through the collection.

Declaration
public IEnumerator<T> GetEnumerator()
Returns
Type Description
IEnumerator<T>

An enumerator that can be used to iterate through the collection.

GetPreviousValue(int)

Gets the previous value. An index of 0 means the current value.

Declaration
public T GetPreviousValue(int index)
Parameters
Type Name Description
int index

The number of points to go back.

Returns
Type Description
T

The previous value.

Exceptions
Type Condition
ArgumentOutOfRangeException

Thrown if the index is out of range.

Set(Func<int, T>)

Sets all values in the history to the value returned by the specified method.

Declaration
public void Set(Func<int, T> method)
Parameters
Type Name Description
Func<int, T> method

The method for creating the value. The index indicates the current point.

Set(T)

Sets all values in the history to the same value.

Declaration
public void Set(T value)
Parameters
Type Name Description
T value

The value.

Implements

IHistory<T>
IEnumerable<T>
IEnumerable

Extension Methods

Utility.ThrowIfNull<T>(T, string)
Utility.ThrowIfEmpty<T>(IEnumerable<T>, string)

See Also

IHistory<T>
In this article
Back to top Generated by DocFX