@Test public void testBuildGt() { String str = ExpressionBuilder.build(new Node(Type.GT, new Node("abc"))); Assert.assertEquals("> abc", str); }
public static String build(Node node) { switch (node.type) { case VALUE: return node.value; case AND: case OR: return "(" + build(node.left) + " " + node.type.getRepr() + " " + build(node.right) + ")"; case NOT: case GT: case GTE: case LT: case LTE: case DIFFERS: case EQ: return node.type.getRepr() + " " + build(node.left); } throw new IllegalStateException("Unexpected node type: "+node.type.name()); }
ExpressionBuilder { public static String build(Node node) { switch (node.type) { case VALUE: return node.value; case AND: case OR: return "(" + build(node.left) + " " + node.type.getRepr() + " " + build(node.right) + ")"; case NOT: case GT: case GTE: case LT: case LTE: case DIFFERS: case EQ: return node.type.getRepr() + " " + build(node.left); } throw new IllegalStateException("Unexpected node type: "+node.type.name()); } }
ExpressionBuilder { public static String build(Node node) { switch (node.type) { case VALUE: return node.value; case AND: case OR: return "(" + build(node.left) + " " + node.type.getRepr() + " " + build(node.right) + ")"; case NOT: case GT: case GTE: case LT: case LTE: case DIFFERS: case EQ: return node.type.getRepr() + " " + build(node.left); } throw new IllegalStateException("Unexpected node type: "+node.type.name()); }  }
ExpressionBuilder { public static String build(Node node) { switch (node.type) { case VALUE: return node.value; case AND: case OR: return "(" + build(node.left) + " " + node.type.getRepr() + " " + build(node.right) + ")"; case NOT: case GT: case GTE: case LT: case LTE: case DIFFERS: case EQ: return node.type.getRepr() + " " + build(node.left); } throw new IllegalStateException("Unexpected node type: "+node.type.name()); }  static String build(Node node); }
ExpressionBuilder { public static String build(Node node) { switch (node.type) { case VALUE: return node.value; case AND: case OR: return "(" + build(node.left) + " " + node.type.getRepr() + " " + build(node.right) + ")"; case NOT: case GT: case GTE: case LT: case LTE: case DIFFERS: case EQ: return node.type.getRepr() + " " + build(node.left); } throw new IllegalStateException("Unexpected node type: "+node.type.name()); }  static String build(Node node);  }