/// <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(); } }
/// <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) { explanation.Write(element, explainSubElements); } if (!IsAbstract) { foreach (Procedure procedure in Procedures) { explanation.Write(procedure, explainSubElements); } foreach (StateMachine stateMachine in StateMachines) { explanation.Write(stateMachine, explainSubElements); } foreach (Rule rule in Rules) { explanation.Write(rule, explainSubElements); } } }); if (!IsAbstract) { explanation.WriteLine("END STRUCTURE"); } else { explanation.WriteLine("END INTERFACE"); } }
/// <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) { int indent = 0; if (PreConditions.Count > 0) { indent = 2; 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(); explanation.WriteLine("THEN"); } else { explanation.WriteLine(); } explanation.Indent(indent, () => { if (Name.CompareTo(EnclosingRule.Name) != 0) { explanation.Comment(Name); } foreach (Action action in Actions) { explanation.Write(); action.GetExplain(explanation, explainSubElements); explanation.WriteLine(); } if (explainSubElements) { foreach (Rule subRule in SubRules) { subRule.GetExplain(explanation, explainSubElements); } } }); }
/// <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.Indent(2, () => { foreach (Step step in Steps) { step.GetExplain(explanation, explainSubElements); explanation.WriteLine(); } }); }
/// <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.Write(Name); if (!String.IsNullOrEmpty(getValue())) { explanation.WriteLine(" : " + getValue()); } else { explanation.WriteLine(); } }
/// <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 (string.IsNullOrEmpty(Comment)) { if (Type != null) { explanation.Comment(Type); } } else { explanation.Comment(this); } explanation.Write(Name); explanation.Write(" : "); explanation.Write(TypeName); if (Value != null) { explanation.Write(" = "); explanation.Write(Value.LiteralName); } explanation.WriteLine(); }
/// <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); string typeName = TypeName; if (Type != null) { typeName = Type.FullName; } explanation.Write("FIELD "); explanation.Write(Name); explanation.Write(" : "); explanation.WriteLine(typeName); }
/// <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.Write("PROCEDURE "); explanation.Write(Name); if (FormalParameters.Count > 0) { bool first = true; explanation.Write("("); if (FormalParameters.Count > 1) { explanation.WriteLine(); } explanation.Indent(4, () => { foreach (Parameter parameter in FormalParameters) { if (!first) { explanation.WriteLine(","); } explanation.Write(parameter.Name); explanation.Write(" : "); explanation.Write(parameter.TypeName); first = false; } }); explanation.WriteLine(")"); } else { explanation.WriteLine("()"); } explanation.Indent(2, () => { foreach (Rule rule in Rules) { rule.GetExplain(explanation, explainSubElements); explanation.WriteLine(); } }); explanation.WriteLine("END PROCEDURE "); }
/// <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"); } }
/// <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(Name); explanation.Indent(2, () => { foreach (Action action in Actions) { action.GetExplain(explanation, explainSubElements); explanation.WriteLine(); } }); explanation.WriteLine("IMPLIES"); explanation.Indent(2, () => { foreach (Expectation expectation in Expectations) { expectation.GetExplain(explanation, explainSubElements); explanation.WriteLine(); } }); }
/// <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); explanation.Write("FUNCTION "); explanation.Write(Name); explanation.Write(" ("); if (FormalParameters.Count > 0) { explanation.Indent(2, () => { bool first = true; foreach (Parameter parameter in FormalParameters) { if (first) { explanation.WriteLine(); first = false; } else { explanation.WriteLine(","); } parameter.GetExplain(explanation, true); } }); } explanation.WriteLine(")"); explanation.Write("RETURNS "); explanation.WriteLine(TypeName); { bool first = true; foreach (Case cas in Cases) { if (!first) { explanation.Write("ELSE "); } cas.GetExplain(explanation, explainSubElements); explanation.WriteLine(); first = false; } } explanation.Write("END FUNCTION"); }
/// <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); }
/// <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"); } }
/// <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.Write("NAMESPACE "); explanation.WriteLine(Name); }
/// <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); }