Class Pin
Represents a pin containing a value on a INode
Implements
Namespace: Artemis.Core
Assembly: Artemis.Core.dll
Syntax
public abstract class Pin : CorePropertyChanged, IPin
Constructors
Pin(INode, string)
Creates a new instance of the Pin class on the provided node with the provided name
Declaration
protected Pin(INode node, string name = "")
Parameters
Type | Name | Description |
---|---|---|
INode | node | The node the pin belongs to |
string | name | The name of the pin |
Properties
ConnectedTo
Gets a read only list of pins this pin is connected to
Declaration
public IReadOnlyList<IPin> ConnectedTo { get; }
Property Value
Type | Description |
---|---|
IReadOnlyList<IPin> |
Direction
Gets the direction of the pin
Declaration
public abstract PinDirection Direction { get; }
Property Value
Type | Description |
---|---|
PinDirection |
IsEvaluated
Gets or sets a boolean indicating whether this pin is evaluated or not
Declaration
public bool IsEvaluated { get; set; }
Property Value
Type | Description |
---|---|
bool |
IsNumeric
Gets a boolean indicating whether the type of this pin is numeric.
Declaration
public bool IsNumeric { get; protected set; }
Property Value
Type | Description |
---|---|
bool |
Name
Gets or sets the name of the pin
Declaration
public string Name { get; set; }
Property Value
Type | Description |
---|---|
string |
Node
Gets the node the pin belongs to
Declaration
public INode Node { get; }
Property Value
Type | Description |
---|---|
INode |
PinValue
Gets the value the pin holds
Declaration
public abstract object? PinValue { get; }
Property Value
Type | Description |
---|---|
object |
Type
Gets the type of value the pin holds
Declaration
public abstract Type Type { get; }
Property Value
Type | Description |
---|---|
Type |
Methods
ChangeType(Type, ref Type)
Changes the type of this pin, disconnecting any pins that are incompatible with the new type.
Declaration
protected void ChangeType(Type type, ref Type currentType)
Parameters
Type | Name | Description |
---|---|---|
Type | type | The new type of the pin. |
Type | currentType | The backing field of the current type of the pin. |
ConnectTo(IPin)
Connects the pin to the provided pin
Declaration
public void ConnectTo(IPin pin)
Parameters
Type | Name | Description |
---|---|---|
IPin | pin | The pin to connect this pin to |
DisconnectAll()
Disconnects all pins this pin is connected to
Declaration
public void DisconnectAll()
DisconnectFrom(IPin)
Disconnects the pin to the provided pin
Declaration
public void DisconnectFrom(IPin pin)
Parameters
Type | Name | Description |
---|---|---|
IPin | pin | The pin to disconnect this pin to |
IsTypeCompatible(Type, bool)
Determines whether this pin is compatible with the given type
Declaration
public bool IsTypeCompatible(Type type, bool forgivingEnumMatching = true)
Parameters
Type | Name | Description |
---|---|---|
Type | type | The type to check for compatibility |
bool | forgivingEnumMatching | A boolean indicating whether or not enums should be exactly equal or just both be enums |
Returns
Type | Description |
---|---|
bool |
Reset()
Resets the pin, causing it to re-evaluate the next time its value is requested
Declaration
public void Reset()
Events
PinConnected
Occurs when the pin connects to another pin
Declaration
public event EventHandler<SingleValueEventArgs<IPin>>? PinConnected
Event Type
Type | Description |
---|---|
EventHandler<SingleValueEventArgs<IPin>> |
PinDisconnected
Occurs when the pin disconnects from another pin
Declaration
public event EventHandler<SingleValueEventArgs<IPin>>? PinDisconnected
Event Type
Type | Description |
---|---|
EventHandler<SingleValueEventArgs<IPin>> |