Class ArrayHistory<T>
A class that implements a history with an array.
Inherited Members
Namespace: SpiceSharp.Simulations.Histories
Assembly: SpiceSharp.dll
Syntax
public class ArrayHistory<T> : IHistory<T>, IEnumerable<T>, IEnumerable
  Type Parameters
| Name | Description | 
|---|---|
| T | The base value type.  | 
      
Constructors
ArrayHistory(int)
Initializes a new instance of the ArrayHistory<T> class.
Declaration
public ArrayHistory(int length)
  Parameters
| Type | Name | Description | 
|---|---|---|
| int | length | The number of points to store.  | 
      
ArrayHistory(int, Func<int, T>)
Initializes a new instance of the ArrayHistory<T> class.
Declaration
public ArrayHistory(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.  | 
      
ArrayHistory(int, T)
Initializes a new instance of the ArrayHistory<T> class.
Declaration
public ArrayHistory(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()
Cycles through history.
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   | 
      
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.  |