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()); s.append(")"); } else if (e instanceof BuiltInCall) { BuiltInCall b = (BuiltInCall) e; appendCall(s, b.getName(), b.getArguements()); } else if (e instanceof FunctionCall) { FunctionCall f = (FunctionCall) e; appendCall(s, f.getName().getUnicodeString(), f.getArguements()); } else if (e instanceof LiteralExpression) { appendLiteralExpression(s, (LiteralExpression) e); } else if (e instanceof UriRefExpression) { s.append(((UriRefExpression) e).getUriRef().toString()); } }
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()); s.append(")"); } else if (e instanceof BuiltInCall) { BuiltInCall b = (BuiltInCall) e; appendCall(s, b.getName(), b.getArguements()); } else if (e instanceof FunctionCall) { FunctionCall f = (FunctionCall) e; appendCall(s, f.getName().getUnicodeString(), f.getArguements()); } else if (e instanceof LiteralExpression) { appendLiteralExpression(s, (LiteralExpression) e); } else if (e instanceof UriRefExpression) { s.append(((UriRefExpression) e).getUriRef().toString()); } }