private void appendExpression(StringBuffer s, Expression e) {
if (e instanceof Variable) {
appendVariable(s, (Variable) e);
} else if (e instanceof BinaryOperation) {
BinaryOperation bo = (BinaryOperation) e;
s.append("(");
appendExpression(s, bo.getLhsOperand());
s.append(") ").append(bo.getOperatorString()).append(" (");
appendExpression(s, bo.getRhsOperand());
s.append(")");
} else if (e instanceof UnaryOperation) {
UnaryOperation uo = (UnaryOperation) e;
s.append(uo.getOperatorString()).append(" (");
appendExpression(s, uo.getOperand());