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 WhileLoop extends AbstractStatement { Expression condition; List statements; public WhileLoop(int line, int column, Expression condition, List statements) { super(line, column); this.condition = condition; this.statements = new ArrayList<>(statements); } public Expression getCondition() { return condition; } public List getStatements() { return statements; } @Override public String toString() { return "while (" + getCondition() + ")" + getStatements(); } @Override public TR accept(Visitor v, TP param) { return v.visit(this, param); } }