Show / Hide Table of Contents

Class VariableFactory

A simple variable factory where the variables don't have any extra functionality.

Inheritance
object
VariableDictionary<IVariable>
VariableFactory
Implements
IVariableDictionary<IVariable>
IReadOnlyDictionary<string, IVariable>
IReadOnlyCollection<KeyValuePair<string, IVariable>>
IEnumerable<KeyValuePair<string, IVariable>>
IEnumerable
IVariableFactory<IVariable>
Inherited Members
VariableDictionary<IVariable>.Comparer
VariableDictionary<IVariable>.Count
VariableDictionary<IVariable>.Keys
VariableDictionary<IVariable>.Values
VariableDictionary<IVariable>.this[string]
VariableDictionary<IVariable>.Add(string, IVariable)
VariableDictionary<IVariable>.ContainsKey(string)
VariableDictionary<IVariable>.TryGetValue(string, out IVariable)
VariableDictionary<IVariable>.GetEnumerator()
object.Equals(object)
object.Equals(object, object)
object.GetHashCode()
object.GetType()
object.MemberwiseClone()
object.ReferenceEquals(object, object)
object.ToString()
Namespace: SpiceSharp.Simulations.Variables
Assembly: SpiceSharp.dll
Syntax
public class VariableFactory : VariableDictionary<IVariable>, IVariableDictionary<IVariable>, IReadOnlyDictionary<string, IVariable>, IReadOnlyCollection<KeyValuePair<string, IVariable>>, IEnumerable<KeyValuePair<string, IVariable>>, IEnumerable, IVariableFactory<IVariable>

Constructors

VariableFactory(IEqualityComparer<string>)

Initializes a new instance of the VariableFactory class.

Declaration
public VariableFactory(IEqualityComparer<string> comparer = null)
Parameters
Type Name Description
IEqualityComparer<string> comparer

The comparer.

Methods

CreatePrivateVariable(string, IUnit)

Creates a variable that is private to whoever requested it. The factory will not shared this variable with anyone else, and the name is only used for display purposes.

Declaration
public IVariable CreatePrivateVariable(string name, IUnit unit)
Parameters
Type Name Description
string name

The name of the private variable.

IUnit unit

The unit of the variable.

Returns
Type Description
IVariable

The private variable.

GetSharedVariable(string)

Gets a variable that can be shared with other behaviors by the factory. If another variable already exists with the same name, that is returned instead.

Declaration
public IVariable GetSharedVariable(string name)
Parameters
Type Name Description
string name

The name of the shared variable.

Returns
Type Description
IVariable

The shared variable.

Exceptions
Type Condition
ArgumentNullException

Thrown if name is null.

Implements

IVariableDictionary<V>
IReadOnlyDictionary<TKey, TValue>
IReadOnlyCollection<T>
IEnumerable<T>
IEnumerable
IVariableFactory<V>

Extension Methods

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

See Also

VariableDictionary<V>
IVariableFactory<V>
IVariable
In this article
Back to top Generated by DocFX