package ast.statement.classes; import ast.expression.Expression; import ast.statement.AbstractStatement; import ast.statement.Statement; import visitor.Visitor; import java.util.ArrayList; import java.util.List; public class IfElse extends AbstractStatement { Expression condition; List ifStmts; List elseStmts; public IfElse(int line, int column, Expression condition, List ifStmts, List elseStmts) { super(line, column); this.condition = condition; this.ifStmts = new ArrayList<>(ifStmts); this.elseStmts = new ArrayList<>(elseStmts); } public Expression getCondition() { return condition; } public List getIfStmts() { return ifStmts; } public List getElseStmts() { return elseStmts; } @Override public String toString() { return "if (" + getCondition() + ")" + getIfStmts() + " else" + getElseStmts(); } @Override public TR accept(Visitor v, TP param) { return v.visit(this, param); } }