Suppose I have an expression of the format

```
a>10 and b>20 and c>30

```

I want to get a list of expressions as follows

```
a>10
b>20
c>30

```

If I use the expression visitor pattern, for the AndExpression visitor, I wrote something like

```
public void visit(AndExpression andExpression) {
    andExpression.getLeftExpression().accept(this);
    andExpression.getRightExpression().accept(this);
}

```

but this however recursively runs and goes into each of the other visitor pattern methods. How do I stop when a smaller expression is obtained?

If i just use getLeftExpressions() and getRightExpression(), what I get in the first run is "a>10" as the left and "b>20 and c>30" as the right.