当前位置: 首页>>代码示例>>C#>>正文


C# NodeModel.GetAstIdentifierForOutputIndex方法代码示例

本文整理汇总了C#中Dynamo.Models.NodeModel.GetAstIdentifierForOutputIndex方法的典型用法代码示例。如果您正苦于以下问题:C# NodeModel.GetAstIdentifierForOutputIndex方法的具体用法?C# NodeModel.GetAstIdentifierForOutputIndex怎么用?C# NodeModel.GetAstIdentifierForOutputIndex使用的例子?那么恭喜您, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在Dynamo.Models.NodeModel的用法示例。


在下文中一共展示了NodeModel.GetAstIdentifierForOutputIndex方法的6个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的C#代码示例。

示例1: AssertWatchContent

 /// <summary>
 /// Validates the watch content with the source nodes output.
 /// </summary>
 /// <param name="watch">WatchViewModel of the watch node</param>
 /// <param name="sourceNode">NodeModel for source to watch node</param>
 public void AssertWatchContent(WatchViewModel watch, NodeModel sourceNode)
 {
     string var = sourceNode.GetAstIdentifierForOutputIndex(0).Name;
     RuntimeMirror mirror = null;
     Assert.DoesNotThrow(() => mirror = ViewModel.Model.EngineController.GetMirror(var));
     Assert.IsNotNull(mirror);
     AssertWatchContent(watch, mirror.GetData());
 }
开发者ID:norbertzsiros,项目名称:Dynamo,代码行数:13,代码来源:WatchNodeTests.cs

示例2: BuildAstForPartialMultiOutput

        protected override void BuildAstForPartialMultiOutput(
            NodeModel model, AssociativeNode rhs, List<AssociativeNode> resultAst)
        {
            base.BuildAstForPartialMultiOutput(model, rhs, resultAst);

            var emptyList = AstFactory.BuildExprList(new List<AssociativeNode>());
            var previewIdInit = AstFactory.BuildAssignment(model.AstIdentifierForPreview, emptyList);

            resultAst.Add(previewIdInit);
            resultAst.AddRange(
                Definition.ReturnKeys.Select(
                    (rtnKey, idx) =>
                        AstFactory.BuildAssignment(
                            AstFactory.BuildIdentifier(
                                model.AstIdentifierForPreview.Name,
                                AstFactory.BuildStringNode(rtnKey)),
                            model.GetAstIdentifierForOutputIndex(idx))));
        }
开发者ID:khoaho,项目名称:Dynamo,代码行数:18,代码来源:CustomNodeController.cs

示例3: BuildAstForPartialMultiOutput

 /// <summary>
 ///     Produces AST for a partial function application of a multi-output function.
 /// </summary>
 /// <param name="model">NodeModel to produce AST for.</param>
 /// <param name="rhs">AST representing the partial application. This will need to be used to assign all output port identifiers.</param>
 /// <param name="resultAst">Result accumulator: add all new output AST to this list.</param>
 protected virtual void BuildAstForPartialMultiOutput(
     NodeModel model, AssociativeNode rhs, List<AssociativeNode> resultAst)
 {
     var missingAmt =
         Enumerable.Range(0, model.InPortData.Count).Count(x => !model.HasInput(x));
     var tmp =
         AstFactory.BuildIdentifier("__partial_" + model.GUID.ToString().Replace('-', '_'));
     resultAst.Add(AstFactory.BuildAssignment(tmp, rhs));
     resultAst.AddRange(
         (Definition.ReturnKeys ?? Enumerable.Empty<string>()).Select(
             AstFactory.BuildStringNode)
             .Select(
                 (rtnKey, index) =>
                     AstFactory.BuildAssignment(
                         model.GetAstIdentifierForOutputIndex(index),
                         AstFactory.BuildFunctionObject(
                             "__ComposeBuffered",
                             3,
                             new[] { 0, 1 },
                             new List<AssociativeNode>
                             {
                                 AstFactory.BuildExprList(
                                     new List<AssociativeNode>
                                     {
                                         AstFactory.BuildFunctionObject(
                                             "__GetOutput",
                                             2,
                                             new[] { 1 },
                                             new List<AssociativeNode>
                                             {
                                                 AstFactory.BuildNullNode(),
                                                 rtnKey
                                             }),
                                         tmp
                                     }),
                                 AstFactory.BuildIntNode(missingAmt),
                                 AstFactory.BuildNullNode()
                             }))));
 }
开发者ID:RobertiF,项目名称:Dynamo,代码行数:45,代码来源:FunctionCallNodeController.cs

示例4: AssignIdentifiersForFunctionCall

 protected override void AssignIdentifiersForFunctionCall(
     NodeModel model, AssociativeNode rhs, List<AssociativeNode> resultAst)
 {
     if (model.OutPortData.Count == 1)
     {
         resultAst.Add(AstFactory.BuildAssignment(model.AstIdentifierForPreview, rhs));
         resultAst.Add(
             AstFactory.BuildAssignment(
                 model.GetAstIdentifierForOutputIndex(0),
                 model.AstIdentifierForPreview));
     }
     else
         base.AssignIdentifiersForFunctionCall(model, rhs, resultAst);
 }
开发者ID:khoaho,项目名称:Dynamo,代码行数:14,代码来源:CustomNodeController.cs

示例5: AssignIdentifiersForFunctionCall

        /// <summary>
        ///     Produces AST that assigns all necessary Identifiers for the given NodeModel from
        ///     the produced function call AST.
        /// </summary>
        /// <param name="model">Model to produce AST for.</param>
        /// <param name="rhs">AST for the function call. This will need to be used to assign all output port identifiers.</param>
        /// <param name="resultAst">Result accumulator: add all new output AST to this list.</param>
        protected virtual void AssignIdentifiersForFunctionCall(NodeModel model, AssociativeNode rhs, List<AssociativeNode> resultAst)
        {
            resultAst.Add(AstFactory.BuildAssignment(model.AstIdentifierForPreview, rhs));

            var keys = Definition.ReturnKeys ?? Enumerable.Empty<string>();
            resultAst.AddRange(
                from item in keys.Zip(Enumerable.Range(0, keys.Count()), (key, idx) => new { key, idx })
                let outputIdentiferNode = model.GetAstIdentifierForOutputIndex(item.idx)
                let outputIdentifier = outputIdentiferNode.ToString()
                let getValueCall = AstFactory.BuildFunctionCall(
                    BuiltInMethods.GetMethodName(BuiltInMethods.MethodID.kTryGetValueFromNestedDictionaries),
                    new List<AssociativeNode> {model.AstIdentifierForPreview, AstFactory.BuildStringNode(item.key)})
                select
                AstFactory.BuildAssignment(outputIdentiferNode, getValueCall));
        }
开发者ID:RobertiF,项目名称:Dynamo,代码行数:22,代码来源:FunctionCallNodeController.cs

示例6: AssignIdentifiersForFunctionCall

 /// <summary>
 ///     Produces AST that assigns all necessary Identifiers for the given NodeModel from
 ///     the produced function call AST.
 /// </summary>
 /// <param name="model">Model to produce AST for.</param>
 /// <param name="rhs">AST for the function call. This will need to be used to assign all output port identifiers.</param>
 /// <param name="resultAst">Result accumulator: add all new output AST to this list.</param>
 protected virtual void AssignIdentifiersForFunctionCall(NodeModel model, AssociativeNode rhs, List<AssociativeNode> resultAst)
 {
     resultAst.Add(AstFactory.BuildAssignment(model.AstIdentifierForPreview, rhs));
     resultAst.AddRange(
         (from item in
                 (Definition.ReturnKeys ?? Enumerable.Empty<string>()).Select(
                     (key, idx) => new { key, idx })
             let outputIdentiferNode = model.GetAstIdentifierForOutputIndex(item.idx)
             let outputIdentifier = outputIdentiferNode.ToString()
             let thisIdentifierNode =
             AstFactory.BuildIdentifier(
                 model.AstIdentifierForPreview.Name,
                 AstFactory.BuildStringNode(item.key))
             let thisIdentifier = thisIdentifierNode.ToString()
             where !string.Equals(outputIdentifier, thisIdentifier)
             select
             AstFactory.BuildAssignment(outputIdentiferNode, thisIdentifierNode)));
 }
开发者ID:khoaho,项目名称:Dynamo,代码行数:25,代码来源:FunctionCallNodeController.cs


注:本文中的Dynamo.Models.NodeModel.GetAstIdentifierForOutputIndex方法示例由纯净天空整理自Github/MSDocs等开源代码及文档管理平台,相关代码片段筛选自各路编程大神贡献的开源项目,源码版权归原作者所有,传播和使用请参考对应项目的License;未经允许,请勿转载。