@Test public void simplifySingleStatement() { Disjunction single = new Disjunction(ImmutableList.of(CALL_EXPR_CONTEXT)); assertThat(single.simplify(), is(CALL_EXPR_CONTEXT)); }
@Override public BooleanExpr simplify() { if (_simplified != null) { return _simplified; } ImmutableList.Builder<BooleanExpr> simpleDisjunctsBuilder = ImmutableList.builder(); for (BooleanExpr disjunct : _disjuncts) { BooleanExpr simpleDisjunct = disjunct.simplify(); if (simpleDisjunct.equals(BooleanExprs.FALSE)) { continue; } simpleDisjunctsBuilder.add(simpleDisjunct); if (simpleDisjunct.equals(BooleanExprs.TRUE)) { break; } } List<BooleanExpr> simpleDisjuncts = simpleDisjunctsBuilder.build(); if (simpleDisjuncts.isEmpty()) { _simplified = BooleanExprs.FALSE; } else if (simpleDisjuncts.size() == 1) { _simplified = simpleDisjuncts.get(0); } else { Disjunction simple = new Disjunction(); simple.setDisjuncts(simpleDisjuncts); simple.setComment(getComment()); _simplified = simple; simple._simplified = _simplified; } return _simplified; }
Disjunction extends BooleanExpr { @Override public BooleanExpr simplify() { if (_simplified != null) { return _simplified; } ImmutableList.Builder<BooleanExpr> simpleDisjunctsBuilder = ImmutableList.builder(); for (BooleanExpr disjunct : _disjuncts) { BooleanExpr simpleDisjunct = disjunct.simplify(); if (simpleDisjunct.equals(BooleanExprs.FALSE)) { continue; } simpleDisjunctsBuilder.add(simpleDisjunct); if (simpleDisjunct.equals(BooleanExprs.TRUE)) { break; } } List<BooleanExpr> simpleDisjuncts = simpleDisjunctsBuilder.build(); if (simpleDisjuncts.isEmpty()) { _simplified = BooleanExprs.FALSE; } else if (simpleDisjuncts.size() == 1) { _simplified = simpleDisjuncts.get(0); } else { Disjunction simple = new Disjunction(); simple.setDisjuncts(simpleDisjuncts); simple.setComment(getComment()); _simplified = simple; simple._simplified = _simplified; } return _simplified; } }
Disjunction extends BooleanExpr { @Override public BooleanExpr simplify() { if (_simplified != null) { return _simplified; } ImmutableList.Builder<BooleanExpr> simpleDisjunctsBuilder = ImmutableList.builder(); for (BooleanExpr disjunct : _disjuncts) { BooleanExpr simpleDisjunct = disjunct.simplify(); if (simpleDisjunct.equals(BooleanExprs.FALSE)) { continue; } simpleDisjunctsBuilder.add(simpleDisjunct); if (simpleDisjunct.equals(BooleanExprs.TRUE)) { break; } } List<BooleanExpr> simpleDisjuncts = simpleDisjunctsBuilder.build(); if (simpleDisjuncts.isEmpty()) { _simplified = BooleanExprs.FALSE; } else if (simpleDisjuncts.size() == 1) { _simplified = simpleDisjuncts.get(0); } else { Disjunction simple = new Disjunction(); simple.setDisjuncts(simpleDisjuncts); simple.setComment(getComment()); _simplified = simple; simple._simplified = _simplified; } return _simplified; } Disjunction();  Disjunction(BooleanExpr... disjuncts);  Disjunction(List<BooleanExpr> disjuncts); }
Disjunction extends BooleanExpr { @Override public BooleanExpr simplify() { if (_simplified != null) { return _simplified; } ImmutableList.Builder<BooleanExpr> simpleDisjunctsBuilder = ImmutableList.builder(); for (BooleanExpr disjunct : _disjuncts) { BooleanExpr simpleDisjunct = disjunct.simplify(); if (simpleDisjunct.equals(BooleanExprs.FALSE)) { continue; } simpleDisjunctsBuilder.add(simpleDisjunct); if (simpleDisjunct.equals(BooleanExprs.TRUE)) { break; } } List<BooleanExpr> simpleDisjuncts = simpleDisjunctsBuilder.build(); if (simpleDisjuncts.isEmpty()) { _simplified = BooleanExprs.FALSE; } else if (simpleDisjuncts.size() == 1) { _simplified = simpleDisjuncts.get(0); } else { Disjunction simple = new Disjunction(); simple.setDisjuncts(simpleDisjuncts); simple.setComment(getComment()); _simplified = simple; simple._simplified = _simplified; } return _simplified; } Disjunction();  Disjunction(BooleanExpr... disjuncts);  Disjunction(List<BooleanExpr> disjuncts); @Override T accept(BooleanExprVisitor<T, U> visitor, U arg); @Override Set<String> collectSources(
      Set<String> parentSources, Map<String, RoutingPolicy> routingPolicies, Warnings w); @Override Result evaluate(Environment environment); @JsonProperty(PROP_DISJUNCTS) List<BooleanExpr> getDisjuncts(); @JsonProperty(PROP_DISJUNCTS) void setDisjuncts(List<BooleanExpr> disjuncts); @Override BooleanExpr simplify(); @Override boolean equals(Object obj); @Override int hashCode(); @Override String toString(); }
Disjunction extends BooleanExpr { @Override public BooleanExpr simplify() { if (_simplified != null) { return _simplified; } ImmutableList.Builder<BooleanExpr> simpleDisjunctsBuilder = ImmutableList.builder(); for (BooleanExpr disjunct : _disjuncts) { BooleanExpr simpleDisjunct = disjunct.simplify(); if (simpleDisjunct.equals(BooleanExprs.FALSE)) { continue; } simpleDisjunctsBuilder.add(simpleDisjunct); if (simpleDisjunct.equals(BooleanExprs.TRUE)) { break; } } List<BooleanExpr> simpleDisjuncts = simpleDisjunctsBuilder.build(); if (simpleDisjuncts.isEmpty()) { _simplified = BooleanExprs.FALSE; } else if (simpleDisjuncts.size() == 1) { _simplified = simpleDisjuncts.get(0); } else { Disjunction simple = new Disjunction(); simple.setDisjuncts(simpleDisjuncts); simple.setComment(getComment()); _simplified = simple; simple._simplified = _simplified; } return _simplified; } Disjunction();  Disjunction(BooleanExpr... disjuncts);  Disjunction(List<BooleanExpr> disjuncts); @Override T accept(BooleanExprVisitor<T, U> visitor, U arg); @Override Set<String> collectSources(
      Set<String> parentSources, Map<String, RoutingPolicy> routingPolicies, Warnings w); @Override Result evaluate(Environment environment); @JsonProperty(PROP_DISJUNCTS) List<BooleanExpr> getDisjuncts(); @JsonProperty(PROP_DISJUNCTS) void setDisjuncts(List<BooleanExpr> disjuncts); @Override BooleanExpr simplify(); @Override boolean equals(Object obj); @Override int hashCode(); @Override String toString();  }