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