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


C# TextualExplanation.WriteLine方法代码示例

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


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

示例1: CreateCallableParameters

 protected void CreateCallableParameters(TextualExplanation text, ICallable callable)
 {
     if (callable.FormalParameters.Count > 0)
     {
         if (callable.FormalParameters.Count == 1)
         {
             Parameter formalParameter = callable.FormalParameters[0] as Parameter;
             if(formalParameter != null)
             {
                 text.Write("( " + formalParameter.Name + " => " + formalParameter.Type.Default + " )");
             }
         }
         else
         {
             text.WriteLine("(");
             text.Indent(4, () =>
             {
                 bool first = true;
                 foreach (Parameter parameter in callable.FormalParameters)
                 {
                     if (!first)
                     {
                         text.WriteLine(",");
                     }
                     text.Write(parameter.Name + " => " + parameter.Type.Default);
                     first = false;
                 }
             });
             text.WriteLine();
             text.Write(")");
         }
     }
     else
     {
         text.Write("()");
     }
 }
开发者ID:GautierBerck,项目名称:ERTMSFormalSpecs,代码行数:37,代码来源:BaseEditorTextBox.cs

示例2: GetExplain

        /// <summary>
        ///     Builds the explanation of the element
        /// </summary>
        /// <param name="explanation"></param>
        /// <param name="explainSubElements">Precises if we need to explain the sub elements (if any)</param>
        public virtual void GetExplain(TextualExplanation explanation, bool explainSubElements)
        {
            explanation.Write("STATE ");
            explanation.WriteLine(Name);

            if (explainSubElements)
            {
                foreach (Rule rule in StateMachine.Rules)
                {
                    // ReSharper disable once ConditionIsAlwaysTrueOrFalse
                    rule.GetExplain(explanation, explainSubElements);
                    explanation.WriteLine();
                }
            }
        }
开发者ID:JamesOakey,项目名称:ERTMSFormalSpecs,代码行数:20,代码来源:State.cs

示例3: GetExplain

 /// <summary>
 ///     Builds the explanation of the element
 /// </summary>
 /// <param name="explanation"></param>
 /// <param name="explainSubElements">Precises if we need to explain the sub elements (if any)</param>
 public override void GetExplain(TextualExplanation explanation, bool explainSubElements = true)
 {
     Structure.GetExplain(explanation);
     explanation.Write("{");
     explanation.Indent(2, () => explanation.ExplainList(Associations, explainSubElements, ", ", element =>
     {
         explanation.WriteLine();
         element.Key.GetExplain(explanation);
         explanation.Write(" => ");
         element.Value.GetExplain(explanation);
     }));
     explanation.WriteLine();
     explanation.Write("}");
 }
开发者ID:nikiforovandrey,项目名称:ERTMSFormalSpecs,代码行数:19,代码来源:StructExpression.cs

示例4: GetExplain

 /// <summary>
 ///     Builds the explanation of the element
 /// </summary>
 /// <param name="explanation"></param>
 /// <param name="explainSubElements">Precises if we need to explain the sub elements (if any)</param>
 public override void GetExplain(TextualExplanation explanation, bool explainSubElements)
 {
     explanation.WriteLine(Changes.ToString());
 }
开发者ID:GautierBerck,项目名称:ERTMSFormalSpecs,代码行数:9,代码来源:VariableUpdate.cs

示例5: GetExplain

        /// <summary>
        ///     Builds the explanation of the element
        /// </summary>
        /// <param name="explanation"></param>
        /// <param name="explainSubElements">Precises if we need to explain the sub elements (if any)</param>
        public override void GetExplain(TextualExplanation explanation, bool explainSubElements)
        {
            base.GetExplain(explanation, explainSubElements);
            explanation.Write("RANGE ");
            explanation.Write(Name);
            explanation.Write(" FROM ");
            explanation.Write(MinValue);
            explanation.Write(" TO ");
            explanation.WriteLine(MaxValue);

            explanation.Indent(2, () =>
            {
                foreach (EnumValue enumValue in SpecialValues)
                {
                    enumValue.GetExplain(explanation, explainSubElements);
                }
            });
        }
开发者ID:JamesOakey,项目名称:ERTMSFormalSpecs,代码行数:23,代码来源:Range.cs

示例6: GetExplain

 /// <summary>
 ///     Builds the explanation of the element
 /// </summary>
 /// <param name="explanation"></param>
 /// <param name="explainSubElements">Precises if we need to explain the sub elements (if any)</param>
 public override void GetExplain(TextualExplanation explanation, bool explainSubElements)
 {
     base.GetExplain(explanation, explainSubElements);
     explanation.Write("COLLECTION ");
     explanation.Write(Name);
     explanation.Write(" OF ");
     explanation.WriteLine(getTypeName());
 }
开发者ID:JamesOakey,项目名称:ERTMSFormalSpecs,代码行数:13,代码来源:Collection.cs

示例7: GetExplain

        /// <summary>
        ///     Builds the explanation of the element
        /// </summary>
        /// <param name="explanation"></param>
        /// <param name="explainSubElements">Precises if we need to explain the sub elements (if any)</param>
        public override void GetExplain(TextualExplanation explanation, bool explainSubElements)
        {
            explanation.Comment(this);

            if (!IsAbstract)
            {
                explanation.Write("STRUCTURE ");
            }
            else
            {
                explanation.Write("INTERFACE ");
            }
            explanation.WriteLine(Name);

            explanation.Indent(2, () =>
            {
                foreach (Structure structure in Interfaces)
                {
                    if (structure != null)
                    {
                        explanation.Write("IMPLEMENTS ");
                        explanation.WriteLine(structure.Name);
                    }
                }

                foreach (StructureElement element in Elements)
                {
                    element.GetExplain(explanation, explainSubElements);
                }

                if (!IsAbstract)
                {
                    foreach (Procedure procedure in Procedures)
                    {
                        procedure.GetExplain(explanation, explainSubElements);
                    }

                    foreach (StateMachine stateMachine in StateMachines)
                    {
                        stateMachine.GetExplain(explanation, explainSubElements);
                    }

                    foreach (Rule rule in Rules)
                    {
                        rule.GetExplain(explanation, explainSubElements);
                    }
                }
            });

            if (!IsAbstract)
            {
                explanation.WriteLine("END STRUCTURE");
            }
            else
            {
                explanation.WriteLine("END INTERFACE");
            }
        }
开发者ID:JamesOakey,项目名称:ERTMSFormalSpecs,代码行数:63,代码来源:Structure.cs

示例8: GetExplain

        /// <summary>
        ///     Builds the explanation of the element
        /// </summary>
        /// <param name="explanation"></param>
        /// <param name="explainSubElements">Precises if we need to explain the sub elements (if any)</param>
        public override void GetExplain(TextualExplanation explanation, bool explainSubElements = true)
        {
            Called.GetExplain(explanation);
            explanation.Write("(");
            explanation.ExplainList(ActualParameters, explainSubElements, ", ",
                element => element.GetExplain(explanation));

            if (NamedActualParameters.Count > 0)
            {
                explanation.Indent(2, () =>
                {
                    if (ActualParameters.Count > 0)
                    {
                        explanation.Write(", ");
                    }
                    explanation.ExplainList(NamedActualParameters, explainSubElements, ", ", pair =>
                    {
                        if (AllParameters.Count > 1)
                        {
                            explanation.WriteLine();
                        }
                        pair.Key.GetExplain(explanation);
                        explanation.Write(" => ");
                        pair.Value.GetExplain(explanation);
                    });
                });
            }
            explanation.Write(")");
        }
开发者ID:JamesOakey,项目名称:ERTMSFormalSpecs,代码行数:34,代码来源:Call.cs

示例9: GetExplain

        /// <summary>
        ///     Builds the explanation of the element
        /// </summary>
        /// <param name="explanation"></param>
        /// <param name="explainSubElements">Precises if we need to explain the sub elements (if any)</param>
        public virtual void GetExplain(TextualExplanation explanation, bool explainSubElements)
        {
            explanation.Write("TRANSLATION ");
            explanation.WriteLine(Name);

            if (SourceTexts.Count > 0)
            {
                foreach (SourceText text in SourceTexts)
                {
                    text.GetExplain(explanation, explainSubElements);
                }
            }

            foreach (SubStep subStep in SubSteps)
            {
                subStep.GetExplain(explanation, explainSubElements);
            }

            explanation.WriteLine("END TRANSLATION ");
        }
开发者ID:ERTMSSolutions,项目名称:ERTMSFormalSpecs,代码行数:25,代码来源:Translation.cs

示例10: GetExplain

        /// <summary>
        ///     Builds the explanation of the element
        /// </summary>
        /// <param name="explanation"></param>
        /// <param name="explainSubElements">Precises if we need to explain the sub elements (if any)</param>
        public override void GetExplain(TextualExplanation explanation, bool explainSubElements)
        {
            base.GetExplain(explanation, explainSubElements);

            explanation.Write("ENUMERATION ");
            explanation.WriteLine(Name);

            explanation.Indent(2, () =>
            {
                foreach (EnumValue enumValue in Values)
                {
                    explanation.Write(enumValue, explainSubElements);
                }
            });
        }
开发者ID:GautierBerck,项目名称:ERTMSFormalSpecs,代码行数:20,代码来源:Enum.cs

示例11: GetExplain

        /// <summary>
        ///     Builds the explanation of the element
        /// </summary>
        /// <param name="explanation"></param>
        /// <param name="explainSubElements">Precises if we need to explain the sub elements (if any)</param>
        public virtual void GetExplain(TextualExplanation explanation, bool explainSubElements)
        {
            explanation.Comment(this);

            bool first = true;
            bool condition = false;
            foreach (RuleCondition ruleCondition in RuleConditions)
            {
                if (!first)
                {
                    explanation.WriteLine("ELSE");
                }
                ruleCondition.GetExplain(explanation, explainSubElements);
                first = false;
                condition = condition || ruleCondition.PreConditions.Count > 0;
            }

            if (condition)
            {
                explanation.WriteLine("END IF");
            }
        }
开发者ID:JamesOakey,项目名称:ERTMSFormalSpecs,代码行数:27,代码来源:Rule.cs

示例12: Editor_KeyPress

        private void Editor_KeyPress(object sender, KeyPressEventArgs e)
        {
            try
            {
                if (AutoComplete)
                {
                    switch (e.KeyChar)
                    {
                        case '.':
                            EditionTextBox.SelectedText = e.KeyChar.ToString(CultureInfo.InvariantCulture);
                            e.Handled = true;
                            DisplayComboBox();
                            break;

                        case '{':
                            Structure structure = GetInstance(EditionTextBox.SelectionStart-1) as Structure;
                            if (structure != null)
                            {
                                TextualExplanation text = new TextualExplanation();
                                text.WriteLine("{");
                                CreateDefaultStructureValue(text, structure, false);
                                EditionTextBox.SelectedText = text.Text;
                                EditionTextBox.ProcessAllLines(true);
                                e.Handled = true;
                            }
                            break;

                        case '(':
                            ICallable callable = GetInstance(EditionTextBox.SelectionStart-1) as ICallable;
                            if (callable != null)
                            {
                                TextualExplanation text = new TextualExplanation();
                                CreateCallableParameters(text, callable);
                                EditionTextBox.SelectedText = text.Text;
                                EditionTextBox.ProcessAllLines(true);
                                e.Handled = true;
                            }
                            break;

                        case '>':
                        case '-':
                            char prev = EditionTextBox.Text[EditionTextBox.SelectionStart - 1];
                            if ((prev == '<' && e.KeyChar == '-') || (prev == '=' && e.KeyChar == '>'))
                            {
                                ITypedElement typedElement =
                                    GetInstance(EditionTextBox.SelectionStart - 2) as ITypedElement;
                                if (typedElement != null)
                                {
                                    EditionTextBox.SelectedText = e.KeyChar + " " + typedElement.Type.FullName;
                                    e.Handled = true;
                                }
                            }
                            break;
                    }
                }
            }
            catch (Exception)
            {
            }
        }
开发者ID:GautierBerck,项目名称:ERTMSFormalSpecs,代码行数:60,代码来源:BaseEditorTextBox.cs

示例13: InsertElement

        protected void InsertElement(ITypedElement element, TextualExplanation text)
        {
            text.Write(element.Name);
            text.Write(" => ");
            Structure structure = element.Type as Structure;
            if (structure != null)
            {
                text.WriteLine(StripUseless(structure.FullName, WritingContext()) + "{");
                text.Indent(4, () =>
                {
                    bool first = true;
                    foreach (StructureElement subElement in structure.Elements)
                    {
                        if (!first)
                        {
                            text.WriteLine(",");
                        }
                        InsertElement(subElement, text);
                        first = false;
                    }
                });
                text.WriteLine();
                text.Write("}");
            }
            else
            {
                IValue value = null;
                if (string.IsNullOrEmpty(element.Default))
                {
                    // No default value for element, get the one of the type
                    if (element.Type != null && element.Type.DefaultValue != null)
                    {
                        value = element.Type.DefaultValue;
                    }
                }
                else
                {
                    if (element.Type != null)
                    {
                        value = element.Type.getValue(element.Default);
                    }
                }

                if (value != null)
                {
                    text.Write(StripUseless(value.FullName, WritingContext()));
                }
            }
        }
开发者ID:GautierBerck,项目名称:ERTMSFormalSpecs,代码行数:49,代码来源:BaseEditorTextBox.cs

示例14: CreateDefaultStructureValue

        protected void CreateDefaultStructureValue(TextualExplanation text, Structure structure,
            bool displayStructureName = true)
        {
            if (displayStructureName)
            {
                text.WriteLine(StripUseless(structure.FullName, WritingContext()) + "{");
            }

            bool first = true;
            foreach (StructureElement element in structure.Elements)
            {
                if (!first)
                {
                    text.WriteLine(",");
                }
                InsertElement(element, text);
                first = false;
            }
            text.WriteLine();
            text.Write("}");
        }
开发者ID:GautierBerck,项目名称:ERTMSFormalSpecs,代码行数:21,代码来源:BaseEditorTextBox.cs

示例15: GetExplain

 /// <summary>
 ///     Builds the explanation of the element
 /// </summary>
 /// <param name="explanation"></param>
 /// <param name="explainSubElements">Precises if we need to explain the sub elements (if any)</param>
 public override void GetExplain(TextualExplanation explanation, bool explainSubElements)
 {
     base.GetExplain(explanation, explainSubElements);
     explanation.Write("STATE MACHINE ");
     explanation.WriteLine(Name);
     explanation.Indent(2, () =>
     {
         foreach (State state in States)
         {
             state.GetExplain(explanation, false);
         }
         foreach (Rule rule in Rules)
         {
             rule.GetExplain(explanation, explainSubElements);
         }
     });
 }
开发者ID:nikiforovandrey,项目名称:ERTMSFormalSpecs,代码行数:22,代码来源:StateMachine.cs


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