Esempio n. 1
0
        /// <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);

            if (!string.IsNullOrEmpty(getCondition()))
            {
                explanation.Write("IF ");
                if (ConditionTree != null)
                {
                    ConditionTree.GetExplain(explanation);
                }
                else
                {
                    explanation.Write(getCondition());
                }
                explanation.WriteLine(" THEN");
                explanation.Indent(2, () => explanation.Expression(this));
                explanation.WriteLine("END IF");
            }
            else
            {
                explanation.Expression(this);
                explanation.WriteLine();
            }
        }
Esempio n. 2
0
        /// <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)
        {
            if (PreConditions.Count > 0)
            {
                explanation.Write("IF ");
                if (PreConditions.Count > 1)
                {
                    // Prepare the space for the following ANDs
                    explanation.Write("   ");
                }

                bool first = true;
                foreach (PreCondition preCondition in PreConditions)
                {
                    if (!first)
                    {
                        explanation.WriteLine();
                        explanation.Write("   AND ");
                    }

                    preCondition.GetExplain(explanation, explainSubElements);
                    first = false;
                }
                explanation.WriteLine(" THEN");

                explanation.Indent(2, () =>
                {
                    explanation.Header(this);
                    explanation.Expression(this);
                });
            }
            else
            {
                explanation.WriteLine();
                explanation.Indent(2, () =>
                {
                    explanation.Header(this);
                    explanation.Expression(this);
                });
            }
        }
Esempio n. 3
0
 /// <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);
     explanation.Expression(this);
 }
Esempio n. 4
0
        /// <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);

            if (!string.IsNullOrEmpty(getCondition()))
            {
                explanation.Write("IF ");
                if (ConditionTree != null)
                {
                    ConditionTree.GetExplain(explanation);
                }
                else
                {
                    explanation.Write(getCondition());
                }
                explanation.WriteLine(" THEN");
                explanation.Indent(2, () => explanation.Expression(this));
                explanation.WriteLine("END IF");

            }
            else
            {
                explanation.Expression(this);
                explanation.WriteLine();
            }
        }
Esempio n. 5
0
        /// <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)
        {
            if (PreConditions.Count > 0)
            {
                explanation.Write("IF ");
                if (PreConditions.Count > 1)
                {
                    // Prepare the space for the following ANDs
                    explanation.Write("   ");
                }

                bool first = true;
                foreach (PreCondition preCondition in PreConditions)
                {
                    if (!first)
                    {
                        explanation.WriteLine();
                        explanation.Write("   AND ");
                    }

                    preCondition.GetExplain(explanation, explainSubElements);
                    first = false;
                }
                explanation.WriteLine(" THEN");

                explanation.Indent(2, () =>
                {
                    explanation.Header(this);
                    explanation.Expression(this);
                });
            }
            else
            {
                explanation.WriteLine();
                explanation.Indent(2, () =>
                {
                    explanation.Header(this);
                    explanation.Expression(this);
                });
            }
        }
Esempio n. 6
0
 /// <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);
     explanation.Expression(this);
 }