Class VariableFactory
A factory for variables that will shield them from outside.
Implements
Inherited Members
Namespace: SpiceSharp.Components.Subcircuits
Assembly: SpiceSharp.dll
Syntax
public class VariableFactory : IVariableFactory<IVariable>
Constructors
VariableFactory(string, IVariableFactory<IVariable>, IEnumerable<Bridge<string>>, IEqualityComparer<string>)
Initializes a new instance of the VariableFactory class.
Declaration
public VariableFactory(string name, IVariableFactory<IVariable> parent, IEnumerable<Bridge<string>> nodes, IEqualityComparer<string> comparer)
Parameters
Type | Name | Description |
---|---|---|
string | name | The subcircuit instance name. |
IVariableFactory<IVariable> | parent | The parent. |
IEnumerable<Bridge<string>> | nodes | The nodes. |
IEqualityComparer<string> | comparer | The equality comparer for nodes. |
Exceptions
Type | Condition |
---|---|
ArgumentNullException | Thrown if |
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 |