// Path: src/main/java/com/evolvedbinary/xpath/parser/ast/ASTNode.java
// public interface ASTNode {
// }
// 
// Path: src/main/java/com/evolvedbinary/xpath/parser/ast/Expr.java
// public class Expr extends AbstractASTNode {
//     private final List<? extends ASTNode> exprSingles;
// 
//     public Expr(final List<? extends ASTNode> exprSingles) {
//         this.exprSingles = exprSingles;
//     }
// 
//     public Expr(final ASTNode... exprSingles) {
//         this.exprSingles = Arrays.asList(exprSingles);
//     }
// 
//     @Override
//     protected String describe() {
//         final StringBuilder builder = new StringBuilder();
//         for(final ASTNode exprSingle : exprSingles) {
//             if(builder.length() > 0) {
//                 builder.append(", ");
//             }
//             builder.append(exprSingle.toString());
//         }
// 
//         return "Expr(" + builder.toString() + ")";
//     }
// 
//     @Override
//     public boolean equals(final Object obj) {
//         if(obj != null && obj instanceof Expr) {
//             return ((Expr)obj).exprSingles.equals(exprSingles);
//         }
// 
//         return false;
//     }
// 
//     public List<? extends ASTNode> getExprSingles() {
//         return exprSingles;
//     }
// }
// 
// Path: src/main/java/com/evolvedbinary/xpath/parser/ast/IfExpr.java
// public class IfExpr extends AbstractASTNode implements ExprSingle {
//     private final Expr testExpression;
//     private final ASTNode thenExpression; //TODO(AR) ideally should be ExprSingle... but as we simplify the AST, so we have to use ASTNode
//     private final ASTNode elseExpression; //TODO(AR) ideally should be ExprSingle... but as we simplify the AST, so we have to use ASTNode
// 
//     public IfExpr(final Expr testExpression, final ASTNode thenExpression, final ASTNode elseExpression) {
//         this.testExpression = testExpression;
//         this.thenExpression = thenExpression;
//         this.elseExpression = elseExpression;
//     }
// 
//     @Override
//     protected String describe() {
//         return "IfExpr(" + testExpression + " then " + thenExpression + " else " + elseExpression + ")";
//     }
// 
//     @Override
//     public boolean equals(final Object obj) {
//         if(obj != null && obj instanceof IfExpr) {
//             final IfExpr other = (IfExpr)obj;
//             return other.testExpression.equals(testExpression)
//                     && other.thenExpression.equals(thenExpression)
//                     && other.elseExpression.equals(elseExpression);
//         }
// 
//         return false;
//     }
// }


import com.evolvedbinary.xpath.parser.ast.ASTNode;
import com.evolvedbinary.xpath.parser.ast.Expr;
import com.evolvedbinary.xpath.parser.ast.IfExpr;
/**
 * XPath 2 Parser
 * A Parser for XPath 2
 * Copyright (C) 2016 Evolved Binary Ltd.
 *
 * This program is free software; you can redistribute it and/or modify
 * it under the terms of the GNU General Public License as published by
 * the Free Software Foundation; either version 2 of the License, or
 * (at your option) any later version.
 *
 * This program is distributed in the hope that it will be useful,
 * but WITHOUT ANY WARRANTY; without even the implied warranty of
 * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
 * GNU General Public License for more details.
 *
 * You should have received a copy of the GNU General Public License along
 * with this program; if not, write to the Free Software Foundation, Inc.,
 * 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA.
 */
package com.evolvedbinary.xpath.parser.ast.partial;


/**
 * Created by aretter on 15/02/2016.
 */
public class PartialIfExpr extends AbstractPartialASTNode<PartialIfExpr.PartialIfExpr1, ASTNode> {
    private final Expr testExpression;

    public PartialIfExpr(final Expr testExpression) {
        this.testExpression = testExpression;
    }

    @Override
    protected String describe() {
        return "IfExpr(" + testExpression + " then ? else ?)";
    }

    @Override
    public PartialIfExpr.PartialIfExpr1 complete(final ASTNode thenExpression) {
        return new PartialIfExpr1(thenExpression);
    }

// Path: src/main/java/com/evolvedbinary/xpath/parser/ast/ASTNode.java
// public interface ASTNode {
// }
// 
// Path: src/main/java/com/evolvedbinary/xpath/parser/ast/Expr.java
// public class Expr extends AbstractASTNode {
//     private final List<? extends ASTNode> exprSingles;
// 
//     public Expr(final List<? extends ASTNode> exprSingles) {
//         this.exprSingles = exprSingles;
//     }
// 
//     public Expr(final ASTNode... exprSingles) {
//         this.exprSingles = Arrays.asList(exprSingles);
//     }
// 
//     @Override
//     protected String describe() {
//         final StringBuilder builder = new StringBuilder();
//         for(final ASTNode exprSingle : exprSingles) {
//             if(builder.length() > 0) {
//                 builder.append(", ");
//             }
//             builder.append(exprSingle.toString());
//         }
// 
//         return "Expr(" + builder.toString() + ")";
//     }
// 
//     @Override
//     public boolean equals(final Object obj) {
//         if(obj != null && obj instanceof Expr) {
//             return ((Expr)obj).exprSingles.equals(exprSingles);
//         }
// 
//         return false;
//     }
// 
//     public List<? extends ASTNode> getExprSingles() {
//         return exprSingles;
//     }
// }
// 
// Path: src/main/java/com/evolvedbinary/xpath/parser/ast/IfExpr.java
// public class IfExpr extends AbstractASTNode implements ExprSingle {
//     private final Expr testExpression;
//     private final ASTNode thenExpression; //TODO(AR) ideally should be ExprSingle... but as we simplify the AST, so we have to use ASTNode
//     private final ASTNode elseExpression; //TODO(AR) ideally should be ExprSingle... but as we simplify the AST, so we have to use ASTNode
// 
//     public IfExpr(final Expr testExpression, final ASTNode thenExpression, final ASTNode elseExpression) {
//         this.testExpression = testExpression;
//         this.thenExpression = thenExpression;
//         this.elseExpression = elseExpression;
//     }
// 
//     @Override
//     protected String describe() {
//         return "IfExpr(" + testExpression + " then " + thenExpression + " else " + elseExpression + ")";
//     }
// 
//     @Override
//     public boolean equals(final Object obj) {
//         if(obj != null && obj instanceof IfExpr) {
//             final IfExpr other = (IfExpr)obj;
//             return other.testExpression.equals(testExpression)
//                     && other.thenExpression.equals(thenExpression)
//                     && other.elseExpression.equals(elseExpression);
//         }
// 
//         return false;
//     }
// }


// Path: src/main/java/com/evolvedbinary/xpath/parser/ast/partial/PartialIfExpr.java
import com.evolvedbinary.xpath.parser.ast.ASTNode;
import com.evolvedbinary.xpath.parser.ast.Expr;
import com.evolvedbinary.xpath.parser.ast.IfExpr;

/**
 * XPath 2 Parser
 * A Parser for XPath 2
 * Copyright (C) 2016 Evolved Binary Ltd.
 *
 * This program is free software; you can redistribute it and/or modify
 * it under the terms of the GNU General Public License as published by
 * the Free Software Foundation; either version 2 of the License, or
 * (at your option) any later version.
 *
 * This program is distributed in the hope that it will be useful,
 * but WITHOUT ANY WARRANTY; without even the implied warranty of
 * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
 * GNU General Public License for more details.
 *
 * You should have received a copy of the GNU General Public License along
 * with this program; if not, write to the Free Software Foundation, Inc.,
 * 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA.
 */
package com.evolvedbinary.xpath.parser.ast.partial;


/**
 * Created by aretter on 15/02/2016.
 */
public class PartialIfExpr extends AbstractPartialASTNode<PartialIfExpr.PartialIfExpr1, ASTNode> {
    private final Expr testExpression;

    public PartialIfExpr(final Expr testExpression) {
        this.testExpression = testExpression;
    }

    @Override
    protected String describe() {
        return "IfExpr(" + testExpression + " then ? else ?)";
    }

    @Override
    public PartialIfExpr.PartialIfExpr1 complete(final ASTNode thenExpression) {
        return new PartialIfExpr1(thenExpression);
    }

    public class PartialIfExpr1 extends AbstractPartialASTNode<IfExpr, ASTNode> {