C# Class Dynamo.Graph.Nodes.CodeBlockNodeModel

Inheritance: NodeModel
Afficher le fichier Open project: DynamoDS/Dynamo Class Usage Examples

Private Properties

Свойство Type Description
BuildAst IEnumerable
CreateInputOutputPorts void
GetAstIdentifierForOutputIndexInternal ProtoCore.AST.AssociativeAST.IdentifierNode
GetDefinedVariableNames List
GetInportIndex int
GetOutportIndex int
GetStatementForOutput Statement
LoadAndCreateConnectors void
LocalizeIdentifier string
ProcessCode void
ProcessCodeDirect void
ProcessError void
SaveAndDeleteConnectors void
SetInputPorts void
SetOutputPorts void
SetPreviewVariable void
ShouldBeRenamed bool

Méthodes publiques

Méthode Description
CodeBlockNodeModel ( LibraryServices libraryServices ) : System

Initilizes a new instance of the CodeBlockNodeModel class

CodeBlockNodeModel ( string userCode, System.Guid guid, double xPos, double yPos, LibraryServices libraryServices, ProtoCore.Namespace.ElementResolver resolver ) : System

Initilizes a new instance of the CodeBlockNodeModel class

CodeBlockNodeModel ( string code, double x, double y, LibraryServices libraryServices, ProtoCore.Namespace.ElementResolver resolver ) : System

Initilizes a new instance of the CodeBlockNodeModel class

GetAstIdentifierForOutputIndex ( int outputIndex ) : ProtoCore.AST.AssociativeAST.IdentifierNode

Fetches the ProtoAST Identifier for a given output index.

GetRawAstIdentifierForOutputIndex ( int portIndex ) : ProtoCore.AST.AssociativeAST.IdentifierNode

Fetches the raw ProtoAST Identifier for a given index.

GetTypeHintForOutput ( int index ) : ProtoCore.Type

Returns possible type of the output at specified output port.

SetCodeContent ( string newCode, ProtoCore.Namespace.ElementResolver workspaceElementResolver ) : void

Sets string content of CodeBlock node.

Méthodes protégées

Méthode Description
DeserializeCore ( XmlElement nodeElement, SaveContext context ) : void
SerializeCore ( XmlElement element, SaveContext context ) : void
SetNodeStateBasedOnConnectionAndDefaults ( ) : void

If a CBN is in Error state, it will have no code but will have output ports from the last successful compilation if any. In this case it should continue to be in Error state.

UpdateValueCore ( UpdateValueParams updateValueParams ) : bool

Private Methods

Méthode Description
BuildAst ( List inputAstNodes, CompilationContext context ) : IEnumerable
CreateInputOutputPorts ( ) : void

Creates the inport and outport data based on the statements generated from the user code.

GetAstIdentifierForOutputIndexInternal ( int portIndex, bool forRawName ) : ProtoCore.AST.AssociativeAST.IdentifierNode

For code block nodes, each output identifier of an output port is mapped. For an example, "p = 1" would have its internal identifier renamed to "pXXXX", where "XXXX" is the GUID of the code block node. This mapping is done to ensure the uniqueness of the output variable name.

GetDefinedVariableNames ( ) : List

Returns the names of all the variables defined in this code block.

GetInportIndex ( CodeBlockNodeModel cbn, string variableName ) : int

Returns the index of the port corresponding to the variable name given

GetOutportIndex ( string variableName ) : int

Returns the corresponding output port index for a given defined variable

GetStatementForOutput ( int portIndex ) : Statement
LoadAndCreateConnectors ( OrderedDictionary inportConnections, OrderedDictionary outportConnections ) : void

Now that the portData has been set for the new ports, we recreate the connections we so mercilessly destroyed, restoring peace and balance to the world once again.

LocalizeIdentifier ( string identifierName ) : string
ProcessCode ( string &errorMessage, string &warningMessage, ProtoCore.Namespace.ElementResolver workspaceElementResolver = null ) : void
ProcessCodeDirect ( ) : void
ProcessError ( ) : void

It removes all the in ports and out ports so that the user knows there is an error.

SaveAndDeleteConnectors ( IDictionary inportConnections, IDictionary outportConnections ) : void

Deletes all the connections and saves their data (the start and end port) so that they can be recreated if needed.

SetInputPorts ( ) : void
SetOutputPorts ( ) : void
SetPreviewVariable ( IEnumerable parsedNodes ) : void
ShouldBeRenamed ( string ident ) : bool

Method Details

CodeBlockNodeModel() public méthode

Initilizes a new instance of the CodeBlockNodeModel class
public CodeBlockNodeModel ( LibraryServices libraryServices ) : System
libraryServices LibraryServices object to manage /// builtin libraries as well as imported libraries
Résultat System

CodeBlockNodeModel() public méthode

Initilizes a new instance of the CodeBlockNodeModel class
public CodeBlockNodeModel ( string userCode, System.Guid guid, double xPos, double yPos, LibraryServices libraryServices, ProtoCore.Namespace.ElementResolver resolver ) : System
userCode string Code block content
guid System.Guid Identifier of the code block
xPos double X coordinate of the code block
yPos double Y coordinate of the code block
libraryServices LibraryServices object to manage /// builtin libraries as well as imported libraries
resolver ProtoCore.Namespace.ElementResolver Responsible for resolving /// a partial class name to its fully resolved name
Résultat System

CodeBlockNodeModel() public méthode

Initilizes a new instance of the CodeBlockNodeModel class
public CodeBlockNodeModel ( string code, double x, double y, LibraryServices libraryServices, ProtoCore.Namespace.ElementResolver resolver ) : System
code string Code block content
x double X coordinate of the code block
y double Y coordinate of the code block
libraryServices LibraryServices object to manage /// builtin libraries as well as imported libraries
resolver ProtoCore.Namespace.ElementResolver Responsible for resolving /// a partial class name to its fully resolved name
Résultat System

DeserializeCore() protected méthode

protected DeserializeCore ( XmlElement nodeElement, SaveContext context ) : void
nodeElement System.Xml.XmlElement
context SaveContext
Résultat void

GetAstIdentifierForOutputIndex() public méthode

Fetches the ProtoAST Identifier for a given output index.
public GetAstIdentifierForOutputIndex ( int outputIndex ) : ProtoCore.AST.AssociativeAST.IdentifierNode
outputIndex int Index of the output port.
Résultat ProtoCore.AST.AssociativeAST.IdentifierNode

GetRawAstIdentifierForOutputIndex() public méthode

Fetches the raw ProtoAST Identifier for a given index.
public GetRawAstIdentifierForOutputIndex ( int portIndex ) : ProtoCore.AST.AssociativeAST.IdentifierNode
portIndex int Index of the port.
Résultat ProtoCore.AST.AssociativeAST.IdentifierNode

GetTypeHintForOutput() public méthode

Returns possible type of the output at specified output port.
public GetTypeHintForOutput ( int index ) : ProtoCore.Type
index int Index of the port
Résultat ProtoCore.Type

SerializeCore() protected méthode

protected SerializeCore ( XmlElement element, SaveContext context ) : void
element System.Xml.XmlElement
context SaveContext
Résultat void

SetCodeContent() public méthode

Sets string content of CodeBlock node.
public SetCodeContent ( string newCode, ProtoCore.Namespace.ElementResolver workspaceElementResolver ) : void
newCode string New content of the code block
workspaceElementResolver ProtoCore.Namespace.ElementResolver object
Résultat void

SetNodeStateBasedOnConnectionAndDefaults() protected méthode

If a CBN is in Error state, it will have no code but will have output ports from the last successful compilation if any. In this case it should continue to be in Error state.
protected SetNodeStateBasedOnConnectionAndDefaults ( ) : void
Résultat void

UpdateValueCore() protected méthode

protected UpdateValueCore ( UpdateValueParams updateValueParams ) : bool
updateValueParams UpdateValueParams
Résultat bool