/// <summary> /// Converts the given da-GD into a durative expression. /// </summary> /// <param name="daGdAstNode">AST node.</param> /// <returns>Converted durative expression.</returns> public static DurativeExpression ToDurativeExpression(DaGdAstNode daGdAstNode) { ToDurativeExpressionConverter converter = new ToDurativeExpressionConverter(); converter.Evaluate(daGdAstNode); return(converter.ExpressionData); }
/// <summary> /// Convert the given da-GD into durative conditions. A root AND-expression is split into a list of condition expressions. /// </summary> /// <param name="daGdAstNode">AST node.</param> /// <returns>Converted durative conditions.</returns> public static DurativeConditions ToDurativeConditions(DaGdAstNode daGdAstNode) { DurativeConditions conditions = new DurativeConditions(); DurativeExpression expression = ToDurativeExpression(daGdAstNode); var andExpression = expression as AndDurativeExpression; if (andExpression != null) { conditions.AddRange(andExpression.Arguments); } else if (expression != null) { conditions.Add(expression); } return(conditions); }
/// <summary> /// Initialization of the AST node. Specifies conversion from parse-tree node to AST node. /// </summary> /// <param name="treeNode">Parse-tree node.</param> public override void Init(ParseTreeNode treeNode) { Parameters = treeNode.GetChildAst <TypedListAstNode>(1); Expression = treeNode.GetChildAst <DaGdAstNode>(2); }
/// <summary> /// Initialization of the AST node. Specifies conversion from parse-tree node to AST node. /// </summary> /// <param name="treeNode">Parse-tree node.</param> public override void Init(ParseTreeNode treeNode) { Name = treeNode.GetChildString(1); Argument = treeNode.GetChildAst <DaGdAstNode>(2); }