Class VariableFactory
A simple variable factory where the variables don't have any extra functionality.
Implements
Inherited Members
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 |