Ejemplo n.º 1
0
        /// <summary>
        /// Converts the given GD into preconditions. A root AND-expression is split into a list of precondition expressions.
        /// </summary>
        /// <param name="gdAstNode">AST node.</param>
        /// <returns>Converted preconditions.</returns>
        public static Preconditions ToPreconditions(GdAstNode gdAstNode)
        {
            Preconditions preconditions = new Preconditions();

            Expression expression = ToExpression(gdAstNode);

            var andExpression = expression as AndExpression;

            if (andExpression != null)
            {
                preconditions.AddRange(andExpression.Arguments);
            }
            else if (expression != null)
            {
                preconditions.Add(expression);
            }

            return(preconditions);
        }