@Override public boolean accept(ExpressionVisitor v) { if (v.visitEnter(this)) { for (ExpressionNode operand : operands) { if (!operand.accept(v)) break; } } return v.visitLeave(this); }
/** * Implementation of the visitor design pattern. * * <p>Calls visit on the visitor and then passes the visitor on to the accept method of the base * and the exponent. * * @param visitor the visitor */ public void accept(ExpressionNodeVisitor visitor) { visitor.visit(this); base.accept(visitor); exponent.accept(visitor); }
/** * Implementation of the visitor design pattern. * * <p>Calls visit on the visitor and then passes the visitor on to the accept method of the * argument. * * @param visitor the visitor */ public void accept(ExpressionNodeVisitor visitor) { visitor.visit(this); argument.accept(visitor); }